Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp293121pxb; Fri, 16 Apr 2021 06:00:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl8eR5L/GCNQ96mKpmP0V8eGnBh1x70IB9+JyFl+R/H7yAm+SCKJsr5PKz8aajUiDxRTzA X-Received: by 2002:aa7:c442:: with SMTP id n2mr7739560edr.63.1618578015778; Fri, 16 Apr 2021 06:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618578015; cv=none; d=google.com; s=arc-20160816; b=junShuyjfuIdBiSt9STNy3Sbb+l3fAKO8aZYyt1KUUCzaN74qezt2kMkLKBEET64E1 50UMuU2kwSRpc62xagusr15dMMIAiFEd4BUQF3CM7iWqdsDBnftd1akQmTXP1dPmlWX1 1kggVRZBYqSLX/L6gIjrsYewOo4jF0wwwpenre/+vymtyJpLMBtEUi8fDIA6LbBAZeze 2U4SxG7KvBkuwAhX3/LQECFdgM7zfaCvmocjjdaQ2+CpwgimhBT3PQ/tKwTy/l+XsLuK sseSBg+9moGqKJUpog+9Q91h2fAn878b5okRh8C6zTkpqBBJoxAB3C2n1MPo4S36jNn0 DMTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=8BhQDSwJbqkUr2RiSfoKazL1/8OCB4Gwp76wS1n/33U=; b=iMktnZca1XqkXggaGF2YL0HRnHUjB3JoEe9Sroac0v6zruigndiRz+BuCeMX3i0DtX 50f3ey6r/7NsxBblWa10JTbEvxx77Cu/WV/PL/YNoAncPTqPqbilN3E64bN8bdEPVM79 vsYd8XyjDmaUtZyd0QqWndhnR9OvdiWVEwFkxLISiDrUzWkPLqAL3zQxP1SpzIcsbMbw ybLo01odLEj8VXmtbbfW+N8gMivtsOHs9R3n9xzz9zjZxOej11lsrIGDRvfk8bMXFsiW zWdrMjzoqTi0re3oBBDJi0WCl58K7QTi+KatpawHcQzy2gbTcdWyPPkuzUTnGihzMk/q dm/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id da8si4856104edb.320.2021.04.16.05.59.52; Fri, 16 Apr 2021 06:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S235533AbhDPMvy (ORCPT + 99 others); Fri, 16 Apr 2021 08:51:54 -0400 Received: from foss.arm.com ([217.140.110.172]:40762 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235074AbhDPMvx (ORCPT ); Fri, 16 Apr 2021 08:51:53 -0400 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 AAD8411B3; Fri, 16 Apr 2021 05:51:28 -0700 (PDT) Received: from [10.57.57.112] (unknown [10.57.57.112]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 99AA23F85F; Fri, 16 Apr 2021 05:51:26 -0700 (PDT) Subject: Re: [PATCH v4 4/6] perf arm-spe: Assign kernel time to synthesized event To: Leo Yan Cc: Arnaldo Carvalho de Melo , Al Grant , John Garry , Will Deacon , Mathieu Poirier , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <20210412091006.468557-1-leo.yan@linaro.org> <20210412091006.468557-5-leo.yan@linaro.org> <9036368a-e824-3d63-da5b-54cf32a86aed@arm.com> <20210415152348.GF1011890@leoy-ThinkPad-X240s> From: James Clark Message-ID: Date: Fri, 16 Apr 2021 15:51:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210415152348.GF1011890@leoy-ThinkPad-X240s> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/04/2021 18:23, Leo Yan wrote: > On Thu, Apr 15, 2021 at 05:46:31PM +0300, James Clark wrote: >> >> >> On 12/04/2021 12:10, Leo Yan wrote: >>> In current code, it assigns the arch timer counter to the synthesized >>> samples Arm SPE trace, thus the samples don't contain the kernel time >>> but only contain the raw counter value. >>> >>> To fix the issue, this patch converts the timer counter to kernel time >>> and assigns it to sample timestamp. >>> >>> Signed-off-by: Leo Yan >>> --- >>> tools/perf/util/arm-spe.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c >>> index 23714cf0380e..c13a89f06ab8 100644 >>> --- a/tools/perf/util/arm-spe.c >>> +++ b/tools/perf/util/arm-spe.c >>> @@ -234,7 +234,7 @@ static void arm_spe_prep_sample(struct arm_spe *spe, >>> struct arm_spe_record *record = &speq->decoder->record; >>> >>> if (!spe->timeless_decoding) >>> - sample->time = speq->timestamp; >>> + sample->time = tsc_to_perf_time(record->timestamp, &spe->tc); >> >> >> I noticed that in arm_spe_recording_options() the TIME sample bit is set regardless of any options. >> I don't know of a way to remove this, and if there isn't, does that mean that all the code in this >> file that looks at spe->timeless_decoding is untested and has never been hit? >> >> Unless there is a way to get a perf file with only the AUXTRACE event and no others? I think that one >> might have no timestamp set. Otherwise other events will always have timestamps so spe->timeless_decoding >> is always false. > > Good point. To be honest, I never noticed this issue until you > mentioned this. > > We should fix for the "timeless" flow; and it's questionable for the > function arm_spe_recording_options(), except for setting > PERF_SAMPLE_TIME, it also hard codes for setting > PERF_SAMPLE_CPU and PERF_SAMPLE_TID. Might need to carefully go > through this function. > Yeah, it's not strictly related to your change, which is definitely an improvement. But maybe we should have a look at the SPE implementation relating to timestamps as a whole. > Thanks, > Leo >