Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp832664lqo; Fri, 17 May 2024 03:01:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXBVOJbC76mY9evjQOHOzywHyU7uj26inuK25Af0PclJGjz8WgiyqaryDJvisLhHGdc103aqDjk7f8XHEsAklb0Gile66G0t+FqxNDlXw== X-Google-Smtp-Source: AGHT+IF5V8R6DiG7kTOtUMOizH+KKZSj267F/Z+A6Fh4rCsi6X8069s13KEazDPvP1ZozbSD/Jtv X-Received: by 2002:a17:906:68d5:b0:a59:a078:9e41 with SMTP id a640c23a62f3a-a5a2d5cdb7fmr1344846966b.45.1715940084552; Fri, 17 May 2024 03:01:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715940084; cv=pass; d=google.com; s=arc-20160816; b=AOaXsCMVUSsB14qK4VBngq3h9BBKedrggcg/Wfj3j9pw+hUUgh+i8fOTm7t7zFyOqH sxs2Pu0Q2Xt+ccQUwdrxIuhi61sV1a6oTmI7kai2jEkqunWVd1OSetuypT9fZYSXRfFR KQHrUXHytZCSfCE4kPdcU3KwveOR0g+uff/8H6gO/dNs+wAEBnnTiUMbRLRT65Zz+Fr2 zs2YTmjsKwzTYpgKW3ndvFB8eCvTGeCcUHWWySemFRhiVacryoafurQ5fYCSNSUa6jiy 4dNgCaf8o7Rotx1wfU7LTYZknWzfb0ODxhFFOA0ChWJ+Nydknidxkpv9TyblUSnXQaMl U7sg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=RZHz6+CkXj+fgBwE03OLegLHdfEkf06TIgZn6LW5tzY=; fh=ZDc3o94x7Zh3SCuq2MTPD1uqgxA8qrkp9kb3YDXRVh0=; b=eP48APa0CRZVjWWhJfb5vsYwEFqs1Q3zL5h5zm5k1prx+gLxGlBPRqP8ic6eMe8L7e J6UzgKl7q4jSATeXPH2EII13bFB6KFQKMUjpPL5FVHzdfcI8r5DrgVH7gLmy78bJTmsj lmsaLX8SWEVIsqgvjQiI7TptPsKoo1VvACjedWbxpvywOzChYDV/6bYEcKiE+wxUA7Qi KFcIrMfUPlQY/Ttypqn3k4VK/AaXdzUGiLnakeZZxeSSRoPmUqV5GM6X10x/vCFG9HgM 4syedwy4qrsVNytYDp+yuxxKXrBxGlosNrFKZZezryE8+Fc7eRIBljx1qiiMRXJq6TGP +JOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-181968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181968-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17be65f5si987654066b.715.2024.05.17.03.01.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 03:01:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-181968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-181968-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-181968-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4A4BD1F24467 for ; Fri, 17 May 2024 10:01:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8E0152C861; Fri, 17 May 2024 10:01:17 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D787323770; Fri, 17 May 2024 10:01:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715940077; cv=none; b=alSFO4hipDNtNre7NTQ3bLlWNSUGwZiU9PIq+MEq4S0Gou4Y6cIAFFipIuXUdvXgkceAtCaR0iANc+YrfU72jRHcX8yXrC3IihpMJvPjCENC4zubpvz2asb0SjiLd8pSpt8jJHaVnZ0a4owwx0ATZtUYHdFGUvhizN9TbNeyBl8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715940077; c=relaxed/simple; bh=DIGYKbma4xgmMvhulhhTVRwTtUsbtMcm/O0rYLgnZSc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=e/cjGQY5OGyKG28CEO63r59oJGDLgOIIwhs2+fsyoN6QQXc8IIqhEkQum5gTzmoBPPZPQ3j3WMg22m1gFglql3/u/29b2QSKx7KPYOA4yP30hgSDbASs7GswV2KPCrlvQ9gZIS0tNFE695zWJAvyovaT/SZxtGzvd/lh7zgI9j0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 AA9C21424; Fri, 17 May 2024 03:01:31 -0700 (PDT) Received: from [10.91.2.16] (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D98DF3F762; Fri, 17 May 2024 03:01:04 -0700 (PDT) Message-ID: <02bec885-5fd7-42dd-b85c-9547be7d3211@arm.com> Date: Fri, 17 May 2024 12:01:02 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 16/17] coresight: Re-emit trace IDs when the sink changes in per-thread mode To: Suzuki K Poulose Cc: Alexander Shishkin , Maxime Coquelin , Alexandre Torgue , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Jiri Olsa , Ian Rogers , Adrian Hunter , John Garry , Will Deacon , Leo Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-perf-users@vger.kernel.org, gankulkarni@os.amperecomputing.com, scclevenger@os.amperecomputing.com, coresight@lists.linaro.org, mike.leach@linaro.org References: <20240429152207.479221-1-james.clark@arm.com> <20240429152207.479221-18-james.clark@arm.com> <0d433917-f638-4ca6-ba6a-1d5e85895024@arm.com> Content-Language: en-US From: James Clark In-Reply-To: <0d433917-f638-4ca6-ba6a-1d5e85895024@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 07/05/2024 13:05, Suzuki K Poulose wrote: > On 29/04/2024 16:22, James Clark wrote: >> In per-cpu mode there are multiple aux buffers and each one has a >> fixed sink, so the hw ID mappings which only need to be emitted once >> for each buffer, even with the new per-sink trace ID pools. >> >> But in per-thread mode there is only a single buffer which can be >> written to from any sink with now potentially overlapping trace IDs, so >> hw ID mappings need to be re-emitted every time the sink changes. >> >> This will require a change in Perf to track this so it knows which >> decode tree to use for each segment of the buffer. In theory it's also >> possible to look at the CPU ID on the AUX records, but this is more >> consistent with the existing system, and allows for correct decode using >> either mechanism. >> >> Signed-off-by: James Clark >> --- >>   drivers/hwtracing/coresight/coresight-etm-perf.c | 14 ++++++++++++++ >>   drivers/hwtracing/coresight/coresight-etm-perf.h |  2 ++ >>   2 files changed, 16 insertions(+) >> >> diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c >> b/drivers/hwtracing/coresight/coresight-etm-perf.c >> index f07173aa4d66..08f3958f9367 100644 >> --- a/drivers/hwtracing/coresight/coresight-etm-perf.c >> +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c >> @@ -499,6 +499,20 @@ static void etm_event_start(struct perf_event >> *event, int flags) >>                         &sink->perf_id_map)) >>           goto fail_disable_path; >>   +    /* >> +     * In per-cpu mode there are multiple aux buffers and each one has a >> +     * fixed sink, so the hw ID mappings which only need to be >> emitted once >> +     * for each buffer. >> +     * >> +     * But in per-thread mode there is only a single buffer which can be >> +     * written to from any sink with potentially overlapping trace >> IDs, so >> +     * hw ID mappings need to be re-emitted every time the sink changes. >> +     */ >> +    if (event->cpu == -1 && event_data->last_sink_hwid != sink) { >> +        cpumask_clear(&event_data->aux_hwid_done); >> +        event_data->last_sink_hwid = sink; >> +    } >> + > > With the traceid caching in the event_data per-cpu , we could avoid this > step ? > > Suzuki > > I don't think so, this is to inform the tool that the mappings have changed if the tool doesn't want to follow switch events. Unless I'm missing something, moving where the trace ids are stored doesn't mean that they will be re-sent when the mappings change?