All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org, "Ingo Molnar" <mingo@kernel.org>,
	"Don Zickus" <dzickus@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"HATAYAMA Daisuke" <d.hatayama@jp.fujitsu.com>,
	"Arnaldo Carvalho de Melo" <acme@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: [PATCH 3.2 19/94] perf/x86/intel: ignore CondChgd bit to avoid false NMI handling
Date: Mon, 04 Aug 2014 17:48:31 +0100	[thread overview]
Message-ID: <lsq.1407170911.861687531@decadent.org.uk> (raw)
In-Reply-To: <lsq.1407170911.107020799@decadent.org.uk>

3.2.62-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>

commit b292d7a10487aee6e74b1c18b8d95b92f40d4a4f upstream.

Currently, any NMI is falsely handled by a NMI handler of NMI watchdog
if CondChgd bit in MSR_CORE_PERF_GLOBAL_STATUS MSR is set.

For example, we use external NMI to make system panic to get crash
dump, but in this case, the external NMI is falsely handled do to the
issue.

This commit deals with the issue simply by ignoring CondChgd bit.

Here is explanation in detail.

On x86 NMI watchdog uses performance monitoring feature to
periodically signal NMI each time performance counter gets overflowed.

intel_pmu_handle_irq() is called as a NMI_LOCAL handler from a NMI
handler of NMI watchdog, perf_event_nmi_handler(). It identifies an
owner of a given NMI by looking at overflow status bits in
MSR_CORE_PERF_GLOBAL_STATUS MSR. If some of the bits are set, then it
handles the given NMI as its own NMI.

The problem is that the intel_pmu_handle_irq() doesn't distinguish
CondChgd bit from other bits. Unlike the other status bits, CondChgd
bit doesn't represent overflow status for performance counters. Thus,
CondChgd bit cannot be thought of as a mark indicating a given NMI is
NMI watchdog's.

As a result, if CondChgd bit is set, any NMI is falsely handled by the
NMI handler of NMI watchdog. Also, if type of the falsely handled NMI
is either NMI_UNKNOWN, NMI_SERR or NMI_IO_CHECK, the corresponding
action is never performed until CondChgd bit is cleared.

I noticed this behavior on systems with Ivy Bridge processors: Intel
Xeon CPU E5-2630 v2 and Intel Xeon CPU E7-8890 v2. On both systems,
CondChgd bit in MSR_CORE_PERF_GLOBAL_STATUS MSR has already been set
in the beginning at boot. Then the CondChgd bit is immediately cleared
by next wrmsr to MSR_CORE_PERF_GLOBAL_CTRL MSR and appears to remain
0.

On the other hand, on older processors such as Nehalem, Xeon E7540,
CondChgd bit is not set in the beginning at boot.

I'm not sure about exact behavior of CondChgd bit, in particular when
this bit is set. Although I read Intel System Programmer's Manual to
figure out that, the descriptions I found are:

  In 18.9.1:

  "The MSR_PERF_GLOBAL_STATUS MSR also provides a ¡sticky bit¢ to
   indicate changes to the state of performancmonitoring hardware"

  In Table 35-2 IA-32 Architectural MSRs

  63 CondChg: status bits of this register has changed.

These are different from the bahviour I see on the actual system as I
explained above.

At least, I think ignoring CondChgd bit should be enough for NMI
watchdog perspective.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20140625.103503.409316067.d.hatayama@jp.fujitsu.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/x86/kernel/cpu/perf_event_intel.c | 9 +++++++++
 1 file changed, 9 insertions(+)

--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1048,6 +1048,15 @@ again:
 	intel_pmu_lbr_read();
 
 	/*
+	 * CondChgd bit 63 doesn't mean any overflow status. Ignore
+	 * and clear the bit.
+	 */
+	if (__test_and_clear_bit(63, (unsigned long *)&status)) {
+		if (!status)
+			goto done;
+	}
+
+	/*
 	 * PEBS overflow sets bit 62 in the global status register
 	 */
 	if (__test_and_clear_bit(62, (unsigned long *)&status)) {


  parent reply	other threads:[~2014-08-04 16:50 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 16:48 [PATCH 3.2 00/94] 3.2.62-rc1 review Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 07/94] USB: ftdi_sio: fix null deref at port probe Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 01/94] Revert "net: ipv4: ip_forward: fix inverted local_df test" Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 16/94] nfsd: fix rare symlink decoding bug Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 13/94] ibmvscsi: Add memory barriers for send / receive Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 18/94] usb-storage/SCSI: Add broken_fua blacklist flag Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 09/94] xhci: correct burst count field for isoc transfers on 1.0 xhci hosts Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 22/94] iwlwifi: dvm: don't enable CTS to self Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 10/94] xhci: clear root port wake on bits if controller isn't wake-up capable Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 24/94] hwmon: (amc6821) Fix permissions for temp2_input Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 14/94] cpuset,mempolicy: fix sleeping function called from invalid context Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 17/94] tools: ffs-test: fix header values endianess Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 02/94] Revert "net: ip, ipv6: handle gso skbs in forwarding path" Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 21/94] xen/manage: fix potential deadlock when resuming the console Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 11/94] xhci: Fix runtime suspended xhci from blocking system suspend Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 08/94] usb: option: add/modify Olivetti Olicard modems Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 25/94] hwmon: (adm1029) Ensure the fan_div cache is updated in set_fan_div Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 15/94] mwifiex: fix Tx timeout issue Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 06/94] usb: gadget: f_fs: fix NULL pointer dereference when there are no strings Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 04/94] KVM: x86: Increase the number of fixed MTRR regs to 10 Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 05/94] KVM: x86: preserve the high 32-bits of the PAT register Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 12/94] ibmvscsi: Abort init sequence during error recovery Ben Hutchings
2014-08-04 16:48 ` Ben Hutchings [this message]
2014-08-04 16:48 ` [PATCH 3.2 26/94] ext4: clarify error count warning messages Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 23/94] drm/vmwgfx: Fix incorrect write to read-only register v2: Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 03/94] ARM: OMAP2+: Fix parser-bug in platform muxing code Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 20/94] md: flush writes before starting a recovery Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 80/94] applicom: dereferencing NULL on error path Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 61/94] dns_resolver: assure that dns_query() result is null-terminated Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 88/94] ceph: fix overflow check in build_snap_context() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 27/94] ext4: disable synchronous transaction batching if max_batch_time==0 Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 78/94] score: normalize global variables exported by vmlinux.lds Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 49/94] include/linux/math64.h: add div64_ul() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 68/94] xfs: fix allocbt cursor leak in xfs_alloc_ag_vextent_near Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 54/94] usb: Check if port status is equal to RxDetect Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 30/94] ACPI / EC: Add more debug info and trivial code cleanup Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 45/94] dm io: fix a race condition in the wake up code for sync_io Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 63/94] ipv4: fix buffer overflow in ip_options_compile() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 42/94] alarmtimer: Fix bug where relative alarm timers were treated as absolute Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 53/94] drm/radeon: avoid leaking edid data Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 91/94] libata: support the ata host which implements a queue depth less than 32 Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 39/94] fuse: timeout comparison fix Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 73/94] unicore32: add ioremap_nocache definition Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 75/94] Score: The commit is for compiling successfully. The modifications include: 1. Kconfig of Score: we don't support ioremap 2. Missed headfile including 3. There are some errors in other people's commit not checked by us, we fix it now 3.1 arch/score/kernel/entry.S: wrong instructions 3.2 arch/score/kernel/process.c : just some typos Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 71/94] shmem: fix faulting into a hole, not taking i_mutex Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 35/94] ACPI / EC: Remove duplicated ec_wait_ibf0() waiter Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 87/94] ARM: 7670/1: fix the memset fix Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 60/94] sunvnet: clean up objects created in vnet_new() on vnet_exit() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 46/94] drm/radeon/dp: return -EIO for flags not zero case Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 93/94] x86_32, entry: Store badsys error code in %eax Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 83/94] ipvs: stop tot_stats estimator only under CONFIG_SYSCTL Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 43/94] USB: ftdi_sio: Add extra PID Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 32/94] ACPI / EC: Avoid race condition related to advance_transaction() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 31/94] ACPI / EC: Ensure lock is acquired before accessing ec struct members Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 37/94] ACPI / battery: Retry to get battery information if failed during probing Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 86/94] ARM: 7668/1: fix memset-related crashes caused by recent GCC (4.7.2) optimizations Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 62/94] dns_resolver: Null-terminate the right string Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 84/94] crypto: testmgr - update LZO compression test vectors Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 94/94] iommu/vt-d: Disable translation if already enabled Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 65/94] nohz: Fix another inconsistency between CONFIG_NO_HZ=n and nohz=off Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 92/94] libata: introduce ata_host->n_tags to avoid oops on SAS controllers Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 47/94] net/l2tp: don't fall back on UDP [get|set]sockopt Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 55/94] tcp: fix tcp_match_skb_to_sack() for unaligned SACK at end of an skb Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 29/94] usb: option: Add ID for Telewell TW-LTE 4G v2 Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 34/94] ACPI / EC: Add asynchronous command byte write support Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 79/94] x86-32, espfix: Remove filter for espfix32 due to race Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 44/94] igb: do a reset on SR-IOV re-init if device is down Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 56/94] 8021q: fix a potential memory leak Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 72/94] shmem: fix splicing from a hole while it's punched Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 69/94] xfs: really fix the cursor leak in xfs_alloc_ag_vextent_near Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 89/94] introduce SIZE_MAX Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 40/94] fuse: handle large user and group ID Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 76/94] score: Add missing #include <linux/export.h> Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 59/94] net: sctp: fix information leaks in ulpevent layer Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 66/94] s390/ptrace: fix PSW mask check Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 51/94] locking/mutex: Disable optimistic spinning on some architectures Ben Hutchings
2014-08-04 16:48   ` Ben Hutchings
2014-08-04 16:48   ` Ben Hutchings
2014-08-04 16:48   ` Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 52/94] hwmon: (adt7470) Fix writes to temperature limit registers Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 58/94] appletalk: Fix socket referencing in skb Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 82/94] x86, ioremap: Speed up check for RAM pages Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 57/94] igmp: fix the problem when mc leave group Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 36/94] ACPI / EC: Fix race condition in ec_transaction_completed() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 28/94] USB: cp210x: add support for Corsair usb dongle Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 41/94] hwmon: (emc2103) Clamp limits instead of bailing out Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 90/94] mm: kmemleak: avoid false negatives on vmalloc'ed objects Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 81/94] sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 50/94] sched: Fix possible divide by zero in avg_atom() calculation Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 38/94] hwmon: (adm1031) Fix writes to limit registers Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 64/94] rtnetlink: fix userspace API breakage for iproute2 < v3.9.0 Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 77/94] alpha: add io{read,write}{16,32}be functions Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 67/94] netfilter: ipt_ULOG: fix info leaks Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 85/94] mm: hugetlb: fix copy_hugetlb_page_range() Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 48/94] ring-buffer: Fix polling on trace_pipe Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 70/94] shmem: fix faulting into a hole while it's punched Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 33/94] ACPI / EC: Don't count a SCI interrupt as a false one Ben Hutchings
2014-08-04 16:48 ` [PATCH 3.2 74/94] unicore32: select generic atomic64_t support Ben Hutchings
2014-08-04 17:21 ` [PATCH 3.2 00/94] 3.2.62-rc1 review Ben Hutchings
2014-08-04 17:55 ` Guenter Roeck
2014-08-04 19:49   ` Ben Hutchings
2014-08-04 20:45     ` Guenter Roeck
2014-09-11  1:28       ` Ben Hutchings
2014-08-06 13:25   ` Satoru Takeuchi
2014-08-06 17:06     ` Ben Hutchings

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lsq.1407170911.861687531@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=dzickus@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.