x86/mce: timer must be setup unconditionally
PATCH 1/1 x86/mce: timer must be setup unconditionally
mce_timer must be passed to setup_timer() in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call to del_timer_sync() will never return, as the timer won't have a base associated, and hence lock_timer_base() will loop infinitely.
(Patch applying to -tip is attached.)
--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
@@ -1374,13 +1374,14 @@ static void mce_init_timer(void)struct timer_list *t = &__get_cpu_var (mce_timer);int *n = &__get_cpu_var (mce_next_interval); +setup_timer (t, mcheck_timer,smp_processor_id ()); +if (mce_ignore_ce)return ; *n = check_interval *HZ ;if (!*n)return ; -setup_timer (t, mcheck_timer,smp_processor_id ()); t->expires =round_jiffies (jiffies + *n);add_timer_on (t,smp_processor_id ()); }
mce_timer must be passed to setup_timer() in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call to del_timer_sync() will never return, as the timer won't have a base associated, and hence lock_timer_base() will loop infinitely.
--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
@@ -1388,13 +1388,14 @@ static void __mcheck_cpu_init_timer(struct timer_list *t = &__get_cpu_var (mce_timer);int *n = &__get_cpu_var (mce_next_interval); +setup_timer (t, mce_start_timer,smp_processor_id ()); +if (mce_ignore_ce)return ; *n = check_interval *HZ ;if (!*n)return ; -setup_timer (t, mce_start_timer,smp_processor_id ()); t->expires =round_jiffies (jiffies + *n);add_timer_on (t,smp_processor_id ()); }
Quoted 5 lines · Jan Beulich
mce_timermust be passed tosetup_timer()in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call todel_timer_sync()will never return, as the timer won't have a base associated, and hencelock_timer_base()will loop infinitely.
No, what we need to fix is hotplug callbacks.
So correct fix should be like "del/add timer conditionally when hotplug."
Thanks,
H.Seto
Quoted 27 lines
(Patch applying to -tip is attached.)
Signed-off-by Jan Beulich <[email protected]>Cc <[email protected]>--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/x86/kernel/cpu/mcheck/mce.c +2
-1@@ -1374,13 +1374,14 @@ static void mce_init_timer(void)struct timer_list *t = &__get_cpu_var (mce_timer);int *n = &__get_cpu_var (mce_next_interval); +setup_timer (t, mcheck_timer,smp_processor_id ()); +if (mce_ignore_ce)return ; *n = check_interval *HZ ;if (!*n)return ; -setup_timer (t, mcheck_timer,smp_processor_id ()); t->expires =round_jiffies (jiffies + *n);add_timer_on (t,smp_processor_id ()); }
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Hidetoshi Seto <[email protected]> 02.12.09 09:47 >>>
Quoted 5 lines · Jan Beulich
mce_timermust be passed tosetup_timer()in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call todel_timer_sync()will never return, as the timer won't have a base associated, and hencelock_timer_base()will loop infinitely.No, what we need to fix is hotplug callbacks.
So correct fix should be like "del/add timer conditionally when hotplug."
Why? This makes the logic just more complicated (you'd need to track whether the timer was ever setup or added), and I can't see any non-tolerable side effect of calling setup_timer() without ever adding the timer anywhere.
Jan
Hidetoshi Seto
Reviewed-byQuoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Hidetoshi Seto <[email protected]> 02.12.09 09:47 >>>
Quoted 5 lines · Jan Beulich
mce_timermust be passed tosetup_timer()in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call todel_timer_sync()will never return, as the timer won't have a base associated, and hencelock_timer_base()will loop infinitely.
Quoted 7 lines
Quoted 2 lines
No, what we need to fix is hotplug callbacks.
So correct fix should be like "del/add timer conditionally when hotplug."Why? This makes the logic just more complicated (you'd need to track whether the timer was ever setup or added), and I can't see any non-tolerable side effect of calling
setup_timer()without ever adding the timer anywhere.
Ah, sorry, I mistook your patch.
It seems that I just found an another bug here...
Thanks,
H.Seto
Ingo, Peter,
Could you pick his patch up?
I confirmed that now it can be applied on Linus's tree and also tip:x86/urgent.
Thanks,
H.Seto
===
From: Jan Beulich <[email protected]>
Subject: [PATCH] x86/mce: timer must be setup unconditionally
mce_timer must be passed to setup_timer() in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call to del_timer_sync() will never return, as the timer won't have a base associated, and hence lock_timer_base() will loop infinitely.
--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
@@ -1388,13 +1388,14 @@ static void __mcheck_cpu_init_timer(void)struct timer_list *t = &__get_cpu_var (mce_timer);int *n = &__get_cpu_var (mce_next_interval); +setup_timer (t, mce_start_timer,smp_processor_id ()); +if (mce_ignore_ce)return ; *n = check_interval *HZ ;if (!*n)return ; -setup_timer (t, mce_start_timer,smp_processor_id ()); t->expires =round_jiffies (jiffies + *n);add_timer_on (t,smp_processor_id ()); }
Signature · 1 line
1.6.5.3
Quoted 5 lines · Hidetoshi Seto
Ingo, Peter,
Could you pick his patch up?
I confirmed that now it can be applied on Linus's tree and also tip:x86/urgent.
Sure. Can i add your signoff too?
Ingo
Quoted 9 lines · Ingo Molnar
Quoted 5 lines · Hidetoshi Seto
Ingo, Peter,
Could you pick his patch up?
I confirmed that now it can be applied on Linus's tree and also tip:x86/urgent.Sure. Can i add your signoff too?
Of course yes.
Thanks,
H.Seto
H. Peter Anvin
reviewerQuoted 11 lines · Ingo Molnar
Quoted 5 lines · Hidetoshi Seto
Ingo, Peter,
Could you pick his patch up?
I confirmed that now it can be applied on Linus's tree and also tip:x86/urgent.Sure. Can i add your signoff too?
Oops... for some reason I thought it already had been applied.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
[tip:x86/urgent] x86/mce: Set up timer unconditionally
In reply to Hidetoshi SetoCommit-ID: bc09effabf0c5c6c7021e5ef9af15a23579b32a8 Gitweb: http://git.kernel.org/tip/bc09effabf0c5c6c7021e5ef9af15a23579b32a8 Author: Jan Beulich <[email protected]> AuthorDate: Tue, 8 Dec 2009 11:21:37 +0900 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 8 Dec 2009 05:34:39 +0100
x86/mce: Set up timer unconditionally
mce_timer must be passed to setup_timer() in all cases, no matter whether it is going to be actually used. Otherwise, when the CPU gets brought down, its call to del_timer_sync() will never return, as the timer won't have a base associated, and hence lock_timer_base() will loop infinitely.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +2 -1
@@ -1388,13 +1388,14 @@ static void __mcheck_cpu_init_timer(void)struct timer_list *t = &__get_cpu_var (mce_timer);int *n = &__get_cpu_var (mce_next_interval); +setup_timer (t, mce_start_timer,smp_processor_id ()); +if (mce_ignore_ce)return ; *n = check_interval *HZ ;if (!*n)return ; -setup_timer (t, mce_start_timer,smp_processor_id ()); t->expires =round_jiffies (jiffies + *n);add_timer_on (t,smp_processor_id ()); }