Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2360310rdg; Mon, 16 Oct 2023 01:42:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHzrylI4QExrGaWylMZMYdNtuVTRI2a1kDIqkWAYvsdd8BZqtnbB1YXz+G5Fqr5GMxXPCFF X-Received: by 2002:a05:6a00:22ce:b0:6bd:66ed:c4e with SMTP id f14-20020a056a0022ce00b006bd66ed0c4emr2590468pfj.9.1697445749381; Mon, 16 Oct 2023 01:42:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697445749; cv=none; d=google.com; s=arc-20160816; b=TprRWlU/P0OOwEpXcHkRkrETrqciyaqinCrV6vFjGLqAEX8GmXSNqVDinR6QPUtbav hOHqgDbLnNFkocYtJJtEF2nsySd7Y0LV1x8zJdN0qOXoshS/iHBJ5onxXRowqWoMHoNd v10JWT+8wLxbI7grGd++420+dfJylxcoBgXQxvhZXl8Jy94w997JOL73JTUl/PDmrjBa Sygc3Kx+hvPwypcpJ9QONM/QzsMxAMLVcpiwibf01L98bzFUMqGRQdTpyV7/LN/wDEcG kWsXTzU4y8IBjXfsp6ppfMjbr8/8uKIsMs9QXktXqjrREIjlkmNI92ddZikCOKYygoEC f1Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=JVlhHcYcIU2o+Htffc8JjJTR7nmH9E74NMC6J1Pya5g=; fh=UmTZk/w/pq6J7gFSAM8p3N8nfJShagI/URiCDpRFBR8=; b=zmrMcn0nDHfBbFujHHwbqNrxWtkh9VBlpYxIPOKIAADGuDaJxG+TNmXYUH3Emdj0B5 51qQLRxRneu3rcDhNSuuscASm0WG7kbL5b08ZjH602ea4+bqRNrHjJfLvtaCTCmqjnFh 4pWnHVh1EnMmkyM7FuEQmzLj5/OnVA+eZ0US2U2BJqrmlK46oSJ3Gsq3JYh58N49A/+h nNmepgYynrtE51SaN4Gp6vpI6e+uyaGoncnfRwuRgK/orwwYo72Psbth496anhZY5N4A Ja4VCspzMIBP3vZ1I5eg4kBdC8eSrnOh9CH/cIoEJHU6YQCGoELxaJ8vYXjTbvZM4TGK o/oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id d19-20020a056a00199300b006be322191dasi1112764pfl.140.2023.10.16.01.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:42:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 97B7B8073879; Mon, 16 Oct 2023 01:42:26 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbjJPImO (ORCPT + 99 others); Mon, 16 Oct 2023 04:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjJPImN (ORCPT ); Mon, 16 Oct 2023 04:42:13 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9037BA1; Mon, 16 Oct 2023 01:42:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A86BB1FB; Mon, 16 Oct 2023 01:42:50 -0700 (PDT) Received: from [10.57.1.186] (unknown [10.57.1.186]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB3C63F5A1; Mon, 16 Oct 2023 01:42:07 -0700 (PDT) Message-ID: Date: Mon, 16 Oct 2023 09:42:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v1 RESEND 2/2] perf cs-etm: Respect timestamp option To: Leo Yan , Arnaldo Carvalho de Melo , James Clark , Mike Leach Cc: John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231014074159.1667880-1-leo.yan@linaro.org> <20231014074159.1667880-3-leo.yan@linaro.org> From: Suzuki K Poulose In-Reply-To: <20231014074159.1667880-3-leo.yan@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 01:42:26 -0700 (PDT) On 14/10/2023 08:41, Leo Yan wrote: > When users pass the option '--timestamp' or '-T' in the record command, > all events will set the PERF_SAMPLE_TIME bit in the attribution. In > this case, the AUX event will record the kernel timestamp, but it > doesn't mean Arm CoreSight enables timestamp packets in its hardware > tracing. > > If the option '--timestamp' or '-T' is set, this patch always enables > Arm CoreSight timestamp, as a result, the bit 28 in event's config is to > be set. > > Before: > > # perf record -e cs_etm// --per-thread --timestamp -- ls > # perf script --header-only > ... > # event : name = cs_etm//, , id = { 69 }, type = 12, size = 136, > config = 0, { sample_period, sample_freq } = 1, > sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, > disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 > ... > > After: > > # perf record -e cs_etm// --per-thread --timestamp -- ls > # perf script --header-only > ... > # event : name = cs_etm//, , id = { 49 }, type = 12, size = 136, > config = 0x10000000, { sample_period, sample_freq } = 1, > sample_type = IP|TID|TIME|CPU|IDENTIFIER, read_format = ID|LOST, > disabled = 1, enable_on_exec = 1, sample_id_all = 1, exclude_guest = 1 > ... > > Signed-off-by: Leo Yan > Reviewed-by: James Clark Acked-by: Suzuki K Poulose > --- > tools/perf/arch/arm/util/cs-etm.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index cf9ef9ba800b..58c506e9788d 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -442,6 +442,15 @@ static int cs_etm_recording_options(struct auxtrace_record *itr, > "contextid", 1); > } > > + /* > + * When the option '--timestamp' or '-T' is enabled, the PERF_SAMPLE_TIME > + * bit is set for all events. In this case, always enable Arm CoreSight > + * timestamp tracing. > + */ > + if (opts->sample_time_set) > + evsel__set_config_if_unset(cs_etm_pmu, cs_etm_evsel, > + "timestamp", 1); > + > /* Add dummy event to keep tracking */ > err = parse_event(evlist, "dummy:u"); > if (err)