From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v5 RESEND 12/17] x86/VPMU: Handle PMU interrupts for PV guests Date: Mon, 28 Apr 2014 10:15:08 -0400 Message-ID: <535E626C.3010700@oracle.com> References: <1398257438-4994-1-git-send-email-boris.ostrovsky@oracle.com> <1398257438-4994-13-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: "Tian, Kevin" Cc: "keir@xen.org" , "Nakajima, Jun" , "andrew.cooper3@citrix.com" , "Dong, Eddie" , "Dugger, Donald D" , "xen-devel@lists.xen.org" , "dietmar.hahn@ts.fujitsu.com" , "JBeulich@suse.com" , "suravee.suthikulpanit@amd.com" List-Id: xen-devel@lists.xenproject.org On 04/26/2014 04:33 AM, Tian, Kevin wrote: >> From: Boris Ostrovsky [mailto:boris.ostrovsky@oracle.com] >> 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 >> XENPMU_flush >> 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 >> --- >> 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. -boris > > Acked-by: Kevin Tian