All of lore.kernel.org
 help / color / mirror / Atom feed
* [4.10,20/24] x86/mce: Make the MCE notifier a blocking one
  2017-04-25 15:09 [PATCH 4.10 00/24] 4.10.13-stable review Greg Kroah-Hartman
@ 2017-04-25 15:09 ` Greg Kroah-Hartman
  2017-04-25 15:09 ` [PATCH 4.10 02/24] KEYS: Change the name of the dead type to ".dead" to prevent user access Greg Kroah-Hartman
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 28+ messages in thread
From: Greg Kroah-Hartman @ 2017-04-25 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Ross Zwisler, Vishal Verma, Tony Luck,
	Dan Williams, linux-edac, x86-ml, Borislav Petkov,
	Thomas Gleixner

4.10-stable review patch.  If anyone has any objections, please let me know.

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

From: Vishal Verma <vishal.l.verma@intel.com>

commit 0dc9c639e6553e39c13b2c0d54c8a1b098cb95e2 upstream.

The NFIT MCE handler callback (for handling media errors on NVDIMMs)
takes a mutex to add the location of a memory error to a list. But since
the notifier call chain for machine checks (x86_mce_decoder_chain) is
atomic, we get a lockdep splat like:

  BUG: sleeping function called from invalid context at kernel/locking/mutex.c:620
  in_atomic(): 1, irqs_disabled(): 0, pid: 4, name: kworker/0:0
  [..]
  Call Trace:
   dump_stack
   ___might_sleep
   __might_sleep
   mutex_lock_nested
   ? __lock_acquire
   nfit_handle_mce
   notifier_call_chain
   atomic_notifier_call_chain
   ? atomic_notifier_call_chain
   mce_gen_pool_process

Convert the notifier to a blocking one which gets to run only in process
context.

Boris: remove the notifier call in atomic context in print_mce(). For
now, let's print the MCE on the atomic path so that we can make sure
they go out and get logged at least.

Fixes: 6839a6d96f4e ("nfit: do an ARS scrub on hitting a latent media error")
Reported-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Cc: x86-ml <x86@kernel.org>
Link: http://lkml.kernel.org/r/20170411224457.24777-1-vishal.l.verma@intel.com
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/x86/kernel/cpu/mcheck/mce-genpool.c  |    2 +-
 arch/x86/kernel/cpu/mcheck/mce-internal.h |    2 +-
 arch/x86/kernel/cpu/mcheck/mce.c          |   17 +++--------------
 3 files changed, 5 insertions(+), 16 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-edac" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--- a/arch/x86/kernel/cpu/mcheck/mce-genpool.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-genpool.c
@@ -85,7 +85,7 @@ void mce_gen_pool_process(void)
 	head = llist_reverse_order(head);
 	llist_for_each_entry_safe(node, tmp, head, llnode) {
 		mce = &node->mce;
-		atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
+		blocking_notifier_call_chain(&x86_mce_decoder_chain, 0, mce);
 		gen_pool_free(mce_evt_pool, (unsigned long)node, sizeof(*node));
 	}
 }
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -13,7 +13,7 @@ enum severity_level {
 	MCE_PANIC_SEVERITY,
 };
 
-extern struct atomic_notifier_head x86_mce_decoder_chain;
+extern struct blocking_notifier_head x86_mce_decoder_chain;
 
 #define ATTR_LEN		16
 #define INITIAL_CHECK_INTERVAL	5 * 60 /* 5 minutes */
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -123,7 +123,7 @@ static void (*quirk_no_way_out)(int bank
  * CPU/chipset specific EDAC code can register a notifier call here to print
  * MCE errors in a human-readable form.
  */
-ATOMIC_NOTIFIER_HEAD(x86_mce_decoder_chain);
+BLOCKING_NOTIFIER_HEAD(x86_mce_decoder_chain);
 
 /* Do initial initialization of a struct mce */
 void mce_setup(struct mce *m)
@@ -223,7 +223,7 @@ void mce_register_decode_chain(struct no
 	if (nb != &mce_srao_nb && nb->priority == INT_MAX)
 		nb->priority -= 1;
 
-	atomic_notifier_chain_register(&x86_mce_decoder_chain, nb);
+	blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
 }
 EXPORT_SYMBOL_GPL(mce_register_decode_chain);
 
@@ -231,7 +231,7 @@ void mce_unregister_decode_chain(struct
 {
 	atomic_dec(&num_notifiers);
 
-	atomic_notifier_chain_unregister(&x86_mce_decoder_chain, nb);
+	blocking_notifier_chain_unregister(&x86_mce_decoder_chain, nb);
 }
 EXPORT_SYMBOL_GPL(mce_unregister_decode_chain);
 
@@ -324,18 +324,7 @@ static void __print_mce(struct mce *m)
 
 static void print_mce(struct mce *m)
 {
-	int ret = 0;
-
 	__print_mce(m);
-
-	/*
-	 * Print out human-readable details about the MCE error,
-	 * (if the CPU has an implementation for that)
-	 */
-	ret = atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m);
-	if (ret == NOTIFY_STOP)
-		return;
-
 	pr_emerg_ratelimited(HW_ERR "Run the above through 'mcelog --ascii'\n");
 }
 

^ permalink raw reply	[flat|nested] 28+ messages in thread
* [PATCH 4.10 00/24] 4.10.13-stable review
@ 2017-04-25 15:09 Greg Kroah-Hartman
  2017-04-25 15:09 ` [PATCH 4.10 01/24] KEYS: Disallow keyrings beginning with . to be joined as session keyrings Greg Kroah-Hartman
                   ` (24 more replies)
  0 siblings, 25 replies; 28+ messages in thread
From: Greg Kroah-Hartman @ 2017-04-25 15:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuahkh, patches,
	ben.hutchings, stable

This is the start of the stable review cycle for the 4.10.13 release.
There are 24 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Thu Apr 27 15:08:24 UTC 2017.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.10.13-rc1.gz
or in the git tree and branch at:
  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.10.y
and the diffstat can be found below.

thanks,

greg k-h

-------------
Pseudo-Shortlog of commits:

Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Linux 4.10.13-rc1

Dan Williams <dan.j.williams@intel.com>
    device-dax: switch to srcu, fix rcu_read_lock() vs pte allocation

Yazen Ghannam <yazen.ghannam@amd.com>
    x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs

Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
    powerpc/kprobe: Fix oops when kprobed on 'stdu' instruction

Sebastian Siewior <bigeasy@linutronix.de>
    ubi/upd: Always flush after prepared for an update

Vishal Verma <vishal.l.verma@intel.com>
    x86/mce: Make the MCE notifier a blocking one

Johannes Berg <johannes.berg@intel.com>
    mac80211: fix MU-MIMO follow-MAC mode

Johannes Berg <johannes.berg@intel.com>
    mac80211: reject ToDS broadcast data frames

Richard Weinberger <richard@nod.at>
    ubifs: Fix O_TMPFILE corner case in ubifs_link()

Felix Fietkau <nbd@nbd.name>
    ubifs: Fix RENAME_WHITEOUT support

Haibo Chen <haibo.chen@nxp.com>
    mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for DDR50 card

Douglas Anderson <dianders@chromium.org>
    mmc: dw_mmc: Don't allow Runtime PM for SDIO cards

Arnd Bergmann <arnd@arndb.de>
    ACPI / power: Avoid maybe-uninitialized warning

Thorsten Leemhuis <linux@leemhuis.info>
    Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled

Christian Borntraeger <borntraeger@de.ibm.com>
    s390/mm: fix CMMA vs KSM vs others

Shawn Lin <shawn.lin@rock-chips.com>
    mmc: dw_mmc: silent verbose log when calling from PM context

Germano Percossi <germano.percossi@citrix.com>
    CIFS: remove bad_network_name flag

Sachin Prabhu <sprabhu@redhat.com>
    cifs: Do not send echoes before Negotiate is complete

Rabin Vincent <rabinv@axis.com>
    mm: prevent NR_ISOLATE_* stats from going negative

Steven Rostedt (VMware) <rostedt@goodmis.org>
    ring-buffer: Have ring_buffer_iter_empty() return true when empty

Jason Gerecke <killertofu@gmail.com>
    HID: wacom: Treat HID_DG_TOOLSERIALNUMBER as unsigned

Steven Rostedt (VMware) <rostedt@goodmis.org>
    tracing: Allocate the snapshot buffer before enabling probe

Eric Biggers <ebiggers@google.com>
    KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings

David Howells <dhowells@redhat.com>
    KEYS: Change the name of the dead type to ".dead" to prevent user access

David Howells <dhowells@redhat.com>
    KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings


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

Diffstat:

 Makefile                                  |  4 +-
 arch/powerpc/kernel/entry_64.S            |  6 +--
 arch/s390/include/asm/pgtable.h           |  2 +
 arch/x86/kernel/cpu/mcheck/mce-genpool.c  |  2 +-
 arch/x86/kernel/cpu/mcheck/mce-internal.h |  2 +-
 arch/x86/kernel/cpu/mcheck/mce.c          | 17 ++----
 arch/x86/kernel/cpu/mcheck/mce_amd.c      |  2 +-
 drivers/acpi/power.c                      |  1 +
 drivers/dax/Kconfig                       |  1 +
 drivers/dax/dax.c                         | 13 ++---
 drivers/hid/wacom_wac.c                   |  2 +-
 drivers/input/mouse/elantech.c            |  8 +++
 drivers/mmc/host/dw_mmc.c                 | 23 ++++++---
 drivers/mmc/host/sdhci-esdhc-imx.c        |  1 +
 drivers/mtd/ubi/upd.c                     |  8 +--
 fs/cifs/cifsglob.h                        |  1 -
 fs/cifs/smb1ops.c                         | 10 ++++
 fs/cifs/smb2pdu.c                         |  5 --
 fs/ubifs/dir.c                            | 10 ++--
 kernel/trace/ring_buffer.c                | 16 +++++-
 kernel/trace/trace.c                      |  8 +--
 mm/migrate.c                              |  2 +-
 net/mac80211/rx.c                         | 86 ++++++++++++++++++++++++-------
 security/keys/gc.c                        |  2 +-
 security/keys/keyctl.c                    | 20 +++----
 security/keys/process_keys.c              | 44 ++++++++++------
 26 files changed, 196 insertions(+), 100 deletions(-)

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2017-04-26  2:23 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-25 15:09 [4.10,20/24] x86/mce: Make the MCE notifier a blocking one Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 20/24] " Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2017-04-25 15:09 [PATCH 4.10 00/24] 4.10.13-stable review Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 01/24] KEYS: Disallow keyrings beginning with . to be joined as session keyrings Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 02/24] KEYS: Change the name of the dead type to ".dead" to prevent user access Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 03/24] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 04/24] tracing: Allocate the snapshot buffer before enabling probe Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 05/24] HID: wacom: Treat HID_DG_TOOLSERIALNUMBER as unsigned Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 06/24] ring-buffer: Have ring_buffer_iter_empty() return true when empty Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 07/24] mm: prevent NR_ISOLATE_* stats from going negative Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 08/24] cifs: Do not send echoes before Negotiate is complete Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 09/24] CIFS: remove bad_network_name flag Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 10/24] mmc: dw_mmc: silent verbose log when calling from PM context Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 11/24] s390/mm: fix CMMA vs KSM vs others Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 12/24] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 13/24] ACPI / power: Avoid maybe-uninitialized warning Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 14/24] mmc: dw_mmc: Dont allow Runtime PM for SDIO cards Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 15/24] mmc: sdhci-esdhc-imx: increase the pad I/O drive strength for DDR50 card Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 16/24] ubifs: Fix RENAME_WHITEOUT support Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 17/24] ubifs: Fix O_TMPFILE corner case in ubifs_link() Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 18/24] mac80211: reject ToDS broadcast data frames Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 19/24] mac80211: fix MU-MIMO follow-MAC mode Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 21/24] ubi/upd: Always flush after prepared for an update Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 22/24] powerpc/kprobe: Fix oops when kprobed on stdu instruction Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 23/24] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs Greg Kroah-Hartman
2017-04-25 15:09 ` [PATCH 4.10 24/24] device-dax: switch to srcu, fix rcu_read_lock() vs pte allocation Greg Kroah-Hartman
2017-04-25 18:24 ` [PATCH 4.10 00/24] 4.10.13-stable review Shuah Khan
2017-04-26  2:23 ` Guenter Roeck

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.