public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/mce: timer must be setup unconditionally
@ 2009-12-02  7:50 Jan Beulich
  2009-12-02  8:47 ` Hidetoshi Seto
  2009-12-08  2:21 ` Hidetoshi Seto
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Beulich @ 2009-12-02  7:50 UTC (permalink / raw)
  To: mingo, tglx, hpa; +Cc: stable, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

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.)

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: <stable@kernel.org>

---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.32-rc8/arch/x86/kernel/cpu/mcheck/mce.c
+++ 2.6.32-rc8-x86-mce-setup-timer-always/arch/x86/kernel/cpu/mcheck/mce.c
@@ -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());
 }




[-- Attachment #2: linux-tip-x86-mce-setup-timer-always.patch --]
[-- Type: text/plain, Size: 1016 bytes --]

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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: <stable@kernel.org>

---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -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());
 }

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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-02  7:50 [PATCH] x86/mce: timer must be setup unconditionally Jan Beulich
@ 2009-12-02  8:47 ` Hidetoshi Seto
  2009-12-02  8:53   ` Jan Beulich
  2009-12-08  2:21 ` Hidetoshi Seto
  1 sibling, 1 reply; 9+ messages in thread
From: Hidetoshi Seto @ 2009-12-02  8:47 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, hpa, stable, linux-kernel

Jan Beulich wrote:
> 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.

No, what we need to fix is hotplug callbacks.
So correct fix should be like "del/add timer conditionally when hotplug."

Thanks,
H.Seto

> (Patch applying to -tip is attached.)
> 
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
> Cc: <stable@kernel.org>
> 
> ---
>  arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> --- linux-2.6.32-rc8/arch/x86/kernel/cpu/mcheck/mce.c
> +++ 2.6.32-rc8-x86-mce-setup-timer-always/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -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());
>  }


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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-02  8:47 ` Hidetoshi Seto
@ 2009-12-02  8:53   ` Jan Beulich
  2009-12-03  2:31     ` Hidetoshi Seto
  0 siblings, 1 reply; 9+ messages in thread
From: Jan Beulich @ 2009-12-02  8:53 UTC (permalink / raw)
  To: Hidetoshi Seto; +Cc: mingo, stable, tglx, linux-kernel, hpa

>>> Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> 02.12.09 09:47 >>>
>Jan Beulich wrote:
>> 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.
>
>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


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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-02  8:53   ` Jan Beulich
@ 2009-12-03  2:31     ` Hidetoshi Seto
  0 siblings, 0 replies; 9+ messages in thread
From: Hidetoshi Seto @ 2009-12-03  2:31 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, stable, tglx, linux-kernel, hpa

Jan Beulich wrote:
>>>> Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> 02.12.09 09:47 >>>
>> Jan Beulich wrote:
>>> 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.
>> 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...

Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>


Thanks,
H.Seto


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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-02  7:50 [PATCH] x86/mce: timer must be setup unconditionally Jan Beulich
  2009-12-02  8:47 ` Hidetoshi Seto
@ 2009-12-08  2:21 ` Hidetoshi Seto
  2009-12-08  3:14   ` Ingo Molnar
  2009-12-08 11:31   ` [tip:x86/urgent] x86/mce: Set up timer unconditionally tip-bot for Jan Beulich
  1 sibling, 2 replies; 9+ messages in thread
From: Hidetoshi Seto @ 2009-12-08  2:21 UTC (permalink / raw)
  To: Jan Beulich; +Cc: mingo, tglx, hpa, stable, linux-kernel

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 <jbeulich@novell.com>
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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index d7ebf25..a96e5cd 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -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());
 }
-- 
1.6.5.3



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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-08  2:21 ` Hidetoshi Seto
@ 2009-12-08  3:14   ` Ingo Molnar
  2009-12-08  3:33     ` Hidetoshi Seto
  2009-12-08  3:44     ` H. Peter Anvin
  2009-12-08 11:31   ` [tip:x86/urgent] x86/mce: Set up timer unconditionally tip-bot for Jan Beulich
  1 sibling, 2 replies; 9+ messages in thread
From: Ingo Molnar @ 2009-12-08  3:14 UTC (permalink / raw)
  To: Hidetoshi Seto; +Cc: Jan Beulich, tglx, hpa, stable, linux-kernel


* Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> wrote:

> 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

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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-08  3:14   ` Ingo Molnar
@ 2009-12-08  3:33     ` Hidetoshi Seto
  2009-12-08  3:44     ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: Hidetoshi Seto @ 2009-12-08  3:33 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Jan Beulich, tglx, hpa, stable, linux-kernel

Ingo Molnar wrote:
> * Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> wrote:
> 
>> 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.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>


Thanks,
H.Seto


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

* Re: [PATCH] x86/mce: timer must be setup unconditionally
  2009-12-08  3:14   ` Ingo Molnar
  2009-12-08  3:33     ` Hidetoshi Seto
@ 2009-12-08  3:44     ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2009-12-08  3:44 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Hidetoshi Seto, Jan Beulich, tglx, stable, linux-kernel

On 12/07/2009 07:14 PM, Ingo Molnar wrote:
> 
> * Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> wrote:
> 
>> 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

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


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

* [tip:x86/urgent] x86/mce: Set up timer unconditionally
  2009-12-08  2:21 ` Hidetoshi Seto
  2009-12-08  3:14   ` Ingo Molnar
@ 2009-12-08 11:31   ` tip-bot for Jan Beulich
  1 sibling, 0 replies; 9+ messages in thread
From: tip-bot for Jan Beulich @ 2009-12-08 11:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, seto.hidetoshi, jbeulich, stable, tglx,
	mingo

Commit-ID:  bc09effabf0c5c6c7021e5ef9af15a23579b32a8
Gitweb:     http://git.kernel.org/tip/bc09effabf0c5c6c7021e5ef9af15a23579b32a8
Author:     Jan Beulich <jbeulich@novell.com>
AuthorDate: Tue, 8 Dec 2009 11:21:37 +0900
Committer:  Ingo Molnar <mingo@elte.hu>
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.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: <stable@kernel.org>
LKML-Reference: <4B1DB831.2030801@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/cpu/mcheck/mce.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index d7ebf25..a96e5cd 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -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());
 }

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

end of thread, other threads:[~2009-12-08 11:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-02  7:50 [PATCH] x86/mce: timer must be setup unconditionally Jan Beulich
2009-12-02  8:47 ` Hidetoshi Seto
2009-12-02  8:53   ` Jan Beulich
2009-12-03  2:31     ` Hidetoshi Seto
2009-12-08  2:21 ` Hidetoshi Seto
2009-12-08  3:14   ` Ingo Molnar
2009-12-08  3:33     ` Hidetoshi Seto
2009-12-08  3:44     ` H. Peter Anvin
2009-12-08 11:31   ` [tip:x86/urgent] x86/mce: Set up timer unconditionally tip-bot for Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox