last-minute patches for MCE .31
cover last-minute patches for MCE .31
Here are 16 patches for bugfixes and cleanups etc. These are against tip/x86/mce3, but today I confirmed that these can be applied on Linus's latest, with no errors.
Please consider applying these for .31
[1] Bugfix
x86, mce: don't init timer if !mce_available x86, mce: call-in should be after updating global_nwo
These bugs are not serious, but should be fixed asap.
[2] Misc (requested by Ingo)
x86, mce: add __read_mostly
x86, mce: rename static variables around trigger x86, mce: sysfs entries for new options
Minor improvements (cleanups), and an enhancement for a feature newly introduced in this merge window (i.e. run-time disablement of cmci).
[3] Cleanups
x86, mce: unify mce.h
x86, mce: make mce_disabled boolean
x86, mce: unify smp_thermal_interrupt, prepare p4 x86, mce: unify smp_thermal_interrupt, prepare mce_intel_64 x86, mce: unify smp_thermal_interrupt, prepare x86, mce: unify smp_thermal_interrupt
x86, mce: squash mce_intel.c into therm_throt.c x86, mce: remove intel_set_thermal_handler()
x86, mce: remove therm_throt.h
x86, mce: mce.h cleanup
x86, mce: rename
There are 3 goals:
[3-1] unify mce.h
There are 2 files named mce.h:
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mcheck/mce.h
The latter is small, and in it:
#include <asm/mce.h>so we can have a unified one.
[3-2] finish unifying thermal codes
Now codes for thermal interrupt is distributed for multiple files. We can gather them in one therm_throt.c file.
arch/x86/include/asm/mce.h | 53 +++++++++------ arch/x86/include/asm/therm_throt.h | 9 --- arch/x86/kernel/cpu/mcheck/Makefile | 7 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 73 -------------------- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 21 ------ arch/x86/kernel/cpu/mcheck/p4.c | 45 ------------ arch/x86/kernel/cpu/mcheck/therm_throt.c | 106 +++++++++++++++++++++++++++- 7 files changed, 137 insertions(+), 177 deletions(-) delete mode 100644 arch/x86/include/asm/therm_throt.h delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel.c
This makes Makefile clean & simple:
before:
obj-y = mce.o therm_throt.o
obj-$(CONFIG_X86_MCE_P4THERMAL) += mce_intel.o
obj-$(CONFIG_X86_MCE_INTEL) += mce_intel_64.o mce_intel.o
after:
obj-y = mce.o
obj-$(CONFIG_X86_MCE_INTEL) += mce_intel_64.o
obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o [3-3] rename
Rename files that are no longer 64bit specific:
mce_amd_64.c => mce_amd.c
mce_intel_64.c => mce_intel.cThanks,
H.Seto
===
Hidetoshi Seto (16):
x86, mce: don't init timer if !mce_available
x86, mce: call-in should be after updating global_nwo x86, mce: add __read_mostly
x86, mce: rename static variables around trigger x86, mce: sysfs entries for new options
x86, mce: unify mce.h
x86, mce: make mce_disabled boolean
x86, mce: unify smp_thermal_interrupt, prepare p4 x86, mce: unify smp_thermal_interrupt, prepare mce_intel_64 x86, mce: unify smp_thermal_interrupt, prepare x86, mce: unify smp_thermal_interrupt
x86, mce: squash mce_intel.c into therm_throt.c x86, mce: remove intel_set_thermal_handler()
x86, mce: remove therm_throt.h
x86, mce: mce.h cleanup
x86, mce: rename
arch/x86/include/asm/mce.h | 63 ++- arch/x86/include/asm/therm_throt.h | 9 - arch/x86/kernel/cpu/mcheck/Makefile | 9 +- arch/x86/kernel/cpu/mcheck/k7.c | 3 +- arch/x86/kernel/cpu/mcheck/mce.c | 216 ++++++--- arch/x86/kernel/cpu/mcheck/mce.h | 38 -- arch/x86/kernel/cpu/mcheck/mce_amd.c | 703 +++++++++++++++++++++++++++++ arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 703 ----------------------------- arch/x86/kernel/cpu/mcheck/mce_intel.c | 249 ++++++++-- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 248 ---------- arch/x86/kernel/cpu/mcheck/non-fatal.c | 3 +- arch/x86/kernel/cpu/mcheck/p4.c | 48 +-- arch/x86/kernel/cpu/mcheck/p5.c | 15 +- arch/x86/kernel/cpu/mcheck/p6.c | 3 +- arch/x86/kernel/cpu/mcheck/therm_throt.c | 106 +++++- arch/x86/kernel/cpu/mcheck/winchip.c | 3 +- arch/x86/kernel/traps.c | 3 +- 17 files changed, 1220 insertions(+), 1202 deletions(-) delete mode 100644 arch/x86/include/asm/therm_throt.h delete mode 100644 arch/x86/kernel/cpu/mcheck/mce.h create mode 100644 arch/x86/kernel/cpu/mcheck/mce_amd.c delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_amd_64.c delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel_64.c
PATCH 1/16 x86, mce: don't init timer if !mce_available
In mce_cpu_restart, mce_init_timer is called unconditionally. If !mce_available (e.g. mce is disabled), there are no useful work for timer. Stop running it.
--- arch/x86/kernel/cpu/mcheck/mce.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +3 -2
@@ -1609,8 +1609,9 @@ static int mce_resume(struct sys_device *dev)static void mce_cpu_restart (void *data) {del_timer_sync (&__get_cpu_var (mce_timer)); -if (mce_available (¤t_cpu_data)) -mce_init (); +if (!mce_available (¤t_cpu_data)) +return ; +mce_init ();mce_init_timer (); }
Signature · 1 line
1.6.3
PATCH 2/16 x86, mce: call-in should be after updating global_nwo
In reply to Hidetoshi SetoAt the beginning of Monarch synchronization, processors wait until all of them have entered the exception handler and then check the global_nwo to determine if any of them saw a fatal event.
However since current code does call-in before updating global_nwo, it might happen that the global_nwo does not reflect some of local nwo at the time. This might break printing corrected errors not handled yet on panic.
--- arch/x86/kernel/cpu/mcheck/mce.c | 65 ++++++++++++++++++-------------------- 1 files changed, 31 insertions(+), 34 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +31 -34
@@ -691,18 +691,18 @@ static atomic_t global_nwo;* in the entry order. * TBD double check parallel CPU hotunplug */ -static int mce_start (int no_way_out,int *order) +static int mce_start (int *no_way_out) { -int nwo; +int order;int cpus =num_online_cpus ();u64 timeout = (u64 )monarch_timeout *NSEC_PER_USEC ; -if (!timeout) { - *order =-1 ; -return no_way_out; - } +if (!timeout) +return -1 ; -atomic_add (no_way_out, &global_nwo); +atomic_add (*no_way_out, &global_nwo); + + order =atomic_add_return (1 , &mce_callin);/* * Wait for everyone.
@@ -710,40 +710,38 @@ static int mce_start(int no_way_out, int *order)while (atomic_read (&mce_callin) != cpus) {if (mce_timed_out (&timeout)) {atomic_set (&global_nwo,0 ); - *order =-1 ; -return no_way_out; +return -1 ; }ndelay (SPINUNIT ); } -/* -* Cache the global no_way_out state. -*/ - nwo =atomic_read (&global_nwo); - -/* -* Monarch starts executing now, the others wait. -*/ -if (*order ==1 ) { +if (order ==1 ) { +/* +* Monarch: Starts executing now, the others wait. +*/ atomic_set (&mce_executing,1 ); -return nwo; + }else { +/* +* Subject: Now start the scanning loop one by one in +* the original callin order. +* This way when there are any shared banks it will be +* only seen by one CPU before cleared, avoiding duplicates. +*/ +while (atomic_read (&mce_executing) < order) { +if (mce_timed_out (&timeout)) { +atomic_set (&global_nwo,0 ); +return -1 ; + } +ndelay (SPINUNIT ); + } }/* -* Now start the scanning loop one by one -* in the original callin order. -* This way when there are any shared banks it will -* be only seen by one CPU before cleared, avoiding duplicates. +* Cache the global no_way_out state. */ -while (atomic_read (&mce_executing) < *order) { -if (mce_timed_out (&timeout)) { -atomic_set (&global_nwo,0 ); - *order =-1 ; -return no_way_out; - } -ndelay (SPINUNIT ); - } -return nwo; + *no_way_out =atomic_read (&global_nwo); + +return order; }/*
@@ -887,7 +885,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)if (!banks) goto out; - order =atomic_add_return (1 , &mce_callin);mce_setup (&m); m.mcgstatus =mce_rdmsrl (MSR_IA32_MCG_STATUS );
@@ -909,7 +906,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)* This way we don't report duplicated events on shared banks * because the first one to see it will clear it. */ - no_way_out =mce_start (no_way_out, &order); + order =mce_start (&no_way_out);for (i =0 ; i < banks; i++) {__clear_bit (i, toclear);if (!bank[i])
Signature · 1 line
1.6.3
Re: [PATCH 02/16] x86, mce: call-in should be after updating global_nwo
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 8 lines
At the beginning of Monarch synchronization, processors wait until all of them have entered the exception handler and then check the
global_nwoto determine if any of them saw a fatal event.However since current code does call-in before updating
global_nwo, it might happen that theglobal_nwodoes not reflect some of local nwo at the time. This might break printing corrected errors not handled yet on panic.
This is almost same as the patch that I just posted. I think this is because it trigger a failure in mce-test suite, and we both find the failure.
But your patch lacks memory barrier between mce_callin and global_nwo updating/reading. Atomic operations does not imply memory barrier.
Best Regards,
Huang Ying
Re: [PATCH 02/16] x86, mce: call-in should be after updating global_nwo
Quoted 5 lines · huang ying
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 4 lines
At the beginning of Monarch synchronization, processors wait until all of them have entered the exception handler and then check the
global_nwoto determine if any of them saw a fatal event.
Quoted 8 lines
Quoted 4 lines
However since current code does call-in before updating
global_nwo, it might happen that theglobal_nwodoes not reflect some of local nwo at the time. This might break printing corrected errors not handled yet on panic.This is almost same as the patch that I just posted. I think this is because it trigger a failure in mce-test suite, and we both find the failure.
That's right.
Quoted 2 lines
But your patch lacks memory barrier between
mce_callinandglobal_nwoupdating/reading. Atomic operations does not imply memory barrier.
You are right. I agree that your patch is better fix.
It seems my patch includes cleanup for mce_start(), so I'll extract it and make another patch soon.
Thanks,
H.Seto
PATCH 1/1 x86, mce: cleanup mce_start()
In reply to huang ying[ my 02/16 should be replaced by combination of Huang's fix and this cleanup ]
Simplify interface of mce_start().
- no_way_out = mce_start(no_way_out, &order);
+ order = mce_start(&no_way_out);
Now Monarch and Subjects share same exit(return) in usual path.
--- arch/x86/kernel/cpu/mcheck/mce.c | 66 ++++++++++++++++++-------------------- 1 files changed, 31 insertions(+), 35 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +31 -35
@@ -691,23 +691,21 @@ static atomic_t global_nwo;* in the entry order. * TBD double check parallel CPU hotunplug */ -static int mce_start (int no_way_out,int *order) +static int mce_start (int *no_way_out) { -int nwo; +int order;int cpus =num_online_cpus ();u64 timeout = (u64 )monarch_timeout *NSEC_PER_USEC ; -if (!timeout) { - *order =-1 ; -return no_way_out; - } +if (!timeout) +return -1 ; -atomic_add (no_way_out, &global_nwo); +atomic_add (*no_way_out, &global_nwo);/* * global_nwo should be updated before mce_callin */ smp_wmb (); - *order =atomic_add_return (1 , &mce_callin); + order =atomic_add_return (1 , &mce_callin);/* * Wait for everyone.
@@ -715,8 +713,7 @@ static int mce_start(int no_way_out, int *order)while (atomic_read (&mce_callin) != cpus) {if (mce_timed_out (&timeout)) {atomic_set (&global_nwo,0 ); - *order =-1 ; -return no_way_out; +return -1 ; }ndelay (SPINUNIT ); }
@@ -725,34 +722,34 @@ static int mce_start(int no_way_out, int *order)* mce_callin should be read before global_nwo */ smp_rmb (); -/* -* Cache the global no_way_out state. -*/ - nwo =atomic_read (&global_nwo); -/* -* Monarch starts executing now, the others wait. -*/ -if (*order ==1 ) { +if (order ==1 ) { +/* +* Monarch: Starts executing now, the others wait. +*/ atomic_set (&mce_executing,1 ); -return nwo; + }else { +/* +* Subject: Now start the scanning loop one by one in +* the original callin order. +* This way when there are any shared banks it will be +* only seen by one CPU before cleared, avoiding duplicates. +*/ +while (atomic_read (&mce_executing) < order) { +if (mce_timed_out (&timeout)) { +atomic_set (&global_nwo,0 ); +return -1 ; + } +ndelay (SPINUNIT ); + } }/* -* Now start the scanning loop one by one -* in the original callin order. -* This way when there are any shared banks it will -* be only seen by one CPU before cleared, avoiding duplicates. +* Cache the global no_way_out state. */ -while (atomic_read (&mce_executing) < *order) { -if (mce_timed_out (&timeout)) { -atomic_set (&global_nwo,0 ); - *order =-1 ; -return no_way_out; - } -ndelay (SPINUNIT ); - } -return nwo; + *no_way_out =atomic_read (&global_nwo); + +return order; }/*
@@ -871,8 +868,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)* Establish sequential order between the CPUs entering the machine * check handler. */ -int order =-1 ; - +int order;/* * If no_way_out gets set, there is no safe way to recover from this * MCE. If tolerant is cranked up, we'll try anyway.
@@ -917,7 +913,7 @@ void do_machine_check(struct pt_regs *regs, long error_code)* This way we don't report duplicated events on shared banks * because the first one to see it will clear it. */ - no_way_out =mce_start (no_way_out, &order); + order =mce_start (&no_way_out);for (i =0 ; i < banks; i++) {__clear_bit (i, toclear);if (!bank[i])
Signature · 1 line
1.6.3
PATCH 3/16 x86, mce: add __read_mostly
In reply to Hidetoshi SetoAs recommended by Ingo Molnar.
--- arch/x86/kernel/cpu/mcheck/mce.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +13 -13
@@ -57,7 +57,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)void (*machine_check_vector)(struct pt_regs *,long error_code) = unexpected_machine_check; -int mce_disabled; +int mce_disabled__read_mostly ;#ifdef CONFIG_X86_NEW_MCE
@@ -76,19 +76,19 @@ DEFINE_PER_CPU(unsigned, mce_exception_count);* 2: SIGBUS or log uncorrected errors (if possible), log corrected errors * 3: never panic or SIGBUS, log all errors (for testing only) */ -static int tolerant =1 ; -static int banks; -static u64 *bank; -static unsigned long notify_user; -static int rip_msr; -static int mce_bootlog =-1 ; -static int monarch_timeout =-1 ; -static int mce_panic_timeout; -static int mce_dont_log_ce; -int mce_cmci_disabled; -int mce_ignore_ce; -int mce_ser; +static int tolerant__read_mostly =1 ; +static int banks__read_mostly ; +static u64 *bank__read_mostly ; +static int rip_msr__read_mostly ; +static int mce_bootlog__read_mostly =-1 ; +static int monarch_timeout__read_mostly =-1 ; +static int mce_panic_timeout__read_mostly ; +static int mce_dont_log_ce__read_mostly ; +int mce_cmci_disabled__read_mostly ; +int mce_ignore_ce__read_mostly ; +int mce_ser__read_mostly ; +static unsigned long notify_user;static char trigger[128 ];static char *trigger_argv[2 ] = { trigger,NULL };
Signature · 1 line
1.6.3
PATCH 4/16 x86, mce: rename static variables around trigger
In reply to Hidetoshi Seto"trigger" is not straight forward name for valiable that holds name of user mode helper program which triggered by machine check events.
This patch renames this valiable and kins to more recognizable names.
trigger => mce_helper
trigger_argv => mce_helper_argv
notify_user => mce_need_notify
No functional changes.
--- arch/x86/kernel/cpu/mcheck/mce.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +14 -13
@@ -88,9 +88,10 @@ int mce_cmci_disabled __read_mostly;int mce_ignore_ce__read_mostly ;int mce_ser__read_mostly ; -static unsigned long notify_user; -static char trigger[128 ]; -static char *trigger_argv[2 ] = { trigger,NULL }; +/* User mode helper program triggered by machine check event */ +static unsigned long mce_need_notify; +static char mce_helper[128 ]; +static char *mce_helper_argv[2 ] = { mce_helper,NULL };static unsigned long dont_init_banks;
@@ -180,7 +181,7 @@ void mce_log(struct mce *mce)wmb (); mce->finished =1 ; -set_bit (0 , ¬ify_user); +set_bit (0 , &mce_need_notify); }static void print_mce (struct mce *m)
@@ -1115,7 +1116,7 @@ static void mcheck_timer(unsigned long data)static void mce_do_trigger (struct work_struct *work) { -call_usermodehelper (trigger, trigger_argv,NULL ,UMH_NO_WAIT ); +call_usermodehelper (mce_helper, mce_helper_argv,NULL ,UMH_NO_WAIT ); } static DECLARE_WORK(mce_trigger_work, mce_do_trigger);
@@ -1132,7 +1133,7 @@ int mce_notify_irq(void)clear_thread_flag (TIF_MCE_NOTIFY ); -if (test_and_clear_bit (0 , ¬ify_user)) { +if (test_and_clear_bit (0 , &mce_need_notify)) {wake_up_interruptible (&mce_wait);/*
@@ -1140,7 +1141,7 @@ int mce_notify_irq(void)* work_pending is always cleared before the function is * executed. */ -if (trigger[0 ] && !work_pending (&mce_trigger_work)) +if (mce_helper[0 ] && !work_pending (&mce_trigger_work))schedule_work (&mce_trigger_work);if (__ratelimit (&ratelimit))
@@ -1657,9 +1658,9 @@ static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,static ssize_t show_trigger (struct sys_device *s,struct sysdev_attribute *attr,char *buf) { -strcpy (buf, trigger); +strcpy (buf, mce_helper);strcat (buf,"\n" ); -return strlen (trigger) +1 ; +return strlen (mce_helper) +1 ; } static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
@@ -1668,10 +1669,10 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,char *p;int len; -strncpy (trigger, buf,sizeof (trigger)); - trigger[sizeof (trigger)-1 ] =0 ; - len =strlen (trigger); - p =strchr (trigger,'\n' ); +strncpy (mce_helper, buf,sizeof (mce_helper)); + mce_helper[sizeof (mce_helper)-1 ] =0 ; + len =strlen (mce_helper); + p =strchr (mce_helper,'\n' );if (*p) *p =0 ;
Signature · 1 line
1.6.3
PATCH 5/16 x86, mce: sysfs entries for new options
In reply to Hidetoshi SetoAdd sysfs interface for admins who want to tweak these options without rebooting the system.
--- arch/x86/kernel/cpu/mcheck/mce.c | 84 +++++++++++++++++++++++++++++++++++++- 1 files changed, 83 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +83 -1
@@ -1619,6 +1619,26 @@ static void mce_restart(void)on_each_cpu (mce_cpu_restart,NULL ,1 ); } +/* Toggle features for corrected errors */ +static void mce_disable_ce (void *all) +{ +if (!mce_available (¤t_cpu_data)) +return ; +if (all) +del_timer_sync (&__get_cpu_var (mce_timer)); +cmci_clear (); +} + +static void mce_enable_ce (void *all) +{ +if (!mce_available (¤t_cpu_data)) +return ; +cmci_reenable (); +cmci_recheck (); +if (all) +mce_init_timer (); +} +static struct sysdev_class mce_sysclass = { .suspend = mce_suspend, .shutdown = mce_shutdown,
@@ -1680,6 +1700,52 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,return len; } +static ssize_t set_ignore_ce (struct sys_device *s, +struct sysdev_attribute *attr, +const char *buf,size_t size) +{ +u64 new; + +if (strict_strtoull (buf,0 , &new) <0 ) +return -EINVAL ; + +if (mce_ignore_ce ^ !!new) { +if (new) { +/* disable ce features */ +on_each_cpu (mce_disable_ce, (void *)1 ,1 ); + mce_ignore_ce =1 ; + }else { +/* enable ce features */ + mce_ignore_ce =0 ; +on_each_cpu (mce_enable_ce, (void *)1 ,1 ); + } + } +return size; +} + +static ssize_t set_cmci_disabled (struct sys_device *s, +struct sysdev_attribute *attr, +const char *buf,size_t size) +{ +u64 new; + +if (strict_strtoull (buf,0 , &new) <0 ) +return -EINVAL ; + +if (mce_cmci_disabled ^ !!new) { +if (new) { +/* disable cmci */ +on_each_cpu (mce_disable_ce,NULL ,1 ); + mce_cmci_disabled =1 ; + }else { +/* enable cmci */ + mce_cmci_disabled =0 ; +on_each_cpu (mce_enable_ce,NULL ,1 ); + } + } +return size; +} +static ssize_t store_int_with_restart (struct sys_device *s,struct sysdev_attribute *attr,const char *buf,size_t size)
@@ -1692,6 +1758,7 @@ static ssize_t store_int_with_restart(struct sys_device *s, static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); +static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);static struct sysdev_ext_attribute attr_check_interval = { _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int,
@@ -1699,9 +1766,24 @@ static struct sysdev_ext_attribute attr_check_interval = { &check_interval }; +static struct sysdev_ext_attribute attr_ignore_ce = { +_SYSDEV_ATTR (ignore_ce,0644 , sysdev_show_int, set_ignore_ce), + &mce_ignore_ce +}; + +static struct sysdev_ext_attribute attr_cmci_disabled = { +_SYSDEV_ATTR (ignore_ce,0644 , sysdev_show_int, set_cmci_disabled), + &mce_cmci_disabled +}; +static struct sysdev_attribute *mce_attrs[] = { - &attr_tolerant.attr, &attr_check_interval.attr, &attr_trigger, + &attr_tolerant.attr, + &attr_check_interval.attr, + &attr_trigger, &attr_monarch_timeout.attr, + &attr_dont_log_ce.attr, + &attr_ignore_ce.attr, + &attr_cmci_disabled.attr,NULL };
Signature · 1 line
1.6.3
PATCH 6/16 x86, mce: unify mce.h
In reply to Hidetoshi SetoThere are 2 headers:
arch/x86/include/asm/mce.h arch/x86/kernel/cpu/mcheck/mce.h and in the latter small header: #include <asm/mce.h>
This patch move all contents in the latter header into the former, and fix all files using the latter to include the former instead.
--- arch/x86/include/asm/mce.h | 36 +++++++++++++++++++++++++- arch/x86/kernel/cpu/mcheck/k7.c | 3 +- arch/x86/kernel/cpu/mcheck/mce.c | 1 - arch/x86/kernel/cpu/mcheck/mce.h | 38 ----------------------------- arch/x86/kernel/cpu/mcheck/mce_intel.c | 3 +- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 2 - arch/x86/kernel/cpu/mcheck/non-fatal.c | 3 +- arch/x86/kernel/cpu/mcheck/p4.c | 3 +- arch/x86/kernel/cpu/mcheck/p5.c | 3 +- arch/x86/kernel/cpu/mcheck/p6.c | 3 +- arch/x86/kernel/cpu/mcheck/winchip.c | 3 +- arch/x86/kernel/traps.c | 3 +- 12 files changed, 42 insertions(+), 59 deletions(-) delete mode 100644 arch/x86/kernel/cpu/mcheck/mce.h
arch/x86/include/asm/mce.h +34 -2
@@ -102,10 +102,42 @@ struct mce_log {#ifdef __KERNEL__ +#include <linux/percpu.h> +#include <linux/init.h> +#include <asm/atomic.h> +extern int mce_disabled; -#include <asm/atomic.h> -#include <linux/percpu.h> +#ifdef CONFIG_X86_OLD_MCE +void amd_mcheck_init (struct cpuinfo_x86 *c); +void intel_p4_mcheck_init (struct cpuinfo_x86 *c); +void intel_p6_mcheck_init (struct cpuinfo_x86 *c); +#endif + +#ifdef CONFIG_X86_ANCIENT_MCE +void intel_p5_mcheck_init (struct cpuinfo_x86 *c); +void winchip_mcheck_init (struct cpuinfo_x86 *c); +extern int mce_p5_enable; +static inline int mce_p5_enabled (void ) {return mce_p5_enable; } +static inline void enable_p5_mce (void ) { mce_p5_enable =1 ; } +#else +static inline void intel_p5_mcheck_init (struct cpuinfo_x86 *c) {} +static inline void winchip_mcheck_init (struct cpuinfo_x86 *c) {} +static inline int mce_p5_enabled (void ) {return 0 ; } +static inline void enable_p5_mce (void ) { } +#endif + +/* Call the installed machine check handler for this CPU setup. */ +extern void (*machine_check_vector)(struct pt_regs *,long error_code); + +#ifdef CONFIG_X86_OLD_MCE +extern int nr_mce_banks; +extern void intel_set_thermal_handler (void ); +#else +static inline void intel_set_thermal_handler (void ) { } +#endif + +void intel_init_thermal (struct cpuinfo_x86 *c);void mce_setup (struct mce *m);void mce_log (struct mce *m);
arch/x86/kernel/cpu/mcheck/k7.c +1 -2
@@ -10,10 +10,9 @@#include <asm/processor.h> #include <asm/system.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -/* Machine Check Handler For AMD Athlon/Duron: */ static void k7_machine_check (struct pt_regs *regs,long error_code) {
arch/x86/kernel/cpu/mcheck/mce.c +0 -1
@@ -44,7 +44,6 @@#include <asm/msr.h> #include "mce-internal.h" -#include "mce.h" /* Handle unconfigured int18 (should never happen) */ static void unexpected_machine_check (struct pt_regs *regs,long error_code)
arch/x86/kernel/cpu/mcheck/mce.h deleted +0 -38
@@ -1,38 +0,0 @@ -#include <linux/init.h> -#include <asm/mce.h> - -#ifdef CONFIG_X86_OLD_MCE -void amd_mcheck_init (struct cpuinfo_x86 *c); -void intel_p4_mcheck_init (struct cpuinfo_x86 *c); -void intel_p6_mcheck_init (struct cpuinfo_x86 *c); -#endif - -#ifdef CONFIG_X86_ANCIENT_MCE -void intel_p5_mcheck_init (struct cpuinfo_x86 *c); -void winchip_mcheck_init (struct cpuinfo_x86 *c); -extern int mce_p5_enable; -static inline int mce_p5_enabled (void ) {return mce_p5_enable; } -static inline void enable_p5_mce (void ) { mce_p5_enable =1 ; } -#else -static inline void intel_p5_mcheck_init (struct cpuinfo_x86 *c) {} -static inline void winchip_mcheck_init (struct cpuinfo_x86 *c) {} -static inline int mce_p5_enabled (void ) {return 0 ; } -static inline void enable_p5_mce (void ) { } -#endif - -/* Call the installed machine check handler for this CPU setup. */ -extern void (*machine_check_vector)(struct pt_regs *,long error_code); - -#ifdef CONFIG_X86_OLD_MCE - -extern int nr_mce_banks; - -void intel_set_thermal_handler (void ); - -#else - -static inline void intel_set_thermal_handler (void ) { } - -#endif - -void intel_init_thermal (struct cpuinfo_x86 *c);
arch/x86/kernel/cpu/mcheck/mce_intel.c +1 -2
@@ -11,10 +11,9 @@#include <asm/processor.h> #include <asm/system.h> #include <asm/apic.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -void intel_init_thermal (struct cpuinfo_x86 *c) {unsigned int cpu =smp_processor_id ();
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +0 -2
@@ -16,8 +16,6 @@#include <asm/idle.h> #include <asm/therm_throt.h> -#include "mce.h" - asmlinkage void smp_thermal_interrupt(void) {__u64 msr_val;
arch/x86/kernel/cpu/mcheck/non-fatal.c +1 -2
@@ -17,10 +17,9 @@#include <asm/processor.h> #include <asm/system.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -static int firstbank;#define MCE_RATE (15*HZ)/* timer rate is 15s */
arch/x86/kernel/cpu/mcheck/p4.c +1 -2
@@ -12,10 +12,9 @@#include <asm/processor.h> #include <asm/system.h> #include <asm/apic.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -/* as supported by the P4/Xeon family */ struct intel_mce_extended_msrs {u32 eax;
arch/x86/kernel/cpu/mcheck/p5.c +1 -2
@@ -10,10 +10,9 @@#include <asm/processor.h> #include <asm/system.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -/* By default disabled */ int mce_p5_enable;
arch/x86/kernel/cpu/mcheck/p6.c +1 -2
@@ -10,10 +10,9 @@#include <asm/processor.h> #include <asm/system.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -/* Machine Check Handler For PII/PIII */ static void intel_machine_check (struct pt_regs *regs,long error_code) {
arch/x86/kernel/cpu/mcheck/winchip.c +1 -2
@@ -9,10 +9,9 @@#include <asm/processor.h> #include <asm/system.h> +#include <asm/mce.h> #include <asm/msr.h> -#include "mce.h" -/* Machine check handler for WinChip C6: */ static void winchip_machine_check (struct pt_regs *regs,long error_code) {
arch/x86/kernel/traps.c +1 -2
@@ -53,6 +53,7 @@#include <asm/traps.h> #include <asm/desc.h> #include <asm/i387.h> +#include <asm/mce.h> #include <asm/mach_traps.h>
@@ -64,8 +65,6 @@#include <asm/setup.h> #include <asm/traps.h> -#include "cpu/mcheck/mce.h" - asmlinkage int system_call(void);/* Do we ignore FPU interrupts ? */
Signature · 1 line
1.6.3
PATCH 7/16 x86, mce: make mce_disabled boolean
In reply to Hidetoshi SetoThe mce_disabled on 32bit is a tristate variable [1,0,-1], while 64bit version is boolean [0,1].
This patch makes mce_disabled always boolean, and use mce_p5_enabled to indicate the third state instead.
--- arch/x86/include/asm/mce.h | 8 +++----- arch/x86/kernel/cpu/mcheck/mce.c | 8 +++----- arch/x86/kernel/cpu/mcheck/p5.c | 12 +++++------- 3 files changed, 11 insertions(+), 17 deletions(-)
arch/x86/include/asm/mce.h +3 -5
@@ -107,6 +107,7 @@ struct mce_log {#include <asm/atomic.h> extern int mce_disabled; +extern int mce_p5_enabled;#ifdef CONFIG_X86_OLD_MCE void amd_mcheck_init (struct cpuinfo_x86 *c);
@@ -117,14 +118,11 @@ void intel_p6_mcheck_init(struct cpuinfo_x86 *c);#ifdef CONFIG_X86_ANCIENT_MCE void intel_p5_mcheck_init (struct cpuinfo_x86 *c);void winchip_mcheck_init (struct cpuinfo_x86 *c); -extern int mce_p5_enable; -static inline int mce_p5_enabled (void ) {return mce_p5_enable; } -static inline void enable_p5_mce (void ) { mce_p5_enable =1 ; } +static inline void enable_p5_mce (void ) { mce_p5_enabled =1 ; }#else static inline void intel_p5_mcheck_init (struct cpuinfo_x86 *c) {}static inline void winchip_mcheck_init (struct cpuinfo_x86 *c) {} -static inline int mce_p5_enabled (void ) {return 0 ; } -static inline void enable_p5_mce (void ) { } +static inline void enable_p5_mce (void ) {}#endif /* Call the installed machine check handler for this CPU setup. */
arch/x86/kernel/cpu/mcheck/mce.c +3 -5
@@ -1279,8 +1279,7 @@ static void __cpuinit mce_ancient_init(struct cpuinfo_x86 *c)return ;switch (c->x86_vendor) {case X86_VENDOR_INTEL : -if (mce_p5_enabled ()) -intel_p5_mcheck_init (c); +intel_p5_mcheck_init (c);break ;case X86_VENDOR_CENTAUR :winchip_mcheck_init (c);
@@ -1995,7 +1994,7 @@ EXPORT_SYMBOL_GPL(nr_mce_banks); /* non-fatal.o *//* This has to be run for each processor */ void mcheck_init (struct cpuinfo_x86 *c) { -if (mce_disabled ==1 ) +if (mce_disabled)return ;switch (c->x86_vendor) {
@@ -2025,10 +2024,9 @@ void mcheck_init(struct cpuinfo_x86 *c)static int __init mcheck_enable (char *str) { - mce_disabled =-1 ; + mce_p5_enabled =1 ;return 1 ; } -__setup ("mce" , mcheck_enable);#endif /* CONFIG_X86_OLD_MCE */
arch/x86/kernel/cpu/mcheck/p5.c +5 -7
@@ -14,7 +14,7 @@#include <asm/msr.h> /* By default disabled */ -int mce_p5_enable; +int mce_p5_enabled__read_mostly ;/* Machine check handler for Pentium class Intel CPUs: */ static void pentium_machine_check (struct pt_regs *regs,long error_code)
@@ -42,15 +42,13 @@ void intel_p5_mcheck_init(struct cpuinfo_x86 *c) {u32 l, h; -/* Check for MCE support: */ -if (!cpu_has (c,X86_FEATURE_MCE )) +/* Default P5 to off as its often misconnected: */ +if (!mce_p5_enabled)return ; -#ifdef CONFIG_X86_OLD_MCE -/* Default P5 to off as its often misconnected: */ -if (mce_disabled !=-1 ) +/* Check for MCE support: */ +if (!cpu_has (c,X86_FEATURE_MCE ))return ; -#endif machine_check_vector = pentium_machine_check;/* Make sure the vector pointer is visible before we enable MCEs: */
Signature · 1 line
1.6.3
PATCH 8/16 x86, mce: unify smp_thermal_interrupt, prepare p4
In reply to Hidetoshi SetoRemove unused argument regs from handlers, and use inc_irq_stat.
--- arch/x86/kernel/cpu/mcheck/p4.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mcheck/p4.c +5 -6
@@ -35,7 +35,7 @@ static int mce_num_extended_msrs;#ifdef CONFIG_X86_MCE_P4THERMAL -static void unexpected_thermal_interrupt (struct pt_regs *regs) +static void unexpected_thermal_interrupt (void ) {printk (KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n" ,smp_processor_id ());
@@ -43,7 +43,7 @@ static void unexpected_thermal_interrupt(struct pt_regs *regs) }/* P4/Xeon Thermal transition interrupt handler: */ -static void intel_thermal_interrupt (struct pt_regs *regs) +static void intel_thermal_interrupt (void ) {__u64 msr_val;
@@ -54,14 +54,13 @@ static void intel_thermal_interrupt(struct pt_regs *regs) }/* Thermal interrupt handler for this CPU setup: */ -static void (*vendor_thermal_interrupt)(struct pt_regs *regs) = - unexpected_thermal_interrupt; +static void (*vendor_thermal_interrupt)(void ) = unexpected_thermal_interrupt;void smp_thermal_interrupt (struct pt_regs *regs) {irq_enter (); -vendor_thermal_interrupt (regs); -__get_cpu_var (irq_stat).irq_thermal_count++; +vendor_thermal_interrupt (); +inc_irq_stat (irq_thermal_count);irq_exit (); }
Signature · 1 line
1.6.3
PATCH 9/16 x86, mce: unify smp_thermal_interrupt, prepare mce_intel_64
In reply to Hidetoshi SetoDivide it into two functions.
--- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +8 -6
@@ -16,19 +16,21 @@#include <asm/idle.h> #include <asm/therm_throt.h> -asmlinkage void smp_thermal_interrupt(void) +static void intel_thermal_interrupt (void ) {__u64 msr_val; -ack_APIC_irq (); - -exit_idle (); -irq_enter (); -rdmsrl (MSR_IA32_THERM_STATUS , msr_val);if (therm_throt_process (msr_val &THERM_STATUS_PROCHOT ))mce_log_therm_throt_event (msr_val); +} +asmlinkage void smp_thermal_interrupt(void) +{ +ack_APIC_irq (); +exit_idle (); +irq_enter (); +intel_thermal_interrupt ();inc_irq_stat (irq_thermal_count);irq_exit (); }
Signature · 1 line
1.6.3
PATCH 10/16 x86, mce: unify smp_thermal_interrupt, prepare
In reply to Hidetoshi SetoLet them in same shape.
--- arch/x86/include/asm/mce.h | 25 ++++++++++++++----------- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 20 ++++++++++++++++++-- arch/x86/kernel/cpu/mcheck/p4.c | 10 ++++++---- 3 files changed, 38 insertions(+), 17 deletions(-)
arch/x86/include/asm/mce.h +14 -11
@@ -110,6 +110,7 @@ extern int mce_disabled;extern int mce_p5_enabled;#ifdef CONFIG_X86_OLD_MCE +extern int nr_mce_banks;void amd_mcheck_init (struct cpuinfo_x86 *c);void intel_p4_mcheck_init (struct cpuinfo_x86 *c);void intel_p6_mcheck_init (struct cpuinfo_x86 *c);
@@ -128,15 +129,6 @@ static inline void enable_p5_mce(void) {}/* Call the installed machine check handler for this CPU setup. */ extern void (*machine_check_vector)(struct pt_regs *,long error_code); -#ifdef CONFIG_X86_OLD_MCE -extern int nr_mce_banks; -extern void intel_set_thermal_handler (void ); -#else -static inline void intel_set_thermal_handler (void ) { } -#endif - -void intel_init_thermal (struct cpuinfo_x86 *c); -void mce_setup (struct mce *m);void mce_log (struct mce *m); DECLARE_PER_CPU(struct sys_device, mce_dev);
@@ -175,8 +167,6 @@ int mce_available(struct cpuinfo_x86 *c);DECLARE_PER_CPU (unsigned, mce_exception_count);DECLARE_PER_CPU (unsigned, mce_poll_count); -void mce_log_therm_throt_event (__u64 status); -extern atomic_t mce_entry;void do_machine_check (struct pt_regs *,long );
@@ -205,5 +195,18 @@ void mcheck_init(struct cpuinfo_x86 *c);extern void (*mce_threshold_vector)(void ); +/* +* Thermal handler +*/ + +void intel_set_thermal_handler (void ); +void intel_init_thermal (struct cpuinfo_x86 *c); + +#ifdef CONFIG_X86_NEW_MCE +void mce_log_therm_throt_event (__u64 status); +#else +static inline void mce_log_therm_throt_event (__u64 status) {} +#endif +#endif /* __KERNEL__ */ #endif /* _ASM_X86_MCE_H */
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +18 -2
@@ -16,6 +16,14 @@#include <asm/idle.h> #include <asm/therm_throt.h> +static void unexpected_thermal_interrupt (void ) +{ +printk (KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n" , +smp_processor_id ()); +add_taint (TAINT_MACHINE_CHECK ); +} + +/* P4/Xeon Thermal transition interrupt handler: */ static void intel_thermal_interrupt (void ) {__u64 msr_val;
@@ -25,14 +33,22 @@ static void intel_thermal_interrupt(void)mce_log_therm_throt_event (msr_val); } +/* Thermal interrupt handler for this CPU setup: */ +static void (*vendor_thermal_interrupt)(void ) = unexpected_thermal_interrupt; + asmlinkage void smp_thermal_interrupt(void) { -ack_APIC_irq ();exit_idle ();irq_enter (); -intel_thermal_interrupt ();inc_irq_stat (irq_thermal_count); +intel_thermal_interrupt ();irq_exit (); +ack_APIC_irq (); +} + +void intel_set_thermal_handler (void ) +{ + vendor_thermal_interrupt = intel_thermal_interrupt; }/*
arch/x86/kernel/cpu/mcheck/p4.c +6 -4
@@ -12,6 +12,7 @@#include <asm/processor.h> #include <asm/system.h> #include <asm/apic.h> +#include <asm/idle.h> #include <asm/mce.h> #include <asm/msr.h>
@@ -47,10 +48,9 @@ static void intel_thermal_interrupt(void) {__u64 msr_val; -ack_APIC_irq (); -rdmsrl (MSR_IA32_THERM_STATUS , msr_val); -therm_throt_process (msr_val &THERM_STATUS_PROCHOT ); +if (therm_throt_process (msr_val &THERM_STATUS_PROCHOT )) +mce_log_therm_throt_event (msr_val); }/* Thermal interrupt handler for this CPU setup: */
@@ -58,10 +58,12 @@ static void (*vendor_thermal_interrupt)(void) = unexpected_thermal_interrupt;void smp_thermal_interrupt (struct pt_regs *regs) { +exit_idle ();irq_enter (); -vendor_thermal_interrupt ();inc_irq_stat (irq_thermal_count); +vendor_thermal_interrupt ();irq_exit (); +ack_APIC_irq (); }void intel_set_thermal_handler (void )
Signature · 1 line
1.6.3
PATCH 11/16 x86, mce: unify smp_thermal_interrupt
In reply to Hidetoshi SetoPut common functions into therm_throt.c, modify Makefile.
unexpected_thermal_interrupt
intel_thermal_interrupt
smp_thermal_interrupt
intel_set_thermal_handler
--- arch/x86/kernel/cpu/mcheck/Makefile | 7 ++-- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 38 ------------------------ arch/x86/kernel/cpu/mcheck/p4.c | 45 ----------------------------- arch/x86/kernel/cpu/mcheck/therm_throt.c | 40 +++++++++++++++++++++++++- 4 files changed, 43 insertions(+), 87 deletions(-)
arch/x86/kernel/cpu/mcheck/Makefile +4 -3
@@ -1,11 +1,12 @@ -obj-y = mce.o therm_throt.o +obj-y = mce.o obj-$(CONFIG_X86_NEW_MCE) += mce-severity.o obj-$(CONFIG_X86_OLD_MCE) += k7.o p4.o p6.o obj-$(CONFIG_X86_ANCIENT_MCE) += winchip.o p5.o -obj-$(CONFIG_X86_MCE_P4THERMAL) += mce_intel.o -obj-$(CONFIG_X86_MCE_INTEL) += mce_intel_64.o mce_intel.o +obj-$(CONFIG_X86_MCE_INTEL) += mce_intel_64.o obj-$(CONFIG_X86_MCE_AMD) += mce_amd_64.o obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o + +obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o mce_intel.o
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +0 -38
@@ -9,48 +9,10 @@#include <linux/interrupt.h> #include <linux/percpu.h> #include <asm/processor.h> -#include <asm/apic.h> #include <asm/msr.h> #include <asm/mce.h> -#include <asm/hw_irq.h> -#include <asm/idle.h> #include <asm/therm_throt.h> -static void unexpected_thermal_interrupt (void ) -{ -printk (KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n" , -smp_processor_id ()); -add_taint (TAINT_MACHINE_CHECK ); -} - -/* P4/Xeon Thermal transition interrupt handler: */ -static void intel_thermal_interrupt (void ) -{ -__u64 msr_val; - -rdmsrl (MSR_IA32_THERM_STATUS , msr_val); -if (therm_throt_process (msr_val &THERM_STATUS_PROCHOT )) -mce_log_therm_throt_event (msr_val); -} - -/* Thermal interrupt handler for this CPU setup: */ -static void (*vendor_thermal_interrupt)(void ) = unexpected_thermal_interrupt; - -asmlinkage void smp_thermal_interrupt(void) -{ -exit_idle (); -irq_enter (); -inc_irq_stat (irq_thermal_count); -intel_thermal_interrupt (); -irq_exit (); -ack_APIC_irq (); -} - -void intel_set_thermal_handler (void ) -{ - vendor_thermal_interrupt = intel_thermal_interrupt; -} -/* * Support for Intel Correct Machine Check Interrupts. This allows * the CPU to raise an interrupt when a corrected machine check happened.
arch/x86/kernel/cpu/mcheck/p4.c +0 -45
63 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/therm_throt.c +39 -1
@@ -13,6 +13,7 @@* Credits: Adapted from Zwane Mwaikambo's original code in mce_intel.c. * Inspired by Ross Biro's and Al Borchers' counter code. */ +#include <linux/interrupt.h> #include <linux/notifier.h> #include <linux/jiffies.h> #include <linux/percpu.h>
@@ -20,6 +21,8 @@#include <linux/cpu.h> #include <asm/therm_throt.h> +#include <asm/idle.h> +#include <asm/mce.h> /* How long to wait between reporting thermal events */ #define CHECK_INTERVAL (300 * HZ)
@@ -186,6 +189,41 @@ static __init int thermal_throttle_init_device(void)return 0 ; } -device_initcall (thermal_throttle_init_device); +#endif /* CONFIG_SYSFS */ + +/* Thermal transition interrupt handler */ +void intel_thermal_interrupt (void ) +{ +__u64 msr_val; + +rdmsrl (MSR_IA32_THERM_STATUS , msr_val); +if (therm_throt_process (msr_val &THERM_STATUS_PROCHOT )) +mce_log_therm_throt_event (msr_val); +} + +static void unexpected_thermal_interrupt (void ) +{ +printk (KERN_ERR "CPU%d: Unexpected LVT TMR interrupt!\n" , +smp_processor_id ()); +add_taint (TAINT_MACHINE_CHECK ); +} + +static void (*smp_thermal_vector)(void ) = unexpected_thermal_interrupt; + +asmlinkage void smp_thermal_interrupt(struct pt_regs *regs) +{ +exit_idle (); +irq_enter (); +inc_irq_stat (irq_thermal_count); +smp_thermal_vector (); +irq_exit (); +/* Ack only at the end to avoid potential reentry */ +ack_APIC_irq (); +} + +void intel_set_thermal_handler (void ) +{ + smp_thermal_vector = intel_thermal_interrupt; +}
Signature · 1 line
1.6.3
PATCH 12/16 x86, mce: squash mce_intel.c into therm_throt.c
In reply to Hidetoshi Setomove intel_init_thermal() into therm_throt.c
--- arch/x86/kernel/cpu/mcheck/Makefile | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 73 ------------------------------ arch/x86/kernel/cpu/mcheck/therm_throt.c | 66 +++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 74 deletions(-) delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel.c
arch/x86/kernel/cpu/mcheck/Makefile +1 -1
@@ -9,4 +9,4 @@ obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o -obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o mce_intel.o +obj-$(CONFIG_X86_THERMAL_VECTOR) += therm_throt.o
arch/x86/kernel/cpu/mcheck/mce_intel.c deleted +0 -73
73 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/therm_throt.c +66 -0
82 lines not on this page · raw message
Signature · 1 line
1.6.3
Re: [PATCH 12/16] x86, mce: squash mce_intel.c into therm_throt.c
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 9 lines
move
intel_init_thermal()intotherm_throt.cSigned-off-by Hidetoshi Seto <[email protected]>---
arch/x86/kernel/cpu/mcheck/Makefile | 2 +-arch/x86/kernel/cpu/mcheck/mce_intel.c| 73 ------------------------------arch/x86/kernel/cpu/mcheck/therm_throt.c| 66 +++++++++++++++++++++++++++3 files changed, 67 insertions(+), 74 deletions(-)delete mode 100644
arch/x86/kernel/cpu/mcheck/mce_intel.c
Why we need this patch? I think the design principle behind MCE is to separate vendor/cpu specific code into different files. At least #ifdef CONFIG_X86_MCE_INTEL should be used around moved code.
Best Regards,
Huang Ying
Re: [PATCH 12/16] x86, mce: squash mce_intel.c into therm_throt.c
Quoted 11 lines · huang ying
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 9 lines
move
intel_init_thermal()intotherm_throt.cSigned-off-by Hidetoshi Seto <[email protected]>--- arch/x86/kernel/cpu/mcheck/Makefile | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 73 ------------------------------ arch/x86/kernel/cpu/mcheck/therm_throt.c | 66 +++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 74 deletions(-) delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel.c
Quoted 3 lines
Why we need this patch? I think the design principle behind MCE is to separate vendor/cpu specific code into different files. At least #ifdef
CONFIG_X86_MCE_INTELshould be used around moved code.
Because at this time there are no vendor other than Intel that uses thermal codes here. I don't know much about AMD, whether there are any plan to implement AMD specific thermal codes or not, and why they have to make such specific thing here in future (patent?).
You can pull out "codes may not be shared" from therm_throt.c and put it again into mce_intel.c (that was mce_intel_64.c). But I believe it is not needed now, until another code is available. Or you can rename therm_throt.c to thermal_intel.c or so for a while.
(BTW, now CONFIG_X86_MCE_INTEL enables both of cmci and thermal,
are there possible option to disable thermal while cmci is on?)
Thanks.
H.Seto
Re: [PATCH 12/16] x86, mce: squash mce_intel.c into therm_throt.c
Quoted 21 lines · Hidetoshi Seto
Quoted 11 lines · huang ying
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 9 lines
move
intel_init_thermal()intotherm_throt.cSigned-off-by Hidetoshi Seto <[email protected]>---
arch/x86/kernel/cpu/mcheck/Makefile | 2 +-arch/x86/kernel/cpu/mcheck/mce_intel.c| 73 ------------------------------arch/x86/kernel/cpu/mcheck/therm_throt.c| 66 +++++++++++++++++++++++++++3 files changed, 67 insertions(+), 74 deletions(-)delete mode 100644
arch/x86/kernel/cpu/mcheck/mce_intel.cQuoted 3 lines
Why we need this patch? I think the design principle behind MCE is to separate vendor/cpu specific code into different files. At least #ifdef
CONFIG_X86_MCE_INTELshould be used around moved code.Because at this time there are no vendor other than Intel that uses thermal codes here. I don't know much about AMD, whether there are any plan to implement AMD specific thermal codes or not, and why they have to make such specific thing here in future (patent?).
Quoted 4 lines
You can pull out "codes may not be shared" from
therm_throt.cand put it again intomce_intel.c(that wasmce_intel_64.c). But I believe it is not needed now, until another code is available. Or you can renametherm_throt.ctothermal_intel.cor so for a while.
I think thermal_intel.c is better.
Best Regards,
Huang Ying
H. Peter Anvin
reviewerRe: [PATCH 12/16] x86, mce: squash mce_intel.c into therm_throt.c
Quoted 8 lines · huang ying
Quoted 5 lines
You can pull out "codes may not be shared" from
therm_throt.cand put it again intomce_intel.c(that wasmce_intel_64.c). But I believe it is not needed now, until another code is available. Or you can renametherm_throt.ctothermal_intel.cor so for a while.I think
thermal_intel.cis better.
Actually intel_thermal.c and intel_cmci.c would probably be the right naming. The mce_ prefix for files in this directory is redundant; so for vendor-specific features the vendor is the higher order organizing factor.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
H. Peter Anvin
reviewerRe: [PATCH 12/16] x86, mce: squash mce_intel.c into therm_throt.c
In reply to huang yingQuoted 11 lines · huang ying
2009/6/15 Hidetoshi Seto <[email protected]>:
Quoted 9 lines
move
intel_init_thermal()intotherm_throt.cSigned-off-by Hidetoshi Seto <[email protected]>--- arch/x86/kernel/cpu/mcheck/Makefile | 2 +- arch/x86/kernel/cpu/mcheck/mce_intel.c | 73 ------------------------------ arch/x86/kernel/cpu/mcheck/therm_throt.c | 66 +++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 74 deletions(-) delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel.c
Quoted 4 lines
Why we need this patch? I think the design principle behind MCE is to separate vendor/cpu specific code into different files. At least #ifdef
CONFIG_X86_MCE_INTELshould be used around moved code.
Honestly, such a design principle is pretty broken. mce_intel.c contained two completely orthogonal piece of functionality -- CMCI and thermal -- that really should be in different files (and mce_intel.c probably should be renamed cmci.c). Furthermore, using #ifdef for selecting specific code is considered less clean than using the Makefile for this purpose.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
PATCH 13/16 x86, mce: remove intel_set_thermal_handler()
In reply to Hidetoshi Setoand make intel_thermal_interrupt() static.
--- arch/x86/include/asm/mce.h | 1 - arch/x86/kernel/cpu/mcheck/therm_throt.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-)
arch/x86/include/asm/mce.h +0 -1
@@ -199,7 +199,6 @@ extern void (*mce_threshold_vector)(void);* Thermal handler */ -void intel_set_thermal_handler (void );void intel_init_thermal (struct cpuinfo_x86 *c);#ifdef CONFIG_X86_NEW_MCE
arch/x86/kernel/cpu/mcheck/therm_throt.c +2 -7
@@ -202,7 +202,7 @@ device_initcall(thermal_throttle_init_device);#endif /* CONFIG_SYSFS */ /* Thermal transition interrupt handler */ -void intel_thermal_interrupt (void ) +static void intel_thermal_interrupt (void ) {__u64 msr_val;
@@ -231,11 +231,6 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)ack_APIC_irq (); } -void intel_set_thermal_handler (void ) -{ - smp_thermal_vector = intel_thermal_interrupt; -} -void intel_init_thermal (struct cpuinfo_x86 *c) {unsigned int cpu =smp_processor_id ();
@@ -278,7 +273,7 @@ void intel_init_thermal(struct cpuinfo_x86 *c)wrmsr (MSR_IA32_THERM_INTERRUPT , l | (THERM_INT_LOW_ENABLE |THERM_INT_HIGH_ENABLE ), h); -intel_set_thermal_handler (); + smp_thermal_vector = intel_thermal_interrupt;rdmsr (MSR_IA32_MISC_ENABLE , l, h);wrmsr (MSR_IA32_MISC_ENABLE , l |MSR_IA32_MISC_ENABLE_TM1 , h);
Signature · 1 line
1.6.3
PATCH 14/16 x86, mce: remove therm_throt.h
In reply to Hidetoshi SetoNow all symbols in the header are static. Remove the header.
--- arch/x86/include/asm/therm_throt.h | 9 --------- arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 1 - arch/x86/kernel/cpu/mcheck/p4.c | 1 - arch/x86/kernel/cpu/mcheck/therm_throt.c | 5 ++--- 4 files changed, 2 insertions(+), 14 deletions(-) delete mode 100644 arch/x86/include/asm/therm_throt.h
arch/x86/include/asm/therm_throt.h deleted +0 -9
@@ -1,9 +0,0 @@ -#ifndef _ASM_X86_THERM_THROT_H -#define _ASM_X86_THERM_THROT_H - -#include <asm/atomic.h> - -extern atomic_t therm_throt_en; -int therm_throt_process (int curr); - -#endif /* _ASM_X86_THERM_THROT_H */
arch/x86/kernel/cpu/mcheck/mce_intel_64.c +0 -1
@@ -11,7 +11,6 @@#include <asm/processor.h> #include <asm/msr.h> #include <asm/mce.h> -#include <asm/therm_throt.h> /* * Support for Intel Correct Machine Check Interrupts. This allows
arch/x86/kernel/cpu/mcheck/p4.c +0 -1
@@ -6,7 +6,6 @@#include <linux/init.h> #include <linux/smp.h> -#include <asm/therm_throt.h> #include <asm/processor.h> #include <asm/mce.h> #include <asm/msr.h>
arch/x86/kernel/cpu/mcheck/therm_throt.c +2 -3
@@ -24,7 +24,6 @@#include <linux/smp.h> #include <linux/cpu.h> -#include <asm/therm_throt.h> #include <asm/processor.h> #include <asm/system.h> #include <asm/apic.h>
@@ -38,7 +37,7 @@ static DEFINE_PER_CPU(__u64, next_check) = INITIAL_JIFFIES; static DEFINE_PER_CPU(unsigned long, thermal_throttle_count); -atomic_t therm_throt_en =ATOMIC_INIT (0 ); +static atomic_t therm_throt_en =ATOMIC_INIT (0 );#ifdef CONFIG_SYSFS #define define_therm_throt_sysdev_one_ro (_name) \
@@ -93,7 +92,7 @@ static struct attribute_group thermal_throttle_attr_group = {* 1 : Event should be logged further, and a message has been * printed to the syslog. */ -int therm_throt_process (int curr) +static int therm_throt_process (int curr) {unsigned int cpu =smp_processor_id ();__u64 tmp_jiffs =get_jiffies_64 ();
Signature · 1 line
1.6.3
PATCH 15/16 x86, mce: mce.h cleanup
In reply to Hidetoshi SetoReorder definitions.
- static inline dummy mcheck_init() for !CONFIG_X86_MCE
- gather defs for exception, threshold handler
--- arch/x86/include/asm/mce.h | 29 ++++++++++++++++++----------- 1 files changed, 18 insertions(+), 11 deletions(-)
arch/x86/include/asm/mce.h +18 -11
@@ -109,6 +109,12 @@ struct mce_log {extern int mce_disabled;extern int mce_p5_enabled; +#ifdef CONFIG_X86_MCE +void mcheck_init (struct cpuinfo_x86 *c); +#else +static inline void mcheck_init (struct cpuinfo_x86 *c) {} +#endif +#ifdef CONFIG_X86_OLD_MCE extern int nr_mce_banks;void amd_mcheck_init (struct cpuinfo_x86 *c);
@@ -126,13 +132,9 @@ static inline void winchip_mcheck_init(struct cpuinfo_x86 *c) {}static inline void enable_p5_mce (void ) {}#endif -/* Call the installed machine check handler for this CPU setup. */ -extern void (*machine_check_vector)(struct pt_regs *,long error_code); -void mce_setup (struct mce *m);void mce_log (struct mce *m); DECLARE_PER_CPU(struct sys_device, mce_dev); -extern void (*threshold_cpu_callback)(unsigned long action,unsigned int cpu);/* * To support more than 128 would need to escape the predefined
@@ -169,8 +171,6 @@ DECLARE_PER_CPU(unsigned, mce_poll_count);extern atomic_t mce_entry; -void do_machine_check (struct pt_regs *,long ); - typedef DECLARE_BITMAP(mce_banks_t, MAX_NR_BANKS);DECLARE_PER_CPU (mce_banks_t ,mce_poll_banks );
@@ -187,13 +187,20 @@ void mce_notify_process(void); DECLARE_PER_CPU(struct mce, injectm);extern struct file_operations mce_chrdev_ops; -#ifdef CONFIG_X86_MCE -void mcheck_init (struct cpuinfo_x86 *c); -#else -#define mcheck_init (c) do { } while (0) -#endif +/* +* Exception handler +*/ + +/* Call the installed machine check handler for this CPU setup. */ +extern void (*machine_check_vector)(struct pt_regs *,long error_code); +void do_machine_check (struct pt_regs *,long ); + +/* +* Threshold handler +*/ extern void (*mce_threshold_vector)(void ); +extern void (*threshold_cpu_callback)(unsigned long action,unsigned int cpu);/* * Thermal handler
Signature · 1 line
1.6.3
PATCH 16/16 x86, mce: rename
In reply to Hidetoshi SetoRename files that are no longer 64bit specific:
mce_amd_64.c => mce_amd.c mce_intel_64.c => mce_intel.c
--- arch/x86/kernel/cpu/mcheck/Makefile | 4 +- arch/x86/kernel/cpu/mcheck/mce_amd.c | 703 +++++++++++++++++++++++++++++ arch/x86/kernel/cpu/mcheck/mce_amd_64.c | 703 ----------------------------- arch/x86/kernel/cpu/mcheck/mce_intel.c | 225 +++++++++ arch/x86/kernel/cpu/mcheck/mce_intel_64.c | 225 --------- 5 files changed, 930 insertions(+), 930 deletions(-) create mode 100644 arch/x86/kernel/cpu/mcheck/mce_amd.c delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_amd_64.c create mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel.c delete mode 100644 arch/x86/kernel/cpu/mcheck/mce_intel_64.c
arch/x86/kernel/cpu/mcheck/Makefile +2 -2
@@ -3,8 +3,8 @@ obj-y = mce.o obj-$(CONFIG_X86_NEW_MCE) += mce-severity.o obj-$(CONFIG_X86_OLD_MCE) += k7.o p4.o p6.o obj-$(CONFIG_X86_ANCIENT_MCE) += winchip.o p5.o -obj-$(CONFIG_X86_MCE_INTEL) += mce_intel_64.o -obj-$(CONFIG_X86_MCE_AMD) += mce_amd_64.o +obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o +obj-$(CONFIG_X86_MCE_AMD) += mce_amd.o obj-$(CONFIG_X86_MCE_NONFATAL) += non-fatal.o obj-$(CONFIG_X86_MCE_THRESHOLD) += threshold.o obj-$(CONFIG_X86_MCE_INJECT) += mce-inject.o
arch/x86/kernel/cpu/mcheck/mce_amd.c new file +703 -0
703 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/mce_amd_64.c deleted +0 -703
703 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/mce_intel.c new file +225 -0
225 lines not on this page · raw message
arch/x86/kernel/cpu/mcheck/mce_intel_64.c deleted +0 -225
225 lines not on this page · raw message
Signature · 1 line
1.6.3