From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v6 13/19] x86/VPMU: Handle PMU interrupts for PV guests Date: Thu, 22 May 2014 13:25:26 -0400 Message-ID: <537E3306.2020009@oracle.com> References: <1399996413-1998-1-git-send-email-boris.ostrovsky@oracle.com> <1399996413-1998-14-git-send-email-boris.ostrovsky@oracle.com> <537E344B02000078000150B2@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <537E344B02000078000150B2@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: kevin.tian@intel.com, keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, donald.d.dugger@intel.com, xen-devel@lists.xen.org, dietmar.hahn@ts.fujitsu.com, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org On 05/22/2014 11:30 AM, Jan Beulich wrote: > >> @@ -99,14 +120,87 @@ int vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content) >> return 0; >> >> if ( vpmu->arch_vpmu_ops && vpmu->arch_vpmu_ops->do_rdmsr ) >> - return vpmu->arch_vpmu_ops->do_rdmsr(msr, msr_content); >> + { >> + int ret = vpmu->arch_vpmu_ops->do_rdmsr(msr, msr_content); >> + >> + if ( !is_hvm_domain(current->domain) && >> + (current->arch.vpmu.xenpmu_data->pmu_flags & PMU_CACHED) ) > Wouldn't the same comment as in WRMSR handling apply here too? > If so, either replicate it or add a brief comment referring to the > other one. Yes, the comment is applicable here too and the next patch merges the two routines. >> + /* Store appropriate registers in xenpmu_data */ >> + if ( is_pv_32bit_domain(current->domain) ) >> + { >> + /* >> + * 32-bit dom0 cannot process Xen's addresses (which are 64 bit) >> + * and therefore we treat it the same way as a non-priviledged >> + * PV 32-bit domain. >> + */ >> + struct compat_cpu_user_regs *cmp; >> + >> + gregs = guest_cpu_user_regs(); >> + >> + cmp = (void *)&v->arch.vpmu.xenpmu_data->pmu.r.regs; >> + XLAT_cpu_user_regs(cmp, gregs); >> + memcpy(&v->arch.vpmu.xenpmu_data->pmu.r.regs, >> + &cmp, sizeof(struct compat_cpu_user_regs)); > Afaict this memcpy() does nothing (src == dst). Yes, memcpy is unnecessary here, copying is already done by the preceeding XLAT_cpu_user_reg(). -boris