Re: [PATCH 01/22] perf/core: Support outputting registers from a separate array

From: Peter Zijlstra
Date: Tue Mar 19 2019 - 10:13:24 EST


On Tue, Mar 19, 2019 at 02:00:04PM +0100, Peter Zijlstra wrote:
> On Mon, Mar 18, 2019 at 02:41:23PM -0700, kan.liang@xxxxxxxxxxxxxxx wrote:

> > @@ -6274,6 +6275,7 @@ void perf_output_sample(struct perf_output_handle *handle,
> > u64 mask = event->attr.sample_regs_user;
> > perf_output_sample_regs(handle,
> > data->regs_user.regs,
> > + NULL,
> > mask);
> > }
> > }
> > @@ -6306,6 +6308,7 @@ void perf_output_sample(struct perf_output_handle *handle,
> >
> > perf_output_sample_regs(handle,
> > data->regs_intr.regs,
> > + data->extra_regs,
> > mask);
> > }
> > }
>
> See, I think most of this is completely unnessecary. Both sites pass:
> &perf_regs::regs to perf_output_sample_regs()<-perf_reg_value().
>
> So all you need to do is add the XMM crud to perf_regs, and use
> container_of() on the pt_regs pointer in perf_reg_value() to get back to
> perf_regs and voila, XMM registers.

Ah, that's not quite true, but I still think you can make something like
that work.