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

Re: [Xen-devel] [PATCH v5 RESEND 12/17] x86/VPMU: Handle PMU interrupts for PV guests

On 04/26/2014 04:33 AM, Tian, Kevin wrote:
From: Boris Ostrovsky [mailto:boris.ostrovsky@xxxxxxxxxx]
Sent: Wednesday, April 23, 2014 8:51 PM

Add support for handling PMU interrupts for PV guests.

VPMU for the interrupted VCPU is unloaded until the guest issues
hypercall. This allows the guest to access PMU MSR values that are stored in
VPMU context which is shared between hypervisor and domain, thus avoiding
traps to hypervisor.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
  xen/arch/x86/hvm/vpmu.c  | 110
  xen/include/public/pmu.h |   7 +++
  2 files changed, 112 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c
index 789eb2a..abc4c1f 100644
--- a/xen/arch/x86/hvm/vpmu.c
+++ b/xen/arch/x86/hvm/vpmu.c
  int vpmu_do_interrupt(struct cpu_user_regs *regs)
      struct vcpu *v = current;
-    struct vpmu_struct *vpmu = vcpu_vpmu(v);
+    struct vpmu_struct *vpmu;
+    /* dom0 will handle this interrupt */
+    if ( v->domain->domain_id >= DOMID_FIRST_RESERVED )
+        v = dom0->vcpu[smp_processor_id() % dom0->max_vcpus];
+    vpmu = vcpu_vpmu(v);
+    if ( !is_hvm_domain(v->domain) )
+    {
+        /* PV guest or dom0 is doing system profiling */
+        const struct cpu_user_regs *gregs;
+        int err;
a bit misleading. if non-dom0, it should be guest profiling only, right?

Right. I meant that either a regular PV guest profiling itself or dom0 profiling itself and the hypervisor. I possibly also meant here XENPMU_MODE_PRIV mode (where dom0 profiles everyone --- itself, hypervisor and all guests) but that it introduced in a later patch and shouldn't be here yet)

I'll re-phrase it.


Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx>

Xen-devel mailing list



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