[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9624b098-f3ab-4db7-8811-cab2c5cce351@intel.com>
Date: Fri, 13 Jun 2025 09:02:25 -0700
From: Dave Hansen <dave.hansen@...el.com>
To: kan.liang@...ux.intel.com, peterz@...radead.org, mingo@...hat.com,
acme@...nel.org, namhyung@...nel.org, tglx@...utronix.de,
dave.hansen@...ux.intel.com, irogers@...gle.com, adrian.hunter@...el.com,
jolsa@...nel.org, alexander.shishkin@...ux.intel.com,
linux-kernel@...r.kernel.org
Cc: dapeng1.mi@...ux.intel.com, ak@...ux.intel.com, zide.chen@...el.com
Subject: Re: [RFC PATCH 08/12] perf/x86: Add APX in extended regs
On 6/13/25 06:49, kan.liang@...ux.intel.com wrote:
> +#define __x86_pmu_get_regs(_mask, _regs, _size) \
> +do { \
> + if (mask & _mask && xcomp_bv & _mask) { \
> + _regs = xsave; \
> + xsave += _size; \
> + } \
> +} while (0)
Ewww.
First of all, this doesn't work generally because of the previously
mentioned alignment. Second, it's using xcomp_bv which doesn't tell you
if XSAVES wrote the data.
Last, this attempts to reimplement get_xsave_addr().
I'd do something like this:
for (xfeature_nr in mask) {
void *src = get_xsave_addr(xsave, xfeature_nr);
void *dst = ... a function to map XFEATURE_MASK_APX
to perf_regs->apx_regs,
int size = xstate_sizes(xfeature_nr);
if (!src)
continue;
memcpy(dst, src, size);
}
That should handle *all* of the nastiness. The alignment, the init
optimization. *Please* use get_xsave_addr() or one of the other helpers.
Powered by blists - more mailing lists