From: "Huang\, Ying" <ying.huang@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: "Huang\, Ying" <ying.huang@intel.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] IRQ, cpu-hotplug: Fix a race between CPU hotplug and IRQ desc alloc/free
Date: Tue, 05 Sep 2017 07:41:01 +0800 [thread overview]
Message-ID: <87fuc2yquq.fsf@yhuang-mobile.sh.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1709041112060.2189@nanos> (Thomas Gleixner's message of "Mon, 4 Sep 2017 11:23:01 +0200")
Thomas Gleixner <tglx@linutronix.de> writes:
> 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.
Oh, sorry, I misunderstand the code. I will only keep the !desc check
in the patch.
> 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();
> +
I don't understand this. It appears that irq_migrate_all_off_this_cpu()
is called in take_cpu_down() which has sparse_irq_lock held already.
Best Regards,
Huang, Ying
> tick_cleanup_dead_cpu(cpu);
> return 0;
> }
next prev parent reply other threads:[~2017-09-04 23:41 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
2017-09-04 23:41 ` Huang, Ying [this message]
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=87fuc2yquq.fsf@yhuang-mobile.sh.intel.com \
--to=ying.huang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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®