Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp439192lqh; Tue, 7 May 2024 04:05:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVs49by8YjAZeBttQyCH/yLUGhPwUJWm6u2CDckvGNax0I4t4QF8CrZckP6ClHwRAt6tGk0rb60Cjqi4sjy37d6bMlCvEvm1l/QXaV/rQ== X-Google-Smtp-Source: AGHT+IFvee2+NMstf9SBpLsjMCKUjxr++Z8UXqMiKjllcanO2T9i3J4FHvXlQzD3oZ7BC5Jy6Y3Y X-Received: by 2002:a05:6214:5191:b0:6a0:ce3b:b4a6 with SMTP id kl17-20020a056214519100b006a0ce3bb4a6mr14457466qvb.11.1715079959132; Tue, 07 May 2024 04:05:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715079959; cv=pass; d=google.com; s=arc-20160816; b=ZVrQbeEooM+tintUsGPXbV983SWqD3N3hGW3V4i8GY0S/dspIKbo2hbKvzzWXPkLKr UvYsrVKuMjwBji++H5e9BKDa8Q4OdhUV6zxdkZDkFfqeDIth8OSbhGn53XH0KXfC3fGs uJb+Az6KqAIKSLJQi9wsja9YIc7yyNiAaCg5z3EbrCaluUxqwkEkvALZvo+xBpWdJuyM G7+msEcgZR6Okc26W3+3ZS3Uvv+0vuHUsrMRL8m55wPVhT0nLwg4cp9DHBOiWcG+FxZf 4HgM6XUhV6QJJ6UTwgps6fUgKmox1d9PXl3XI4M1TreBoOS2vs8X7b6ECcQBTo86hKa4 HduA== 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=Uj8bKO/OmtjQFThSSw5HQ6kS3CLmWq4/UquLl4VMGsI=; fh=im8hDodNVMZvlQ1vbFrK3buvHwOLIqGt/s2qXZ26vNE=; b=unLF8PEZrG1nvTtbbnjqdzsotPoADk9PCKw/p+vWvV38akwDxLLIx5tb5unBBGV1bP 4SJMLVEF2W2Ap7fltS1xywxgh8MMXharwGQKXsPHYrIePsO0uTw175+CPw7p53Fj/fS2 mSXD2JJwmkzewXlzTg1RTi20bsliewnj2onIgCc10SpOIlUQc8//FgSZ/iByDzED6d/i CCAQYz+91mGmxi5Fxv7bBp08YE/N1iGSqetwkR40QnyKPSEAY7W/8cRoNdVZTHt4AHAX o3aORasCWTHUdN38luNOQv0mSP0AEALkst4ROo9wXZqSGyDe9B6Al/+YLRZ9ws17Ogsh o9ng==; 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-171168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171168-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gh6-20020a05621429c600b0069b50a68648si11367535qvb.423.2024.05.07.04.05.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 04:05:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-171168-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171168-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D98111C23710 for ; Tue, 7 May 2024 11:05:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 027C21514DE; Tue, 7 May 2024 11:05:52 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B258DAD5D; Tue, 7 May 2024 11:05:49 +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=1715079951; cv=none; b=FD4Mdr4vqwL3orfo1fk9d55CCrTTKEvBRVMYuGIqwlKVz2kGhmmMUDeqHBRkWXZEopNdw7R9PGs2mWR4qdaQMCNHC8/MK7fPtuBkj8kjav7LLAk02HbE4jGAz35WAglkkRq5guU/O7WcluPZqykBtIzMz6IiHeXmg0/oeuGwstg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715079951; c=relaxed/simple; bh=vBaCcJ5JJ3DWlgDYYKqw/OHbVKxZn9vOtoPAl8vKR84=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AT5WjQCzoM9lgj2cDjyTYKZj+mu42lIWXteQvHfyUvdxnp6XN+K4FUclrMWXoboiLfThBNonhYSYAqRu0HJ+8G130+EkzKlkv2YFsOxQF5qUSM0iW8cY1cpew7WB9zg2AlnFWs2Xmb4UJ1tNGKWhEP27M+3OKqioedA1ZOkeyRI= 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 D9D1D1063; Tue, 7 May 2024 04:06:14 -0700 (PDT) Received: from [10.1.197.1] (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 41DA83F587; Tue, 7 May 2024 04:05:46 -0700 (PDT) Message-ID: <0d433917-f638-4ca6-ba6a-1d5e85895024@arm.com> Date: Tue, 7 May 2024 12:05:44 +0100 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: James Clark , linux-perf-users@vger.kernel.org, gankulkarni@os.amperecomputing.com, scclevenger@os.amperecomputing.com, coresight@lists.linaro.org, mike.leach@linaro.org 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 References: <20240429152207.479221-1-james.clark@arm.com> <20240429152207.479221-18-james.clark@arm.com> Content-Language: en-US From: Suzuki K Poulose In-Reply-To: <20240429152207.479221-18-james.clark@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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