|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 15/16] x86/VPMU: NMI-based VPMU support
>>> On 06.01.14 at 20:24, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> wrote:
> Add support for using NMIs as PMU interrupts
This needs significant extension, detailing how all the handling
involved is safe in NMI context.
> @@ -202,10 +227,14 @@ int vpmu_do_interrupt(struct cpu_user_regs *regs)
> struct segment_register cs;
>
> gregs = guest_cpu_user_regs();
> - hvm_get_segment_register(current, x86_seg_cs, &cs);
>
> memcpy(p, gregs, sizeof(struct cpu_user_regs));
> - ((struct cpu_user_regs *)p)->cs = cs.attr.fields.dpl;
> + /* This is unsafe in NMI context, we'll do it in softint handler
> */
> + if ( vpmu_apic_vector != APIC_DM_NMI )
Even if correct at present, I'd strongly suggest against != here (and
below), in favor of &.
> +/* Process the softirq set by PMU NMI handler */
> +static void pmu_softnmi(void)
> +{
> + struct cpu_user_regs *regs;
> + struct vcpu *v, *sampled = per_cpu(sampled_vcpu, smp_processor_id());
> +
> + if ( vpmu_mode & XENPMU_MODE_PRIV ||
> + sampled->domain->domain_id >= DOMID_FIRST_RESERVED )
> + v = dom0->vcpu[smp_processor_id()];
> + else
> + v = sampled;
> +
> + regs = &v->arch.vpmu.xenpmu_data->pmu.regs;
> + if ( is_hvm_domain(sampled->domain) )
> + {
> + struct segment_register cs;
> +
> + hvm_get_segment_register(sampled, x86_seg_cs, &cs);
> + regs->cs = cs.attr.fields.dpl;
> + }
> +
> + send_guest_vcpu_virq(v, VIRQ_XENPMU);
> +}
Perhaps I should have asked this on an earlier patch already:
How is this supposed to work for a 32-bit HVM guest?
struct cpu_user_regs is clearly different for it than what the
hypervisor or a 64-bit HVM guest would use.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |