lkml.org 
[lkml]   [2022]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/4] perf tools: arm64: Add support for VG register
On Wed, May 18, 2022 at 10:44:57AM +0100, James Clark wrote:

[...]

> >> + if (getauxval(AT_HWCAP) & HWCAP_SVE)
> >> + attr.sample_regs_user |= SMPL_REG_MASK(PERF_REG_ARM64_VG);
> >> +
> >> + /*
> >> + * Check if the pmu supports perf extended regs, before
> >> + * returning the register mask to sample.
> >> + */
> >> + if (attr.sample_regs_user != PERF_REGS_MASK) {
> >> + event_attr_init(&attr);
> >> + fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
> >> + if (fd != -1) {
> >> + close(fd);
> >> + return attr.sample_regs_user;
> >> + }
> >> + }
> >
> > Just curious, since we can know SVE is supported from reading
> > auxiliary value, can we directly return the register mask as below?
> >
> > PERF_REGS_MASK | SMPL_REG_MASK(PERF_REG_ARM64_VG);
>
> I was trying to cover the case where the system supports SVE, but
> the kernel doesn't have my changes to add the VG register yet.
>
> Technically I could just attempt to open the event without checking
> for SVE first and see if it works or not. But I preferred to be
> explicit so it's obvious why we're doing that.

Understand; LGTM.

Reviewed-by: Leo Yan <leo.yan@linaro.org>

\
 
 \ /
  Last update: 2022-05-18 12:00    [W:1.865 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site