Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp5740342rwr; Mon, 24 Apr 2023 08:19:56 -0700 (PDT) X-Google-Smtp-Source: AKy350ao0xZy/iu++w1k9Mfxfa9dYWoZLYOaYeLMvF/ZjI6iMHP0OBYhhelLqgrEYl/xI6lSDHnz X-Received: by 2002:a05:6a00:1341:b0:63e:6b8a:7975 with SMTP id k1-20020a056a00134100b0063e6b8a7975mr21304575pfu.9.1682349596282; Mon, 24 Apr 2023 08:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682349596; cv=none; d=google.com; s=arc-20160816; b=H3+f/sSv4+0czFcetL5/4CPYRm128486wd7fwWcaMV4YqK6tAVHp/j1HXiNqlXmj4V pwTYIEH+rhQMDcjvUspVzEggkXr7yWsZHbmHCqngYdzurFamc/k/XcDmizX3nVP9V7Rr jLcbdZiv0ZpdqES38tWaXLqPPfYLpugR8ltJyj5oIXUU05XeUmqlVorRqsxjuVA7Agg0 koFv6u+7Bw/y8Vm2gHbjjVjA+SBaUQ0wPq6h+m588dKzxcgCfytd6vd7Ial7LmRR97rn 4c8ZaU/yeS+LYZAppsLt4gyqOQ+DvZe4tFjALnt5p0TGg6vCubY1XJ5/7KmMvvHT0kH/ lu7A== 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=qmntZ/ckWS7tXOONW+hlmQ+6CzNlC/m4qG4Le+5m3fQ=; b=RaaDq4ix6WP501LZv1PidDFGv7+bzm/sAIBqvvg7jd7mTGtkcRaeEMgF+mXLix9kcH 0F48j0R2ciyBGguE9SYP/OqKDefVWirOgs263UTFydwaY2coVKRBY0ycR+23uLu+Db3H C5vAAc8tKjdjpw5+De/XOxvUicM00Agq/uozUPPNJT2GkMbNyoe3FGpQgneuby/C4Phz Jlzidsi5t4R7mQUNYQAYB+vkMbLoXhrg3zeu/EIVhA3MH9A0TwOtGramP3AVao1ljdVD 1JsbcBH2nsgH/oKtO/jfYrKJcezGKt37QwtKg5itlzO/DtAzetFAnrn16TrwiohEvZfi ZzAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a635450000000b0050f83aa181esi11688659pgm.698.2023.04.24.08.19.38; Mon, 24 Apr 2023 08:19:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231667AbjDXPOs (ORCPT + 99 others); Mon, 24 Apr 2023 11:14:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjDXPOr (ORCPT ); Mon, 24 Apr 2023 11:14:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0788110D3; Mon, 24 Apr 2023 08:14:42 -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 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> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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