From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v4 15/17] x86/VPMU: NMI-based VPMU support Date: Tue, 04 Feb 2014 11:31:31 -0500 Message-ID: <52F115E3.3050109@oracle.com> References: <1390331342-3967-1-git-send-email-boris.ostrovsky@oracle.com> <1390331342-3967-16-git-send-email-boris.ostrovsky@oracle.com> <52F0E1BB0200007800118F8E@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52F0E1BB0200007800118F8E@nat28.tlf.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: keir@xen.org, suravee.suthikulpanit@amd.com, andrew.cooper3@citrix.com, eddie.dong@intel.com, dietmar.hahn@ts.fujitsu.com, xen-devel@lists.xen.org, jun.nakajima@intel.com List-Id: xen-devel@lists.xenproject.org On 02/04/2014 06:48 AM, Jan Beulich wrote: >>>> On 21.01.14 at 20:09, Boris Ostrovsky wrote: >> Add support for using NMIs as PMU interrupts. >> >> Most of processing is still performed by vpmu_do_interrupt(). However, since >> certain operations are not NMI-safe we defer them to a softint that >> vpmu_do_interrupt() >> will schedule: >> * For PV guests that would be send_guest_vcpu_virq() and >> hvm_get_segment_register(). > Makes no sense - why would hvm_get_segment_register() be of any > relevance to PV guests? Poorly written explanation. What I meant here is that if we are in privileged profiling mode and the interrupted guest is an HVM one then we'll need to get CS for that guest, not for the guest doing profiling (i.e. dom0). I'll rewrite this. > > And then I'm still missing a reasonable level of analysis that the > previously non-NMI-only interrupt handler is now safe to use in NMI > context. How about this? With send_guest_vcpu_virq() and hvm_get_segment_register() for PV(H) and vlapic accesses for HVM moved to sofint, the only routines/macros that vpmu_do_interrupt() calls in NMI mode are: * memcpy() * querying domain type (is_XX_domain()) * guest_cpu_user_regs() * XLAT_cpu_user_regs() * raise_softirq() * vcpu_vpmu() * vpmu_ops->arch_vpmu_save() * vpmu_ops->do_interrupt() (in the future for PVH support) The latter two can only access PMU MSRs. -boris