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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA7F0C433DB for ; Mon, 25 Jan 2021 10:35:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B3052145D for ; Mon, 25 Jan 2021 10:35:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727645AbhAYKd7 (ORCPT ); Mon, 25 Jan 2021 05:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727466AbhAYK0v (ORCPT ); Mon, 25 Jan 2021 05:26:51 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB5B8C06174A for ; Mon, 25 Jan 2021 02:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=qflAfQM3W85yj+1edLkQfUMSK1MfzCW3r7LrzwY7rZk=; b=lAnAWHbOETGWBQfpywT0L2QcMZ HWUw5CPr5RvY1aYiJOLTWOYn0inc8cKiMtUm3FxSdRyS00D+5Ak4W2IXpf5cy4/pvYiyDeRE4wPLk rMH5Pv3Da9au03PTpL1SatGbjz1QFx63yapRPGziYSLBnOoEHLUUJ5GDIBVwK6JflpUqSoYp3thY0 zqp3bhncrFjWFKN8bKpPbiqeFzfqnB2N6TjnGYM7R7VIoPs1SDvR4t1Hj+ydC3SueS+5GUG5bxvwY hpbdRlQnlAPbJg6enhy4JhPG6AWeBQ4Tv+RJSuHAveMkeXPOZ33WB9zvRLE7M13cKcNAAJucXzsug EvM8iVkw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l3z3g-0044mD-Tb; Mon, 25 Jan 2021 10:25:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5EF193010C8; Mon, 25 Jan 2021 11:25:17 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3CF9D2B0615C6; Mon, 25 Jan 2021 11:25:17 +0100 (CET) Date: Mon, 25 Jan 2021 11:25:17 +0100 From: Peter Zijlstra To: Suzuki K Poulose Cc: Alexander Shishkin , linux-kernel@vger.kernel.org, coresight@lists.linaro.org, Ingo Molnar , will@kernel.org, mark.rutland@arm.com, mike.leach@linaro.org, al.grant@arm.com, anshuman.khandual@arm.com, mathieu.poirier@linaro.org, linux-arm-kernel@lists.infradead.org, jolsa@redhat.com, acme@kernel.org Subject: Re: [RFC PATCH] perf: Handle multiple formatted AUX records Message-ID: References: <20210122151829.2890484-1-suzuki.poulose@arm.com> <20210122151829.2890484-2-suzuki.poulose@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210122151829.2890484-2-suzuki.poulose@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2021 at 03:18:29PM +0000, Suzuki K Poulose wrote: > CoreSight PMU supports aux-buffer for the ETM tracing. The trace > generated by the ETM (associated with individual CPUs, like Intel PT) > is captured by a separate IP (CoreSight TMC-ETR/ETF until now). > > The TMC-ETR applies formatting of the raw ETM trace data, as it > can collect traces from multiple ETMs, with the TraceID to indicate > the source of a given trace packet. > > Arm Trace Buffer Extension is new "sink" IP, attached to individual > CPUs and thus do not provide additional formatting, like TMC-ETR. > > Additionally, a system could have both TRBE *and* TMC-ETR for > the trace collection. e.g, TMC-ETR could be used as a single > trace buffer to collect data from multiple ETMs to correlate > the traces from different CPUs. It is possible to have a > perf session where some events end up collecting the trace > in TMC-ETR while the others in TRBE. Thus we need a way > to identify the type of the trace for each AUX record. > > This patch adds a new flag to indicate the trace format > for the given record. Also, includes the changes that > demonstrates how this can be used in the CoreSight PMU > to solve the problem. > > Signed-off-by: Suzuki K Poulose > --- > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index b15e3447cd9f..ea7dcc7b30f0 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -1109,6 +1109,7 @@ enum perf_callchain_context { > #define PERF_AUX_FLAG_OVERWRITE 0x02 /* snapshot from overwrite mode */ > #define PERF_AUX_FLAG_PARTIAL 0x04 /* record contains gaps */ > #define PERF_AUX_FLAG_COLLISION 0x08 /* sample collided with another */ > +#define PERF_AUX_FLAG_ALT_FMT 0x10 /* this record is in alternate trace format */ Since we have a whole u64, do we want to reserve a whole nibble (or maybe even a byte) for a format type? Because with a single bit like this, we'll kick ourselves when we end up with the need for a 3rd format type.