From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: Re: [PATCH v9 17/20] x86/VPMU: Add privileged PMU mode Date: Tue, 12 Aug 2014 14:06:46 +0100 Message-ID: <53EA2D86020000780002BA0B@mail.emea.novell.com> References: <1407516946-17833-1-git-send-email-boris.ostrovsky@oracle.com> <1407516946-17833-18-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1407516946-17833-18-git-send-email-boris.ostrovsky@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: kevin.tian@intel.com, keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, tim@xen.org, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org >>> On 08.08.14 at 18:55, wrote: > @@ -192,32 +199,65 @@ int vpmu_do_interrupt(struct cpu_user_regs *regs) > vpmu->arch_vpmu_ops->arch_vpmu_save(sampling); > vpmu_reset(vpmu, VPMU_CONTEXT_SAVE | VPMU_CONTEXT_LOADED); > > - /* Store appropriate registers in xenpmu_data */ > - if ( is_pv_32bit_domain(sampled->domain) ) > + if ( !is_hvm_domain(sampled->domain) ) I agree with using "sampled" here. > { > - /* > - * 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 *)&vpmu->xenpmu_data->pmu.r.regs; > - XLAT_cpu_user_regs(cmp, gregs); > + /* Store appropriate registers in xenpmu_data */ > + if ( is_pv_32bit_domain(sampled->domain) ) But why is this not "sampling"? The layout of the data you present should depend on the consumer of the data > + { > + /* > + * 32-bit dom0 cannot process Xen's addresses (which are 64 bit) > + * and therefore we treat it the same way as a non-priviledged non-privileged > + * PV 32-bit domain. > + */ > + struct compat_cpu_user_regs *cmp; > + > + gregs = guest_cpu_user_regs(); > + > + cmp = (void *)&vpmu->xenpmu_data->pmu.r.regs; > + XLAT_cpu_user_regs(cmp, gregs); > + > + /* Adjust RPL for kernel mode */ > + if ((cmp->cs & 3) == 1) > + cmp->cs &= ~3; > + } Jan