Skip to contentSkip to conversation

Updated 32bit merge for tip x86 mce2 branch

x86 New Andi Kleen 2 participants 7 messages May 19, 2009 – May 22, 2009

Subsystems (2)
lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

Hi,

This patchkit finishes the 32bit/64bit merge of the MCE code that is in the x86 tip x86/mce2 branch.

This is all based on earlier patches I posted to linux-kernel several times for merging 32bit/64bit

I first fixed some bugs in mce2 (make it compile and some other problems) and then forward ported my old 32bit merge patches on top of it.

The 32bit merge patches port all the bug workarounds in the 32bit code to the 64bit code and then enable the 64bit mce code for 32bit too.

This is currently a CONFIG option for easier forward-backwards testing, but that CONFIG will go away after one major release.

I also added the basic MCE inject infrastructure because I needed that for testing.

The branch needs a rebase for HEAD and a merge for some bug fixes in linus' tree, but that's easily done (I didn't do it so far)

Also my fixes for mce2 could be collapsed into the earlier changes there (I didn't do this to make it clear what I changed), feel free to do that. I also reverted one patch where the patch author agreed it should be reverted.

I addressed all feedback I got on earlier versions of this I believe.

Could this tree please be merged into tip and enabled for linux-next?

I will post the other pending MCE improvements on top then once that is in.

That's all 2.6.31 material.

Thanks,

-Andi

The following changes since commit dd9869965a301d0f35e32c42eb87d5f94883443a:
Ingo Molnar (1):
x86, mce: print number of MCE banks

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6.git mce-32bit-merge

Andi Kleen (20):
x86: MCE: Make mce_amd_64.c compile again
Revert "x86, mce: Add mce=nopoll option to disable timer polling"
x86: MCE: Move ifdef X86_64 to the beginning of the file
x86: MCE: Initial steps to make 64bit mce code 32bit clean
x86: MCE: Implement the PPro bank 0 quirk in the 64bit machine check code
x86: MCE: Port K7 bank 0 quirk to 64bit mce code
x86: MCE: Use a call vector to call the 64bit mce handler
x86: MCE: Rename 64bit mce_dont_init to mce_disabled
x86: MCE: Move mce_disabled option into common 64bit/64bit code
x86: MCE: Remove machine check handler idle notify on 64bit
x86: MCE: Remove oops_begin() use in 64bit machine check
x86: MCE: Remove unused stop/restart_mce on 32bit
x86: MCE: Use 64bit machine check code on 32bit
x86: MCE: Deprecate old 32bit machine check code
x86: MCE: Enable MCE_INTEL for 32bit new MCE
x86: MCE: Enable MCE_AMD for 32bit NEW_MCE
x86: MCE: Document new 32bit mcelog requirement in Documentation/Changes Export add_timer_on for modules
x86: MCE: Add MSR read wrappers for easier error injection
x86: MCE: Add basic error injection infrastructure

 Documentation/Changes                      |   15 ++
 Documentation/feature-removal-schedule.txt |   12 +-
 Documentation/x86/x86_64/boot-options.txt  |    2 -
 arch/x86/Kconfig                           |   45 ++++-
 arch/x86/include/asm/entry_arch.h          |    6 +-
 arch/x86/include/asm/hardirq.h             |    2 +-
 arch/x86/include/asm/irq_vectors.h         |    5 +-
 arch/x86/include/asm/mce.h                 |    9 +-
 arch/x86/kernel/apic/apic.c                |    4 +-
 arch/x86/kernel/apic/nmi.c                 |    2 +-
 arch/x86/kernel/cpu/mcheck/Makefile        |    4 +-
 arch/x86/kernel/cpu/mcheck/mce-inject.c    |  126 +++++++++++++
 arch/x86/kernel/cpu/mcheck/mce.c           |  277 +++++++++++++++++-----------
 arch/x86/kernel/cpu/mcheck/mce.h           |   19 ++-
 arch/x86/kernel/cpu/mcheck/mce_amd_64.c    |   10 +-
 arch/x86/kernel/cpu/mcheck/p5.c            |    5 +
 arch/x86/kernel/cpu/mcheck/threshold.c     |    2 +-
 arch/x86/kernel/entry_64.S                 |    4 +-
 arch/x86/kernel/irq.c                      |    4 +-
 arch/x86/kernel/irqinit_32.c               |    6 +-
 arch/x86/kernel/signal.c                   |    4 +-
 arch/x86/kernel/traps.c                    |    4 +-
 kernel/timer.c                             |    1 +
 23 files changed, 421 insertions(+), 147 deletions(-)
 create mode 100644 arch/x86/kernel/cpu/mcheck/mce-inject.c
#1 lore raw
Quoted 4 lines · Andi Kleen

I also reverted one patch where the patch author agreed it should be reverted.

Revert "x86, mce: Add mce=nopoll option to disable timer polling"

That is:

Quoted 10 lines

commit 41e654ade96b57c2dca4cea3e21f75819ab9696c

Author: Andi Kleen <[email protected]>
Date:   Wed Apr 29 10:17:01 2009 +0200

Revert "x86, mce: Add mce=nopoll option to disable timer polling"

This reverts commit f5b3ca6efb64aa3ab5fa32f0fc9cc0f6cfedee95.

Seto-san has an updated patch following recent discussion that should be used instead.

OK. Please use following patches with my Signed-off-by instead. And an another revert patch should be applied to tip tree too.

Thanks,
H.Seto

author
#2 lore raw
Quoted 2 lines

OK. Please use following patches with my Signed-off-by instead. And an another revert patch should be applied to tip tree too.

Thanks.

Ideally these patches should be just removed before upstreaming. But I didn't want to touch the original branch for now so it's clear what I changed.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#3 lore raw

PATCH 1/2 x86, mce: Revert "add mce_threshold option for intel cmci"

In reply to Andi Kleen

This reverts commit 0b66224ac2fd303cd2858bf313058c555a555642.

After having some discussion with Andi Kleen, we have concluded that setting threshold >1 will not work properly.
This patch reverts the previous patch that introduces mce_threshold option.

However cmci is a new feature so having boot controls to disable it is generally a good idea, and it might be handy if the hw is misbehaving.

So instead of mce_threshold, I will introduce "mce=no_cmci" option to support cmci disablement in later patch.
Compare with mce_threshold, it lacks threshold >1 support but it does not matter because it will not work.

---
 Documentation/kernel-parameters.txt       |    5 ---
 arch/x86/include/asm/msr-index.h          |    1 -
 arch/x86/kernel/cpu/mcheck/mce_intel_64.c |   56 ++---------------------------
 3 files changed, 3 insertions(+), 59 deletions(-)
Documentation/kernel-parameters.txt +0 -5
index 5e966a9..6172e43 100644
@@ -1208,11 +1208,6 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	mce=option	[X86-64] See Documentation/x86/x86_64/boot-options.txt
 
-	mce_threshold=	[X86-64,intel] Default CMCI threshold
-			Should be unsigned integer. Setting 0 disables cmci.
-			Format: <integer>
-			Default: 1
-
 	md=		[HW] RAID subsystems devices and level
 			See Documentation/md.txt.
 
arch/x86/include/asm/msr-index.h +0 -1
index 1ea4055..bc2f045 100644
@@ -85,7 +85,6 @@
 #define MSR_IA32_MC0_CTL2		0x00000280
 #define CMCI_EN			(1ULL << 30)
 #define CMCI_THRESHOLD_MASK		0xffffULL
-#define CMCI_THRESHOLD_VAL_MASK		0x7fffULL
 
 #define MSR_P6_PERFCTR0			0x000000c1
 #define MSR_P6_PERFCTR1			0x000000c2
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +3 -53

92 lines not on this page · raw message

Signature · 1 line
1.6.3
#4 lore raw

PATCH 2/2 x86, mce: Revert "add mce=nopoll option to disable timer polling"

In reply to Andi Kleen

This reverts commit f5b3ca6efb64aa3ab5fa32f0fc9cc0f6cfedee95.

Disabling only polling but not cmci is pointless setting. Instead of "mce=nopoll" which should be paired with cmci disablement, it rather make sense to have a "mce=ignore_ce" option that disable both of polling and cmci at once. A patch for this replacement will follow this reverting patch.

OTOH, once booted, we can disable polling by setting check_interval to 0, but there are no mention about the fact. Later Andi will post updated documents that can respond this issue.

---
 Documentation/x86/x86_64/boot-options.txt |    2 --
 arch/x86/kernel/cpu/mcheck/mce.c          |   10 ++--------
 2 files changed, 2 insertions(+), 10 deletions(-)
Documentation/x86/x86_64/boot-options.txt +0 -2
index 5d55158..34c1304 100644
@@ -13,8 +13,6 @@ Machine check
                in a reboot. On Intel systems it is enabled by default.
    mce=nobootlog
 		Disable boot machine check logging.
-   mce=nopoll
-		Disable timer polling for corrected errors
    mce=tolerancelevel (number)
 		0: always panic on uncorrected errors, log corrected errors
 		1: panic or SIGBUS on uncorrected errors, log corrected errors
arch/x86/kernel/cpu/mcheck/mce.c +2 -8
index d7dccfe..d3628f3 100644
@@ -465,8 +465,6 @@ void mce_log_therm_throt_event(__u64 status)
  * Periodic polling timer for "silent" machine check errors.  If the
  * poller finds an MCE, poll 2x faster.  When the poller finds no more
  * errors, poll 2x slower (up to check_interval seconds).
- *
- * If check_interval is 0, polling is disabled.
  */
 
 static int		check_interval = 5 * 60;	/* 5 minutes */
@@ -665,12 +663,11 @@ static void mce_init_timer(void)
 {
 	struct timer_list *t = &__get_cpu_var(mce_timer);
 
-	/* Disable polling if check_interval is 0 */
-	if (!check_interval)
-		return;
 	/* data race harmless because everyone sets to the same value */
 	if (!next_interval)
 		next_interval = check_interval * HZ;
+	if (!next_interval)
+		return;
 	setup_timer(t, mcheck_timer, smp_processor_id());
 	t->expires = round_jiffies(jiffies + next_interval);
 	add_timer(t);
@@ -885,14 +882,11 @@ __setup("nomce", mcheck_disable);
  * mce=TOLERANCELEVEL (number, see above)
  * mce=bootlog Log MCEs from before booting. Disabled by default on AMD.
  * mce=nobootlog Don't log MCEs from before booting.
- * mce=nopoll Disable timer polling for corrected errors
  */
 static int __init mcheck_enable(char *str)
 {
 	if (!strcmp(str, "off"))
 		mce_dont_init = 1;
-	else if (!strcmp(str, "nopoll"))
-		check_interval = 0;
 	else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
 		mce_bootlog = (str[0] == 'b');
 	else if (isdigit(str[0]))
Signature · 1 line
1.6.3
#5 lore raw
In reply to Andi Kleen
Quoted 21 lines · Andi Kleen

The following changes since commit dd9869965a301d0f35e32c42eb87d5f94883443a:
Ingo Molnar (1):
x86, mce: print number of MCE banks

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6.git mce-32bit-merge

Andi Kleen (20):
x86: MCE: Make mce_amd_64.c compile again
Revert "x86, mce: Add mce=nopoll option to disable timer polling"
x86: MCE: Move ifdef X86_64 to the beginning of the file
x86: MCE: Initial steps to make 64bit mce code 32bit clean
x86: MCE: Implement the PPro bank 0 quirk in the 64bit machine check code
x86: MCE: Port K7 bank 0 quirk to 64bit mce code
x86: MCE: Use a call vector to call the 64bit mce handler
x86: MCE: Rename 64bit mce_dont_init to mce_disabled
x86: MCE: Move mce_disabled option into common 64bit/64bit code
x86: MCE: Remove machine check handler idle notify on 64bit
x86: MCE: Remove oops_begin() use in 64bit machine check
x86: MCE: Remove unused stop/restart_mce on 32bit

Quoted 8 lines

x86: MCE: Use 64bit machine check code on 32bit
x86: MCE: Deprecate old 32bit machine check code
x86: MCE: Enable MCE_INTEL for 32bit new MCE
x86: MCE: Enable MCE_AMD for 32bit NEW_MCE
x86: MCE: Document new 32bit mcelog requirement in Documentation/Changes Export add_timer_on for modules
x86: MCE: Add MSR read wrappers for easier error injection
x86: MCE: Add basic error injection infrastructure

I reviewed them again...

#####

[1]: in x86: MCE: Deprecate old 32bit machine check code

Review line 4

Quoted 6 lines
(quoted diff) +1 -1
@@ -1,4 +1,4 @@
-The following is a list of files and features that are going to be
+he following is a list of files and features that are going to be
 removed in the kernel source tree.  Every entry should contain what
 exactly is going away, why it is happening, and who is going to be doing
 the work.  When the feature is removed from the kernel, it should also

Is it necessary?

#####

[2]: in x86: MCE: Enable MCE_INTEL for 32bit new MCE

Quoted 6 lines
(quoted diff) +1 -1
@@ -88,12 +88,13 @@
 #define THERMAL_APIC_VECTOR            0xfa
 
 #ifdef CONFIG_X86_32
-/* 0xf8 - 0xf9 : free */
+/* 0xf9 : free */

Review line 100

Quoted 10 lines
(quoted diff) +2 -1
 #else
-# define THRESHOLD_APIC_VECTOR         0xf9
 # define UV_BAU_MESSAGE                        0xf8
 #endif
 
+#define THRESHOLD_APIC_VECTOR          0xf9
+
 /* f0-f7 used for spreading out TLB flushes: */
 #define INVALIDATE_TLB_VECTOR_END      0xf7
 #define INVALIDATE_TLB_VECTOR_START    0xf0

"/* 0xf8 : free :/" ?

And please place vectors in numerical order, like:

Review

Quoted 12 lines

#define THERMAL_APIC_VECTOR 0xfa

(quoted diff) +2 -2
+#define THRESHOLD_APIC_VECTOR          0xf9
 
 #ifdef CONFIG_X86_32
-/* 0xf8 - 0xf9 : free */
+/* 0xf8 : free */
 #else
-# define THRESHOLD_APIC_VECTOR         0xf9
 # define UV_BAU_MESSAGE                        0xf8
 #endif
 
 /* f0-f7 used for spreading out TLB flushes: */

#####

[3]: in x86: MCE: Add basic error injection infrastructure

Quoted 9 lines
(quoted diff) +1 -0
@@ -744,6 +778,7 @@ void __cpuinit mcheck_init(struct cpuinfo_x86 *c)
        mce_cpu_features(c);
        mce_init_timer();
 }
+EXPORT_SYMBOL_GPL(do_machine_check);
 
 /*
  * Character device to read and clear the MCE log.

Review timeout: · line 911

Quoted 7 lines
(quoted diff) +1 -0
@@ -870,6 +905,7 @@ timeout:
 
        return err ? -EFAULT : buf - ubuf;
 }
+EXPORT_SYMBOL_GPL(mce_notify_user);
 
 static unsigned int mce_poll(struct file *file, poll_table *wait)
 {

These EXPORT_SYMBOL_GPLs are located in wrong place.

#####

[trivial]: in x86: MCE: Use 64bit machine check code on 32bit

Quoted 6 lines
(quoted diff) +2 -0
@@ -793,6 +809,15 @@ config X86_MCE_AMD
           Additional support for AMD specific MCE features such as
           the DRAM Error Threshold.
 
+config X86_ANCIENT_MCE
+       def_bool n

Review config X86_MCE_AMD · line 823

Quoted 10 lines
(quoted diff) +7 -0
+       depends on X86_32
+       prompt "Support for old Pentium 5 / WinChip machine checks"
+       help
+         Include support for machine check handling on old Pentium 5 or WinChip
+        systems. These typically need to be enabled explicitely on the command
+        line.
+
 config X86_MCE_THRESHOLD
        depends on X86_MCE_AMD || X86_MCE_INTEL
        bool

It would be better to use "---help---" instead of "help".

And also it would be better to clean trailing spaces and spaces before tabs etc., that can be seen here and there.

Thanks,
H.Seto

author
#6 lore raw
Quoted 8 lines · Hidetoshi Seto

Review line 4

Quoted 6 lines
(quoted diff) +1 -1
@@ -1,4 +1,4 @@
-The following is a list of files and features that are going to be
+he following is a list of files and features that are going to be
 removed in the kernel source tree.  Every entry should contain what
 exactly is going away, why it is happening, and who is going to be doing
 the work.  When the feature is removed from the kernel, it should also

Is it necessary?

I fixed all that and regenerated the tree.

Hopefully the tree can be properly redone now, it's quite messy that mce2 is still missing all the rc6 mce_64.c changes. I have to patch around because of this on my followup trees.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.