From: "Jan Beulich" Subject: Re: [PATCH v2] x86/NMI: Allow processing unknown NMIs when watchdog is enabled Date: Thu, 28 Aug 2014 08:40:32 +0100 Message-ID: <53FEF910020000780002E7D3@mail.emea.novell.com> References: <1409152315-16759-1-git-send-email-ross.lagerwall@citrix.com>, <53FE16F5020000780002E2CA@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: 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: Ross Lagerwall Cc: "Keir (Xen.org)" , Xen-devel List-Id: xen-devel@lists.xenproject.org >>> On 27.08.14 at 18:45, wrote: > ________________________________________ > From: Jan Beulich [JBeulich@suse.com] > Sent: Wednesday, August 27, 2014 4:35 PM > To: Ross Lagerwall > Cc: Xen-devel; Keir (Xen.org) > Subject: Re: [PATCH v2] x86/NMI: Allow processing unknown NMIs when watchdog > is enabled > >>>>> On 27.08.14 at 17:11, wrote: >>> @@ -473,14 +496,26 @@ void nmi_watchdog_tick(const struct cpu_user_regs > *regs) >>> } >>> else if ( nmi_perfctr_msr == MSR_P6_PERFCTR0 ) >>> { >>> + rdmsrl(MSR_P6_PERFCTR0, msr_content); >>> + if ( msr_content & (1ULL << P6_EVENT_WIDTH) ) >>> + watchdog_tick = 0; >>> + >>> /* >>> * Only P6 based Pentium M need to re-unmask the apic vector but >>> * it doesn't hurt other P6 variants. >>> */ >>> apic_write(APIC_LVTPC, APIC_DM_NMI); >>> } >>> + else if ( nmi_perfctr_msr == MSR_K7_PERFCTR0 ) >>> + { >>> + rdmsrl(MSR_K7_PERFCTR0, msr_content); >>> + if ( msr_content & (1ULL << K7_EVENT_WIDTH) ) >>> + watchdog_tick = 0; >>> + } >> >>Looking at the top counter bits is rather weak a check, but I guess >>there's nothing better (and considering a few more of the top >>bits would only shrink the window of mis-detection, not eliminate >>it)... >> > > Well the counter counts down from some large negative number to zero. It is > sign-extended beyond *_EVENT_WIDTH, so I don't think checking (one of) the > sign > bits to confirm whether it has overflowed is that bad. Oh, indeed, I forgot that this gets programmed with a large initial value (as, being a performance counter, counts upwards). Indeed, that renders the above pretty reliable. Jan