From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: [PATCH v2 2/3] x86/VPMU: Disable VPMU when NMI watchdog is on Date: Thu, 29 Jan 2015 12:58:38 -0500 Message-ID: <1422554319-1906-3-git-send-email-boris.ostrovsky@oracle.com> References: <1422554319-1906-1-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YGtZ8-0002de-TB for xen-devel@lists.xenproject.org; Thu, 29 Jan 2015 18:11:42 +0000 In-Reply-To: <1422554319-1906-1-git-send-email-boris.ostrovsky@oracle.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: JBeulich@suse.com, andrew.cooper3@citrix.com Cc: xen-devel@lists.xenproject.org, kevin.tian@intel.com, boris.ostrovsky@oracle.com, dietmar.hahn@ts.fujitsu.com List-Id: xen-devel@lists.xenproject.org NMI watchdog sets APIC_LVTPC register to generate an NMI when PMU counter overflow occurs. This may be overwritten by VPMU code later, effectively turning off the watchdog. We should disable VPMU when NMI watchdog is running. Signed-off-by: Boris Ostrovsky --- docs/misc/xen-command-line.markdown | 2 ++ xen/arch/x86/hvm/vpmu.c | 8 ++++++++ xen/arch/x86/nmi.c | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.markdown b/docs/misc/xen-command-line.markdown index 2274e74..bc316be 100644 --- a/docs/misc/xen-command-line.markdown +++ b/docs/misc/xen-command-line.markdown @@ -1346,6 +1346,8 @@ wrong behaviour (see handle\_pmc\_quirk()). If 'vpmu=bts' is specified the virtualisation of the Branch Trace Store (BTS) feature is switched on on Intel processors supporting this feature. +Note that if **watchdog** option is also specified vpmu will be turned off. + *Warning:* As the BTS virtualisation is not 100% safe and because of the nehalem quirk don't use the vpmu flag on production systems with Intel cpus! diff --git a/xen/arch/x86/hvm/vpmu.c b/xen/arch/x86/hvm/vpmu.c index 63b2158..68cb3f8 100644 --- a/xen/arch/x86/hvm/vpmu.c +++ b/xen/arch/x86/hvm/vpmu.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -219,6 +220,13 @@ void vpmu_initialise(struct vcpu *v) uint8_t vendor = current_cpu_data.x86_vendor; int ret; + /* NMI watchdog uses LVTPC and HW counter */ + if ( opt_watchdog && opt_vpmu_enabled ) + { + printk(XENLOG_G_WARNING "NMI watchdog is enabled. Turning VPMU off.\n"); + opt_vpmu_enabled = 0; + } + if ( is_pvh_vcpu(v) ) return; diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index 2ab97a0..9b8eb50 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -42,7 +42,7 @@ static DEFINE_PER_CPU(struct timer, nmi_timer); static DEFINE_PER_CPU(unsigned int, nmi_timer_ticks); /* opt_watchdog: If true, run a watchdog NMI on each processor. */ -bool_t __initdata opt_watchdog = 0; +bool_t __read_mostly opt_watchdog = 0; /* watchdog_force: If true, process unknown NMIs when running the watchdog. */ bool_t watchdog_force = 0; -- 1.8.1.4