[PATCH] coresight: etm-perf: Add support for PID tracing for kernel at EL2

Suzuki K Poulose suzuki.poulose at arm.com
Sun Jan 10 17:34:57 EST 2021


On 1/10/21 1:41 AM, Leo Yan wrote:
> Hi Suzuki,
> 
> On Sun, Jan 10, 2021 at 01:24:30AM +0000, Suzuki Kuruppassery Poulose wrote:
> 
> [...]
> 
>> +static ssize_t format_attr_pid_show(struct device *dev,
>> +				    struct device_attribute *attr,
>> +				    char *page)
>> +{
>> +	int pid_fmt = ETM_OPT_CTXTID;
>> +
>> +#ifdef CONFIG_CORESIGHT_SOURCE_ETM4X
>> +	if (is_kernel_in_hyp_mode())
>> +		pid_fmt  = ETM_OPT_CTXTID_IN_VMID;
>> +#endif
> 
> I have a different idea for this.  As Armv8 Arm describes: "The
> Virtualization Host Extensions only apply to an implementation that
> includes EL2 using AArch64.", seems to me it's more reasable to use
> the condition "#ifdef CONFIG_64BIT", like below:
> 
> #ifdef CONFIG_64BIT
>          if (is_kernel_in_hyp_mode())
>                  pid_fmt  = ETM_OPT_CTXTID_IN_VMID;
> #endif
> 
> Please let me know if this is better or not.  I will resend the patch
> series after agreement.

I did think of that. But CORESIGHT_SOURCE_ETM4X already depends on CONFIG_ARM64.
So, that is more restrictive in terms of usage. And this wouldn't be the only
build failure if someone tried enable ETM4X for arm32. So I wouldn't worry about
someone trying to use ETM4X on arm32 accidentally.

Cheers
Suzuki



More information about the linux-arm-kernel mailing list