Skip to contentSkip to conversation

x86 fixes

GIT PULL Ingo Molnar 4 participants 8 messages Feb 19, 2009 – Feb 21, 2009 x86

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-fixes-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-fixes-for-linus

Thanks,

Ingo

------------------>
Andi Kleen (3):
x86, mce: reinitialize per cpu features on resume
x86, mce: use force_sig_info to kill process in machine check x86, mce: fix ifdef for 64bit thermal apic vector clear on shutdown

Paul E. McKenney (1):
x86, rcu: fix strange load average and ksoftirqd behavior

 arch/x86/kernel/apic.c              |    2 +-
 arch/x86/kernel/cpu/mcheck/mce_64.c |    5 +++--
 arch/x86/kernel/process_32.c        |    3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)
arch/x86/kernel/apic.c +1 -1
index 115449f..570f36e 100644
@@ -862,7 +862,7 @@ void clear_local_APIC(void)
 	}
 
 	/* lets not touch this if we didn't frob it */
-#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL)
+#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
 	if (maxlvt >= 5) {
 		v = apic_read(APIC_LVTTHMR);
 		apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED);
arch/x86/kernel/cpu/mcheck/mce_64.c +3 -2
index 1c83803..25cf624 100644
@@ -295,11 +295,11 @@ void do_machine_check(struct pt_regs * regs, long error_code)
 		 * If we know that the error was in user space, send a
 		 * SIGBUS.  Otherwise, panic if tolerance is low.
 		 *
-		 * do_exit() takes an awful lot of locks and has a slight
+		 * force_sig() takes an awful lot of locks and has a slight
 		 * risk of deadlocking.
 		 */
 		if (user_space) {
-			do_exit(SIGBUS);
+			force_sig(SIGBUS, current);
 		} else if (panic_on_oops || tolerant < 2) {
 			mce_panic("Uncorrected machine check",
 				&panicm, mcestart);
@@ -734,6 +734,7 @@ __setup("mce=", mcheck_enable);
 static int mce_resume(struct sys_device *dev)
 {
 	mce_init(NULL);
+	mce_cpu_features(&current_cpu_data);
 	return 0;
 }
 
arch/x86/kernel/process_32.c +0 -3
index a546f55..bd4da2a 100644
@@ -104,9 +104,6 @@ void cpu_idle(void)
 			check_pgt_cache();
 			rmb();
 
-			if (rcu_pending(cpu))
-				rcu_check_callbacks(cpu, 0);
-
 			if (cpu_is_offline(cpu))
 				play_dead();
 
#1 lore raw
Quoted 3 lines · Ingo Molnar

Andi Kleen (3):
x86, mce: reinitialize per cpu features on resume

This one causes

WARNING: arch/x86/kernel/cpu/mcheck/built-in.o(.text+0xf72): Section mismatch in reference from the function mce_resume() to the function .cpuinit.text:mce_intel_feature_init() The function mce_resume() references
the function __cpuinit mce_intel_feature_init().
This is often because mce_resume lacks a __cpuinit annotation or the annotation of mce_intel_feature_init is wrong.

which looks like a real bug.

On UP - withot CPU hotplug - I think __cpuinit becomes __init. No? So now mce_resume() will call some function that was long since free'd.

I didn't look closer, but I wish somebody else would. And I wish people looked at warnings that are introduced by their new code before sending said changes to me.

Linus

#2 lore raw
Quoted 3 lines · Linus Torvalds

I didn't look closer, but I wish somebody else would. And I wish people looked at warnings that are introduced by their new code before sending said changes to me.

Looking at it now.

-hpa

#3 lore raw
In reply to Linus Torvalds
Quoted 12 lines · Linus Torvalds
Quoted 3 lines · Ingo Molnar

Andi Kleen (3):
x86, mce: reinitialize per cpu features on resume

This one causes

WARNING: arch/x86/kernel/cpu/mcheck/built-in.o(.text+0xf72): Section mismatch in reference from the function mce_resume() to the function .cpuinit.text:mce_intel_feature_init() The function mce_resume() references
the function __cpuinit mce_intel_feature_init().
This is often because mce_resume lacks a __cpuinit annotation or the annotation of mce_intel_feature_init is wrong.

Quoted 5 lines

which looks like a real bug.

On UP - withot CPU hotplug - I think __cpuinit becomes __init. No? So now mce_resume() will call some function that was long since free'd.

Indeed. hpa pushed the fix for it - it can be found below.

Quoted 3 lines

I didn't look closer, but I wish somebody else would. And I wish people looked at warnings that are introduced by their new code before sending said changes to me.

Hm, i build and boot every tree i send to you, but this warning didnt pop up and i specifically watch for build warnings and section warnings in particular. (50% of all section warnings are real.)

And i dont see it in an allyesconfig build either. Weird.

After half an hour of head scratching (including two allyesconfig builds) i found these two gems commits that were merged in the last week or two:

| commit fa2144ba9a31d1d0dc9607508576c3850e0d95b1
| Author: Sam Ravnborg <[email protected]>
| Date:   Fri Feb 15 13:53:11 2008 +0100
|
|     kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED
|    
|     We started to see patches enabling this - so explain why
|     it is disabled and the condition to enable it again.
|    
|     Signed-off-by: Sam Ravnborg <[email protected]>
|
| diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
| index a370fe8..ab408aa 100644
| --- a/lib/Kconfig.debug
| +++ b/lib/Kconfig.debug
| @@ -82,6 +82,9 @@ config HEADERS_CHECK
|  config DEBUG_SECTION_MISMATCH
|         bool "Enable full Section mismatch analysis"
|         depends on UNDEFINED
| +       # This option is on purpose disabled for now.
| +       # It will be enabled when we are down to a resonable number
| +       # of section mismatch warnings (< 10 for an allyesconfig build)
| commit e5f95c8b7700a7bf1c2d24eedc677954d9aa0285
| Author: Sam Ravnborg <[email protected]>
| Date:   Sat Feb 2 18:57:18 2008 +0100
|
|     kbuild: print only total number of section mismatces found
|    
|     We have too many section mismatches detected at the moment.
|     So silence modpost and prevent the option from being
|     set in a typical allyesconfig build.
|    
|     Tell the user how to see all the deteils in the summary
|     message from modpost.
|     
|     Signed-off-by: Sam Ravnborg <[email protected]>

These commits are an utter joke.

Sam, i virtually _begged_ you a few months ago to actually turn section warnings into hard build failures, because 50% of the time the warnings show real bugs and we want to fix real bugs not hide them. Having them as build failures and not as warnings is the only way to realistically fix them, in the current upstream kernel climate.

Not only didnt what i suggest happen, but apparently this useful debug feature got turned _off_ in rc5, silently :-( This broke my push-to-Linus qa.

And the thing is, this commit log title:

kbuild: print only total number of section mismatces found

is utterly deceiving as well. It should have been:

kbuild: disable CONFIG_DEBUG_SECTION_MISMATCH

(i'd probably have noticed that patch - i check every patch title that goes upstream.)

I've now worked it around in tip:master but that's not a good solution because when i send a tree to Linus i build _that specific tree_, with _zero_ additional patches, to make sure that what i send to Linus is sane. (to make sure that none of our other fixes/changes in tip:master interact, etc.)

So these patches need to be reverted in -rc6.

Ingo

------------------------->

Quoted 1 line

From cc3ca22063784076bd240fda87217387a8f2ae92 Mon Sep 17 00:00:00 2001

From: H. Peter Anvin <[email protected]>
Date: Fri, 20 Feb 2009 23:35:51 -0800
Subject: [PATCH] x86, mce: remove incorrect __cpuinit for mce_cpu_features()

Impact: Bug fix on UP

Checkin 6ec68bff3c81e776a455f6aca95c8c5f1d630198:
x86, mce: reinitialize per cpu features on resume

introduced a call to mce_cpu_features() in the resume path, in order for the MCE machinery to get properly reinitialized after a resume. However, this function (and its successors) was flagged __cpuinit, which becomes __init on UP configurations (on SMP suspend/resume requires CPU hotplug and so this would not be seen.)

Remove the offending __cpuinit annotations for mce_cpu_features() and its successor functions.

Cc Andi Kleen <[email protected]>
Cc Linus Torvalds <[email protected]>
---
 arch/x86/kernel/cpu/mcheck/mce_64.c       |    2 +-
 arch/x86/kernel/cpu/mcheck/mce_amd_64.c   |    2 +-
 arch/x86/kernel/cpu/mcheck/mce_intel_64.c |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_64.c +1 -1
index 25cf624..fe79985 100644
@@ -490,7 +490,7 @@ static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c)
 
 }
 
-static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c)
+static void mce_cpu_features(struct cpuinfo_x86 *c)
 {
 	switch (c->x86_vendor) {
 	case X86_VENDOR_INTEL:
arch/x86/kernel/cpu/mcheck/mce_amd_64.c +1 -1
index 8ae8c4f..f2ee0ae 100644
@@ -121,7 +121,7 @@ static long threshold_restart_bank(void *_tr)
 }
 
 /* cpu init entry point, called from mce.c with preempt off */
-void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
+void mce_amd_feature_init(struct cpuinfo_x86 *c)
 {
 	unsigned int bank, block;
 	unsigned int cpu = smp_processor_id();
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +2 -2
index 4b48f25..f44c366 100644
@@ -30,7 +30,7 @@ asmlinkage void smp_thermal_interrupt(void)
 	irq_exit();
 }
 
-static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
+static void intel_init_thermal(struct cpuinfo_x86 *c)
 {
 	u32 l, h;
 	int tm2 = 0;
@@ -84,7 +84,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
 	return;
 }
 
-void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
+void mce_intel_feature_init(struct cpuinfo_x86 *c)
 {
 	intel_init_thermal(c);
 }
#4 lore raw
Quoted 5 lines · Ingo Molnar
| commit fa2144ba9a31d1d0dc9607508576c3850e0d95b1
| Author: Sam Ravnborg <[email protected]>
| Date:   Fri Feb 15 13:53:11 2008 +0100
|
|     kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED

hm, that's 2008 not 2009.

I dont know why the section warnings went away, but i frequently saw these warnings and i never forced CONFIG_DEBUG_SECTION_MISMATCH on the command line.

Ingo

#5 lore raw
Quoted 8 lines · Ingo Molnar
Quoted 5 lines · Ingo Molnar
| commit fa2144ba9a31d1d0dc9607508576c3850e0d95b1
| Author: Sam Ravnborg <[email protected]>
| Date:   Fri Feb 15 13:53:11 2008 +0100
|
|     kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED
Quoted 6 lines

hm, that's 2008 not 2009.

I dont know why the section warnings went away, but i frequently saw these warnings and i never forced CONFIG_DEBUG_SECTION_MISMATCH on the command line.

Either way, I was rather unhappy to find out that my test scripts were silently broken by this change a year ago. Furthermore, right now there are only 9 section warnings in allyesconfig on x86-64 and 12 on i386, and one of those was the one I just corrected. The last thing we need is them to be squelshed.

These patches should be backed out at once.

-hpa

Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.
#6 lore raw
In reply to Ingo Molnar
Quoted 43 lines

After half an hour of head scratching (including two allyesconfig builds) i found these two gems commits that were merged in the last week or two:

| commit fa2144ba9a31d1d0dc9607508576c3850e0d95b1
| Author: Sam Ravnborg <[email protected]>
| Date:   Fri Feb 15 13:53:11 2008 +0100
|
|     kbuild: explain why DEBUG_SECTION_MISMATCH is UNDEFINED
|    
|     We started to see patches enabling this - so explain why
|     it is disabled and the condition to enable it again.
|    
|     Signed-off-by: Sam Ravnborg <[email protected]>
|
| diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
| index a370fe8..ab408aa 100644
| --- a/lib/Kconfig.debug
| +++ b/lib/Kconfig.debug
| @@ -82,6 +82,9 @@ config HEADERS_CHECK
|  config DEBUG_SECTION_MISMATCH
|         bool "Enable full Section mismatch analysis"
|         depends on UNDEFINED
| +       # This option is on purpose disabled for now.
| +       # It will be enabled when we are down to a resonable number
| +       # of section mismatch warnings (< 10 for an allyesconfig build)
| commit e5f95c8b7700a7bf1c2d24eedc677954d9aa0285
| Author: Sam Ravnborg <[email protected]>
| Date:   Sat Feb 2 18:57:18 2008 +0100
|
|     kbuild: print only total number of section mismatces found
|    
|     We have too many section mismatches detected at the moment.
|     So silence modpost and prevent the option from being
|     set in a typical allyesconfig build.
|    
|     Tell the user how to see all the deteils in the summary
|     message from modpost.
|     
|     Signed-off-by: Sam Ravnborg <[email protected]>
Quoted 1 line

These commits are an utter joke.

In 2008 when they was applied they were perfectly sensible. We had far too many secton mismatch warnings at that point in time and I btw spent quite some time fixing these.

I reached zero warnings on allyesconfig/allmodconfig builds on x86 in my tree, but I recall that I had warnings left in diverse arm configs, and some other archs that I build.

After several flames about section mismatch fixes was pure patch noise and not worth the time to neiter fix the warnings nor report them I simply lost incentive to do any kind of follow-up on them.

Before that the above patches was introduced because several people complained about the additional warnings that was generated and the fear for this that lkml would be spammed.

I will be happy to merge a patch that makes the warnings become visible again and also to make them hard errors.
But for now I cannot take the additional work it requires to follow all the section mismatch warnings that suddenly will pop up for the different architectures, which is why I hesitate to create said patch myself.

Sam

#7 lore raw
Quoted 7 lines · Sam Ravnborg

I will be happy to merge a patch that makes the warnings become visible again and also to make them hard errors.

But for now I cannot take the additional work it requires to follow all the section mismatch warnings that suddenly will pop up for the different architectures, which is why I hesitate to create said patch myself.

Ok - i'm working on a patch that enables it on x86 and makes it a hard failure, and brings the number of warnings down to a zero baseline where we can base a sane future on. Other architectures can then opt-in too when they see fit - or can leave it disabled if it's too much work for them.

Ingo