From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50FF2C7618E for ; Mon, 24 Apr 2023 15:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k5Gu8iiUxUkkCagklnkWUFwcRB1usHL3qm0EogPPg50=; b=Tkpip7Voste8ST roX0RnGZYQqYs/3a8dkIOsKD2L1+zPFeqgOT6EhwzY6+ZmQGACK8rw0uo+mwxqNRLCYWcR0b12VF7 5mv+LGuYZQHjsXeFuNf4jMt0wX7cFxfPFWRi03OiF/1FVjqH/Q5DjJ4GaEKb957TOdpa0slTXCcB6 mI6wZWcxcVzwau5Q9BPsDZbGyBvz2V+B+68pror6x3Af2tjd2prWeDylr463yGHaMwmdGdL+WhH7D BBFiJHEvRigSbPHjc3qkRYJZoZ8IGCNDrO+dIP99vogot7e8b04Wh+9OWm7uStmc1OjZhFwxtOnM1 082Z6T18baCaqzTUZKmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pqxu5-00Gg4T-11; Mon, 24 Apr 2023 15:14:57 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pqxtx-00Gg2T-1o for linux-arm-kernel@lists.infradead.org; Mon, 24 Apr 2023 15:14:51 +0000 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 508F74B3; Mon, 24 Apr 2023 08:15:26 -0700 (PDT) Received: from [10.57.56.16] (unknown [10.57.56.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A26C53F64C; Mon, 24 Apr 2023 08:14:39 -0700 (PDT) Message-ID: <8acae291-2c3f-6010-de66-d4e54781d21f@arm.com> Date: Mon, 24 Apr 2023 16:14:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH 1/7] perf: cs-etm: Fix timeless decode mode detection To: James Clark , linux-perf-users@vger.kernel.org, coresight@lists.linaro.org, shy828301@gmail.com Cc: denik@google.com, Mathieu Poirier , Mike Leach , Leo Yan , John Garry , Will Deacon , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20230424134748.228137-1-james.clark@arm.com> <20230424134748.228137-2-james.clark@arm.com> From: Suzuki K Poulose In-Reply-To: <20230424134748.228137-2-james.clark@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230424_081449_693887_82733C79 X-CRM114-Status: GOOD ( 26.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 24/04/2023 14:47, James Clark wrote: > In this context, timeless refers to the trace data rather than the perf > event data. But when detecting whether there are timestamps in the trace > data or not, the presence of a timestamp flag on any perf event is used. > > Since commit f42c0ce573df ("perf record: Always get text_poke events > with --kcore option") timestamps were added to a tracking event when > --kcore is used which breaks this detection mechanism. Fix it by > detecting if trace timestamps exist by looking at the ETM config flags. > This would have always been a more accurate way of doing it anyway. > > This fixes the following error message when using --kcore with > Coresight: > > $ perf record --kcore -e cs_etm// --per-thread > $ perf report > The perf.data/data data has no samples! > > Fixes: f42c0ce573df ("perf record: Always get text_poke events with --kcore option") > Reported-by: Yang Shi > Link: https://lore.kernel.org/lkml/CAHbLzkrJQTrYBtPkf=jf3OpQ-yBcJe7XkvQstX9j2frz4WF-SQ@mail.gmail.com/ > Signed-off-by: James Clark > --- > tools/perf/util/cs-etm.c | 30 ++++++++++++++++++------------ > 1 file changed, 18 insertions(+), 12 deletions(-) > > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 8dd81ddd9e4e..50593289d53c 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -2684,26 +2684,29 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session, > return 0; > } > > -static bool cs_etm__is_timeless_decoding(struct cs_etm_auxtrace *etm) > +static int cs_etm__setup_timeless_decoding(struct cs_etm_auxtrace *etm) minor nit: "setup" sound more like prepare to do what is required to do a timeless decoding, while we are doing more like, check if we have to do a timeless decoding. So may be: cs_etm_check_timeless_decoding() ? > { > struct evsel *evsel; > struct evlist *evlist = etm->session->evlist; > - bool timeless_decoding = true; > > /* Override timeless mode with user input from --itrace=Z */ > - if (etm->synth_opts.timeless_decoding) > - return true; > + if (etm->synth_opts.timeless_decoding) { > + etm->timeless_decoding = true; > + return 0; > + } > > /* > - * Circle through the list of event and complain if we find one > - * with the time bit set. > + * Find the cs_etm evsel and look at what its timestamp setting was > */ > - evlist__for_each_entry(evlist, evsel) { > - if ((evsel->core.attr.sample_type & PERF_SAMPLE_TIME)) > - timeless_decoding = false; > - } > + evlist__for_each_entry(evlist, evsel) minor nit: please retain the braces > + if (cs_etm__evsel_is_auxtrace(etm->session, evsel)) { > + etm->timeless_decoding = > + !(evsel->core.attr.config & BIT(ETM_OPT_TS)); > + return 0; > + } Otherwise, looks good to me Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel