From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C4EF466B0E for ; Fri, 21 Aug 2026 10:01:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787306498; cv=none; b=CGfMj2uTFOR8S5vfRN0ydAJiw3ObiXFsp1LB+fQuBdXUd3UWuTa+5dNYr4pdjdEyxz6gFrgv/Wc/jo0VjZP8CX6bkABIyGJ0bCK3F/p+oz7vIZljZ7pcmq6MiMg2dkGH5cH0ipynkU6pJOJs5VZJOlR4AN1HaKrqmQZ3LW6tJCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787306498; c=relaxed/simple; bh=Z5a1DNbXGUAZxi2pCeV3KClyGRhdcC5JL8VPz64/HAk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a0zQ1wOxKDxNMPL4vSXWF2tNrbPKl7cRCbVw6N3ZHpCgExo39Rd43bh3CuY89OuyF547+crs5fO6jqH7kfvuKJiNMsSY9MN+9ahZRI9Z8Zf7wCBWUR+Z7SAR9BumElSLcW4qXOXOmHw/mu+cizLTE4FB51YiHDcpHALBBXKuy24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=y9oHLwRh; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y9oHLwRh" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4953e04ef16so7950855e9.2 for ; Fri, 21 Aug 2026 03:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1787306489; x=1787911289; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=irmyV/0eSa9w7db6iLa2bBa2VlGeL5F1eUiaUcSYjjA=; b=y9oHLwRhcSDmkd05WLNASPHa8SgAGDsSWa+K7+bEdOcvDb9Z/156aJY/dKebVhXPE/ M0HyjPKz/2qBm3VbhoIecgi/3sxiCtPCV9ukjDXhDxSDQltz7EY4sVmdYPPGAuAgTpeQ 8aJDTfiPYGv3+c8YvG4GAsD2JpGBhORs62OmCK2/e54UO11TocDeFN4h/NqJoQWKqIxB W325DeHd2KeeHWBeO9tS7edp+oJEhQFz01at4LojYJsCScRGRA0jHTV9jzvfqY7OBGJN F2jD5NmZ7y+B7RnS3L13Ddt9svF2RuXrJ747Iol2JDSEuMYM0C0IK4imFEv1hY9dlRNm 1GyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787306489; x=1787911289; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=irmyV/0eSa9w7db6iLa2bBa2VlGeL5F1eUiaUcSYjjA=; b=L/j+piGCuVXo/7OzKNJ3i81Pamis5boGH0rzY1P5PAk2kJsqMqWfqD9A4u9wRtDEw8 AJiDL5ps4sJ1+VPhwAD1OL5IT6CUQGXZeHQzYtnwQ9moVPAwW8KbB9VPTCDWXqW3DcZ8 JZVWyQ5PjOkKH9MW5HbN//3bCNMLw/UyUnrEpOTOSGWfqtzL0q0fzPCnL0Z7wUlhH0r6 CHhpvulp3ESizibjvylu/wr5cuhXUocnTM5xCARzM27NmXF+XXuTIb6PPVwh/qWsS318 7snwyTUgVP/wul5H4mLlVVWHzSkltQ6c1gFhXxsxyzAtKZRtRgDfbPtFa/yDG11WOrgC uu1Q== X-Forwarded-Encrypted: i=1; AHgh+RoDHbRHS4ubau0Ue4nS1ALYdKVnTsfCHPT1m22r/dwcH3dymA9fEnIoQYgQRWLPXbpBSxialfhvchehZ9I=@vger.kernel.org X-Gm-Message-State: AOJu0Ywwf6RbGVGfpLn1P/RvPXkCKhemHYQweN9iodqHBrC2HAYMrsxO V8bpb0jIgrZg2j9nzI0NBBplBeE/AGa1FpDVpEDKQtzFjpbQ3T6SwYxX8fLntyPXfXE= X-Gm-Gg: AR+sD13Dfl0kZZigM1wu2TAKT7JW0bu8BPVBYTaxURd1LegHCpCwnoZbDqlwldHaxnC PQeR8jEM5YY8a4HJLWC1+uuKGRh1jGvYXldP15b5cSqiOIVcxirjTfwvfLOYmHNLdc09tFcqlTq kOK0jPkLo8wX1Eb8a1RfXnTbcyJ1WJ/0Nr4TSduJCnpFZb8isVSr5XzwJyF4J7MzPPmdryUMtgu OoaCpS+1Q007Dds73jZdNAXshfBugn0nINbTWhSQjjFsrNBgdVtyrZYA7F9p/tZLVtAEJW1z1tW 3I8poBUDtjOJNlQq2P7SkvXgMCinL6K/4uIpfTGv61Pcbp8iWhUhi7pEz0CzNilp/Q7eSOhkpRX WnKcyluwfc1bdd6vb02SNFIjgSsn823zWPoR/NnlVHC6tkBJNFo3eGNOR4XokSWqUyCmCivFxZe NTHJgb1lI20vCKnBna4L8PirQvHEn6rLc348AwpwEPMyABfSQS+zdeyKQILaJ8ZPbfIA== X-Received: by 2002:a05:600c:4e47:b0:499:60bf:c6f7 with SMTP id 5b1f17b1804b1-499b8464503mr76563985e9.13.1787306488617; Fri, 21 Aug 2026 03:01:28 -0700 (PDT) Received: from [192.168.1.3] ([37.18.141.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-499b915c6ccsm21562555e9.13.2026.08.21.03.01.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Aug 2026 03:01:28 -0700 (PDT) Message-ID: Date: Fri, 21 Aug 2026 11:01:26 +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 6/6] coresight: perf: Retry failed HW_ID writes To: "coresight@lists.linaro.org" Cc: Arnaldo Carvalho de Melo , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, John Garry , Will Deacon , Mike Leach , Leo Yan , Suzuki K Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Leo Yan , Suyash Mahar , Amir Ayupov References: <20260821-james-cs-hw_id-output-failure-v1-0-9d532ddabcc3@linaro.org> <20260821-james-cs-hw_id-output-failure-v1-6-9d532ddabcc3@linaro.org> Content-Language: en-US From: James Clark In-Reply-To: <20260821-james-cs-hw_id-output-failure-v1-6-9d532ddabcc3@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 21/08/2026 10:50, James Clark wrote: > Don't set the aux_hwid_done bit when writes fail so that it can be > retried later if the ring buffer was full. > > Add a second attempt on stop in case this session only has one call > to start. Otherwise there is no chance to retry and it isn't fixed by > not setting aux_hwid_done. > > Signed-off-by: James Clark > --- > drivers/hwtracing/coresight/coresight-etm-perf.c | 52 +++++++++++++++--------- > 1 file changed, 32 insertions(+), 20 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c > index 09b21a711a87..0ffc5cd9c88f 100644 > --- a/drivers/hwtracing/coresight/coresight-etm-perf.c > +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c > @@ -536,6 +536,31 @@ static int etm_event_resume(struct coresight_path *path) > return ret; > } > > +static void etm_output_hw_id(struct perf_event *event, > + struct etm_event_data *event_data, > + struct coresight_path *path, > + struct coresight_device *sink) > +{ > + int cpu = smp_processor_id(); > + u64 hw_id; > + > + /* > + * output cpu / trace ID in perf record, once for the lifetime > + * of the event. > + */ > + if (!cpumask_test_cpu(cpu, &event_data->aux_hwid_done)) { > + hw_id = FIELD_PREP(CS_AUX_HW_ID_MAJOR_VERSION_MASK, > + CS_AUX_HW_ID_MAJOR_VERSION); > + hw_id |= FIELD_PREP(CS_AUX_HW_ID_MINOR_VERSION_MASK, > + CS_AUX_HW_ID_MINOR_VERSION); > + hw_id |= FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, path->trace_id); > + hw_id |= FIELD_PREP(CS_AUX_HW_ID_SINK_ID_MASK, coresight_get_sink_id(sink)); > + > + if (!perf_report_aux_output_id(event, hw_id)) > + cpumask_set_cpu(cpu, &event_data->aux_hwid_done); > + } > +} > + > static void etm_event_start(struct perf_event *event, int flags) > { > int cpu = smp_processor_id(); > @@ -544,7 +569,6 @@ static void etm_event_start(struct perf_event *event, int flags) > struct perf_output_handle *handle = &ctxt->handle; > struct coresight_device *source, *sink; > struct coresight_path *path; > - u64 hw_id; > > if (flags & PERF_EF_RESUME) { > path = etm_event_get_ctxt_path(ctxt); > @@ -596,22 +620,7 @@ static void etm_event_start(struct perf_event *event, int flags) > if (coresight_enable_source(source, event, CS_MODE_PERF, path)) > goto fail_disable_path; > > - /* > - * output cpu / trace ID in perf record, once for the lifetime > - * of the event. > - */ > - if (!cpumask_test_cpu(cpu, &event_data->aux_hwid_done)) { > - cpumask_set_cpu(cpu, &event_data->aux_hwid_done); > - > - hw_id = FIELD_PREP(CS_AUX_HW_ID_MAJOR_VERSION_MASK, > - CS_AUX_HW_ID_MAJOR_VERSION); > - hw_id |= FIELD_PREP(CS_AUX_HW_ID_MINOR_VERSION_MASK, > - CS_AUX_HW_ID_MINOR_VERSION); > - hw_id |= FIELD_PREP(CS_AUX_HW_ID_TRACE_ID_MASK, path->trace_id); > - hw_id |= FIELD_PREP(CS_AUX_HW_ID_SINK_ID_MASK, coresight_get_sink_id(sink)); > - > - perf_report_aux_output_id(event, hw_id); > - } > + etm_output_hw_id(event, event_data, path, sink); > > out: > /* Tell the perf core the event is alive */ > @@ -630,7 +639,7 @@ static void etm_event_start(struct perf_event *event, int flags) > */ > if (READ_ONCE(handle->event)) { > perf_aux_output_flag(handle, PERF_AUX_FLAG_TRUNCATED); > - perf_aux_output_end(handle, 0); > + perf_aux_output_end(path->handle, 0); Accidentally left this in from hacking. It doesn't do anything so I'll remove it.