Re: [Patch v5 12/19] perf/x86: Enable eGPRs sampling using sample_regs_* fields

From: Mi, Dapeng
Date: Mon Dec 08 2025 - 01:11:53 EST



On 12/5/2025 8:16 PM, Peter Zijlstra wrote:
> On Wed, Dec 03, 2025 at 02:54:53PM +0800, Dapeng Mi wrote:
>> From: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>>
>> This patch enables sampling of APX eGPRs (R16 ~ R31) via the
>> sample_regs_* fields.
>>
>> To sample eGPRs, the sample_simd_regs_enabled field must be set. This
>> allows the spare space (reclaimed from the original XMM space) in the
>> sample_regs_* fields to be used for representing eGPRs.
>>
>> The perf_reg_value() function needs to check if the
>> PERF_SAMPLE_REGS_ABI_SIMD flag is set first, and then determine whether
>> to output eGPRs or legacy XMM registers to userspace.
>>
>> The perf_reg_validate() function is enhanced to validate the eGPRs bitmap
>> by adding a new argument, "simd_enabled".
>>
>> Currently, eGPRs sampling is only supported on the x86_64 architecture, as
>> APX is only available on x86_64 platforms.
>>
>> Suggested-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
>> Signed-off-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
>> Co-developed-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
>> Signed-off-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
>> ---
>> arch/arm/kernel/perf_regs.c | 2 +-
>> arch/arm64/kernel/perf_regs.c | 2 +-
>> arch/csky/kernel/perf_regs.c | 2 +-
>> arch/loongarch/kernel/perf_regs.c | 2 +-
>> arch/mips/kernel/perf_regs.c | 2 +-
>> arch/parisc/kernel/perf_regs.c | 2 +-
>> arch/powerpc/perf/perf_regs.c | 2 +-
>> arch/riscv/kernel/perf_regs.c | 2 +-
>> arch/s390/kernel/perf_regs.c | 2 +-
> Perhaps split out the part where you modify the arch function interface?

Sure.


>