All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] x86/mce: correct the detection of invalid mce priorities
@ 2020-11-06 14:12 Zhen Lei
  2020-11-06 14:12 ` [PATCH v2 1/1] " Zhen Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2020-11-06 14:12 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov, Thomas Gleixner, Ingo Molnar, x86,
	H . Peter Anvin, linux-edac, linux-kernel
  Cc: Zhen Lei

v1 --> v2:
Update the detection of invalid mce priorities, the WARN_ON() is needed.

v1:
Remove the WARN_ON() in mce_register_decode_chain().

Zhen Lei (1):
  x86/mce: correct the detection of invalid mce priorities

 arch/x86/include/asm/mce.h     | 3 ++-
 arch/x86/kernel/cpu/mce/core.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.26.0.106.g9fadedd



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

* [PATCH v2 1/1] x86/mce: correct the detection of invalid mce priorities
  2020-11-06 14:12 [PATCH v2 0/1] x86/mce: correct the detection of invalid mce priorities Zhen Lei
@ 2020-11-06 14:12 ` Zhen Lei
  2020-11-06 18:34   ` [tip: ras/core] x86/mce: Correct the detection of invalid notifier priorities tip-bot2 for Zhen Lei
  0 siblings, 1 reply; 3+ messages in thread
From: Zhen Lei @ 2020-11-06 14:12 UTC (permalink / raw)
  To: Tony Luck, Borislav Petkov, Thomas Gleixner, Ingo Molnar, x86,
	H . Peter Anvin, linux-edac, linux-kernel
  Cc: Zhen Lei

enum mce_notifier_prios {
	MCE_PRIO_LOWEST,
	...
	MCE_PRIO_CEC
};

After commit c9c6d216ed28 ("x86/mce: Rename "first" function as "early""),
the range of invalid priorities is changed. Add a new enumeration value
MCE_PRIO_HIGHEST, so that people can add enumeration values greater than
MCE_PRIO_CEC in the future without having to modify the function
mce_register_decode_chain().

Because the type of "nb->priority" is int, so the priority less than
MCE_PRIO_LOWEST is also invalid.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 arch/x86/include/asm/mce.h     | 3 ++-
 arch/x86/kernel/cpu/mce/core.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index a0f147893a04..fc25c88c7ff2 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -177,7 +177,8 @@ enum mce_notifier_prios {
 	MCE_PRIO_EXTLOG,
 	MCE_PRIO_UC,
 	MCE_PRIO_EARLY,
-	MCE_PRIO_CEC
+	MCE_PRIO_CEC,
+	MCE_PRIO_HIGHEST = MCE_PRIO_CEC
 };
 
 struct notifier_block;
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 4102b866e7c0..0a54a2cfeeff 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL_GPL(mce_log);
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
+	if (WARN_ON((nb->priority < MCE_PRIO_LOWEST) ||
+		    (nb->priority > MCE_PRIO_HIGHEST)))
 		return;
 
 	blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);
-- 
2.26.0.106.g9fadedd



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

* [tip: ras/core] x86/mce: Correct the detection of invalid notifier priorities
  2020-11-06 14:12 ` [PATCH v2 1/1] " Zhen Lei
@ 2020-11-06 18:34   ` tip-bot2 for Zhen Lei
  0 siblings, 0 replies; 3+ messages in thread
From: tip-bot2 for Zhen Lei @ 2020-11-06 18:34 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Zhen Lei, Borislav Petkov, x86, LKML

The following commit has been merged into the ras/core branch of tip:

Commit-ID:     15af36596ae305aefc8c502c2d3e8c58221709eb
Gitweb:        https://git.kernel.org/tip/15af36596ae305aefc8c502c2d3e8c58221709eb
Author:        Zhen Lei <thunder.leizhen@huawei.com>
AuthorDate:    Fri, 06 Nov 2020 22:12:16 +08:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 06 Nov 2020 19:02:48 +01:00

x86/mce: Correct the detection of invalid notifier priorities

Commit

  c9c6d216ed28 ("x86/mce: Rename "first" function as "early"")

changed the enumeration of MCE notifier priorities. Correct the check
for notifier priorities to cover the new range.

 [ bp: Rewrite commit message, remove superfluous brackets in
   conditional. ]

Fixes: c9c6d216ed28 ("x86/mce: Rename "first" function as "early"")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20201106141216.2062-2-thunder.leizhen@huawei.com
---
 arch/x86/include/asm/mce.h     | 3 ++-
 arch/x86/kernel/cpu/mce/core.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index a0f1478..fc25c88 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -177,7 +177,8 @@ enum mce_notifier_prios {
 	MCE_PRIO_EXTLOG,
 	MCE_PRIO_UC,
 	MCE_PRIO_EARLY,
-	MCE_PRIO_CEC
+	MCE_PRIO_CEC,
+	MCE_PRIO_HIGHEST = MCE_PRIO_CEC
 };
 
 struct notifier_block;
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 888248a..ccac4c2 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -162,7 +162,8 @@ EXPORT_SYMBOL_GPL(mce_log);
 
 void mce_register_decode_chain(struct notifier_block *nb)
 {
-	if (WARN_ON(nb->priority > MCE_PRIO_MCELOG && nb->priority < MCE_PRIO_EDAC))
+	if (WARN_ON(nb->priority < MCE_PRIO_LOWEST ||
+		    nb->priority > MCE_PRIO_HIGHEST))
 		return;
 
 	blocking_notifier_chain_register(&x86_mce_decoder_chain, nb);

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

end of thread, other threads:[~2020-11-06 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 14:12 [PATCH v2 0/1] x86/mce: correct the detection of invalid mce priorities Zhen Lei
2020-11-06 14:12 ` [PATCH v2 1/1] " Zhen Lei
2020-11-06 18:34   ` [tip: ras/core] x86/mce: Correct the detection of invalid notifier priorities tip-bot2 for Zhen Lei

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.