From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v5 RESEND 15/17] x86/VPMU: NMI-based VPMU support Date: Mon, 28 Apr 2014 13:06:11 -0400 Message-ID: <535E8A83.7010405@oracle.com> References: <1398257438-4994-1-git-send-email-boris.ostrovsky@oracle.com> <1398257438-4994-16-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:48 AM, Tian, Kevin wrote: >> From: Boris Ostrovsky [mailto:boris.ostrovsky@oracle.com] >> Sent: Wednesday, April 23, 2014 8:51 PM >> >> 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() >> * For HVM guests it's VLAPIC accesses and hvm_get_segment_register() (the >> later >> can be called in privileged profiling mode when the interrupted guest is an >> HVM one). >> >> 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 only access PMU MSRs with {rd,wr}msrl() (not the _safe >> versions >> which would not be NMI-safe). >> >> Signed-off-by: Boris Ostrovsky > if a SCHEDULE_SOFTIRQ happens before NMI_SOFTIRQ, will it cause any race > condition when accessing previous recorded content in nmi softirq handler? I think you are right. I in fact had an earlier version where I'd put the record into a linked list but when I later looked at that code again I took it out because I thought it was unnecessary. But now that you mentioned it I may need to resurrect that code. Let me think about this again. -boris