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. I can fix it on commit, but it's going to collide massively later in the series. ~Andrew