mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IRQ, cpu-hotplug: Fix a race between CPU hotplug and IRQ desc alloc/free
Date: Mon, 4 Sep 2017 11:23:01 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1709041112060.2189@nanos> (raw)
In-Reply-To: <20170904085308.17637-1-ying.huang@intel.com>

On Mon, 4 Sep 2017, Huang, Ying wrote:
> diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
> index 638eb9c83d9f..af9029625271 100644
> --- a/kernel/irq/cpuhotplug.c
ry> +++ b/kernel/irq/cpuhotplug.c
> @@ -129,10 +129,13 @@ void irq_migrate_all_off_this_cpu(void)
>  	struct irq_desc *desc;
>  	unsigned int irq;
>  
> +	irq_lock_sparse();

You cannot take that lock here as irq_migrate_all_off_this_cpu() is called
with interrupts disabled.

The protection in takedown_cpus() is wrong. Patch below.

Thanks,

	tglx
----

--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -642,13 +642,13 @@ static int takedown_cpu(unsigned int cpu
 	wait_for_completion(&st->done);
 	BUG_ON(st->state != CPUHP_AP_IDLE_DEAD);
 
-	/* Interrupts are moved away from the dying cpu, reenable alloc/free */
-	irq_unlock_sparse();
-
 	hotplug_cpu__broadcast_tick_pull(cpu);
 	/* This actually kills the CPU. */
 	__cpu_die(cpu);
 
+	/* Interrupts are moved away from the dying cpu, reenable alloc/free */
+	irq_unlock_sparse();
+
 	tick_cleanup_dead_cpu(cpu);
 	return 0;
 }

  reply	other threads:[~2017-09-04  9:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04  8:53 Huang, Ying
2017-09-04  9:23 ` Thomas Gleixner [this message]
2017-09-04 23:41   ` Huang, Ying
2017-09-05  7:15     ` Thomas Gleixner

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=alpine.DEB.2.20.1709041112060.2189@nanos \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ying.huang@intel.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

all inboxes | Powered by JetHome®