[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b503a2aa-2f63-49f1-a7c5-c8c19cb5922f@linaro.org>
Date: Wed, 19 Nov 2025 15:15:39 +0000
From: James Clark <james.clark@...aro.org>
To: Leo Yan <leo.yan@....com>, Mike Leach <mike.leach@...aro.org>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jonathan Corbet <corbet@....net>, Randy Dunlap <rdunlap@...radead.org>,
coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH v5 08/13] coresight: Interpret perf config with
ATTR_CFG_GET_FLD()
On 19/11/2025 2:37 pm, Leo Yan wrote:
> On Wed, Nov 19, 2025 at 01:55:15PM +0000, James Clark wrote:
>
> [...]
>
>>> static ssize_t format_attr_contextid_show(struct device *dev,
>>> struct device_attribute *attr,
>>> char *page)
>>> {
>>> #if IS_ENABLED(CONFIG_ARM64)
>>> if (is_kernel_in_hyp_mode())
>>> return contextid2_show(dev, attr, page);
>>> #endif
>>>
>>> return contextid1_show(dev, attr, page);
>>
>> Not having an #else implies that the contextid1_show() part is valid when
>> !CONFIG_ARM64, but that isn't right. That's why I had the WARN_ON because
>> it's dead code.
>
> Based on ETMv3/v4 spec, would contextid1 always be valid ? (Though we do
> not support context ID for ETMv3 yet).
>
It's not currently supported for ETMv3 in perf mode, which is the
relevant thing here. So format_attr_contextid_show() never gets called
for ETMv3 (equivalent to !CONFIG_ARM64).
Based on the spec it may be supported, but that's a different discussion
and I doubt anyone wants it so it's unlikely to be added.
>> Personally I would drop the is_visible(). It makes sense for dynamically
>> hidden things, but these are all compile time. IMO it's cleaner to just not
>> include them to begin with, rather than include and then hide them. Then the
>> extra condition in format_attr_contextid_show() isn't needed because the
>> function doesn't exist:
>
> This is fine for me, though in general I think the dynamic approach is
> readable and extendable than the compile-time approach.
>
> Thanks,
> Leo
I agree in a perfect world, but it seems to have caused confusion and
wasn't that clean because is_kernel_in_hyp_mode() only exists for arm64.
I'll send a new version without it.
Powered by blists - more mailing lists