[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH v1 04/10] vpmu.c: factor out register conversion



On Mon, Jul 28, 2025 at 11:25 AM Andrew Cooper
<andrew.cooper3@xxxxxxxxxx> wrote:
>
> On 25/07/2025 4:06 pm, Edwin Török wrote:
> > diff --git a/xen/arch/x86/cpu/vpmu.c b/xen/arch/x86/cpu/vpmu.c
> > index 7be79c2d00..713311a1ac 100644
> > --- a/xen/arch/x86/cpu/vpmu.c
> > +++ b/xen/arch/x86/cpu/vpmu.c
> > @@ -160,6 +160,31 @@ static inline struct vcpu *choose_hwdom_vcpu(void)
> >      return hardware_domain->vcpu[idx];
> >  }
> >
> > +static inline void vpmu_convert_regs(struct xen_pmu_regs *r, uint64_t 
> > *flags,
> > +                                     struct vcpu *sampled,
> > +                                     const struct cpu_user_regs *cur_regs) 
> > {
> > +  r->ip = cur_regs->rip;
> > +  r->sp = cur_regs->rsp;
> > +  r->flags = cur_regs->rflags;
> > +
> > +  if (!is_hvm_vcpu(sampled)) {
> > +    r->ss = cur_regs->ss;
> > +    r->cs = cur_regs->cs;
> > +    if (!(sampled->arch.flags & TF_kernel_mode))
> > +      *flags |= PMU_SAMPLE_USER;
> > +  } else {
> > +    struct segment_register seg;
> > +
> > +    hvm_get_segment_register(sampled, x86_seg_cs, &seg);
> > +    r->cs = seg.sel;
> > +    hvm_get_segment_register(sampled, x86_seg_ss, &seg);
> > +    r->ss = seg.sel;
> > +    r->cpl = seg.dpl;
> > +    if (!(sampled->arch.hvm.guest_cr[0] & X86_CR0_PE))
> > +      *flags |= PMU_SAMPLE_REAL;
> > +  }
> > +}
> > +
>
> This is fine in principle, except that you're changing the style away
> from Xen style.

Ah looks like we lack a .clang-format file, so `gq` reformatted the
code with Clang's default settings.
I'll avoid using `gq` for now, and have redone the commit using '<' instead.

>
> I can fix it on commit, but it's going to collide massively later in the
> series.

I've pushed a WiP branch which contains this change, and fixed the
rebase conflicts in the followup patches:
https://gitlab.com/xen-project/people/edwintorok/xen/-/commits/pmustack-next?ref_type=heads

Best regards,
--Edwin
>
> ~Andrew



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.