public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@cyclades.com>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: PATCH: Fix race in cpu_down (hotplug cpu)
Date: Mon, 19 Sep 2005 13:15:36 +1000	[thread overview]
Message-ID: <1127099735.9696.54.camel@localhost> (raw)

Hi.

There is a race condition in taking down a cpu (kernel/cpu.c::cpu_down).
A cpu can already be idling when we clear its online flag, and we do not
force the idle task to reschedule. This results in __cpu_die timing out.
A simple fix is to force the idle task on the cpu going to reschedule.

Without the patch below, Suspend2 get into a deadlock at resume time
when this issue occurs. I could not complete 20 cycles without seeing
the issue. With the patch below, I have completed 75 cycles on the trot
without problems.

Please apply.

Signed-off-by: Nigel Cunningham <ncunningham@cyclades.com>

diff -ruNp 9910-hotplug-cpu-race.patch-old/kernel/cpu.c 9910-hotplug-cpu-race.patch-new/kernel/cpu.c
--- 9910-hotplug-cpu-race.patch-old/kernel/cpu.c	2005-08-29 10:29:58.000000000 +1000
+++ 9910-hotplug-cpu-race.patch-new/kernel/cpu.c	2005-09-19 12:15:08.000000000 +1000
@@ -126,6 +126,9 @@ int cpu_down(unsigned int cpu)
 	while (!idle_cpu(cpu))
 		yield();
 
+	/* CPU may have idled before we set its offline flag. */
+	set_tsk_need_resched(idle_task(cpu));
+
 	/* This actually kills the CPU. */
 	__cpu_die(cpu);
 




             reply	other threads:[~2005-09-19  3:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19  3:15 Nigel Cunningham [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19  3:28 PATCH: Fix race in cpu_down (hotplug cpu) Nigel Cunningham
2005-09-19  4:22 ` Srivatsa Vaddagiri
2005-09-19  4:48 Li, Shaohua
2005-09-19  5:10 ` Srivatsa Vaddagiri
2005-09-19  5:31   ` Shaohua Li
2005-09-19  5:57     ` Srivatsa Vaddagiri
2005-09-19  6:11       ` Nigel Cunningham
2005-09-19  6:23         ` Srivatsa Vaddagiri
2005-09-19  6:29           ` Nick Piggin
2005-09-19  7:00             ` Srivatsa Vaddagiri
2005-09-19  6:31           ` Nigel Cunningham
2005-09-19  7:09             ` Srivatsa Vaddagiri
2005-09-19  6:37           ` Shaohua Li
2005-09-19  6:36             ` Nick Piggin
2005-09-19  6:54               ` Nigel Cunningham
2005-09-19  7:12               ` Shaohua Li
2005-09-19  7:22                 ` Nick Piggin
2005-09-19  7:28                   ` Ingo Molnar
2005-09-19  7:37                     ` Nick Piggin
2005-09-19 22:55                       ` Nigel Cunningham
2005-09-20  4:41                         ` Srivatsa Vaddagiri
2005-09-19  7:07             ` Srivatsa Vaddagiri
2005-09-19  5:23 ` Nigel Cunningham
2005-09-19  5:28   ` Srivatsa Vaddagiri
2005-09-19  5:35     ` Nigel Cunningham

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=1127099735.9696.54.camel@localhost \
    --to=ncunningham@cyclades.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=zwane@arm.linux.org.uk \
    /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