public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Nathan Lynch <ntl@pobox.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] softlockup detection vs. cpu hotplug
Date: Fri, 24 Feb 2006 07:25:33 +0100	[thread overview]
Message-ID: <20060224062533.GA1431@elte.hu> (raw)
In-Reply-To: <20060224003146.GJ3293@localhost.localdomain>


* Nathan Lynch <ntl@pobox.com> wrote:

> @@ -86,10 +92,15 @@ static int watchdog(void * __bind_cpu)
>  	 */
>  	while (!kthread_should_stop()) {
>  		msleep_interruptible(1000);
> -		touch_softlockup_watchdog();
> +		/* When our cpu is offlined the watchdog thread can
> +		 * get migrated before it is stopped.
> +		 */
> +		preempt_disable();
> +		if (likely(smp_processor_id() == bind_cpu))
> +			touch_softlockup_watchdog();
> +		preempt_enable();
> +		__set_current_state(TASK_RUNNING);
>  	}
> -	__set_current_state(TASK_RUNNING);
> -
>  	return 0;
>  }
>  

the above change is unnecessary: there is absolutely no harm from a 
migrated watchdog thread touching another CPU's timestamp for a short 
amount of time. [Furtermore, why doesnt the hotplug CPU code use the 
kthread_should_stop() mechanism to gracefully stop per-CPU threads, 
instead of migrating unsuspecting threads and putting ugly hooks into 
every such thread?]

the other fix (to touch before bringing the CPU up) looks OK, but it's 
simpler to initialize it via the oneliner below. Andrew, this is what 
i'd suggest to do for v2.6.16. [i'll send an updated softirq-rework 
patch in the next mail.]

	Ingo

------

fix from Nathan Lynch: initialize the softlockup timestamp of freshly 
brought up CPUs with jiffies.

Signed-off-by: Ingo Molnar <mingo@elte.hu>

--- kernel/softlockup.c.orig
+++ kernel/softlockup.c
@@ -110,6 +110,7 @@ cpu_callback(struct notifier_block *nfb,
 			printk("watchdog for %i failed\n", hotcpu);
 			return NOTIFY_BAD;
 		}
+  		per_cpu(timestamp, hotcpu) = jiffies;
   		per_cpu(watchdog_task, hotcpu) = p;
 		kthread_bind(p, hotcpu);
  		break;

      parent reply	other threads:[~2006-02-24  6:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-24  0:31 [PATCH] softlockup detection vs. cpu hotplug Nathan Lynch
2006-02-24  1:31 ` Shaohua Li
2006-02-24  6:25 ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060224062533.GA1431@elte.hu \
    --to=mingo@elte.hu \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntl@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox