From: Chen Yu <yu.c.chen@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Borislav Petkov <bp@suse.de>, Len Brown <len.brown@intel.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][RFC] x86: Fix the irq affinity in fixup_cpus
Date: Mon, 3 Jul 2017 21:51:09 +0800 [thread overview]
Message-ID: <20170703135109.GA26935@yu-desktop-1.sh.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1706042158160.3517@nanos>
On Sun, Jun 04, 2017 at 10:04:53PM +0200, Thomas Gleixner wrote:
> On Mon, 24 Apr 2017, Chen Yu wrote:
>
> > fixup_cpus() is to set appropriate irq affinity once the CPU
> > has been brought down, however we should also adjust the
> > desc->irq_common_data.affinity otherwise we will get an
> > incorrect irqmask during cpu offline:
> >
> > cat /proc/irq/31/smp_affinity
> > 00000000,80000000
> > echo 0 > /sys/devices/system/cpu/cpu31/online
> > cat /proc/irq/31/smp_affinity
> > 00000000,80000000
> >
> > This might bring potential problems, as reported we
> > saw plenty of irq flood during hibernation restore:
> > do_IRQ: 1.51 No irq handler for vector
> > Maybe it is due to some drivers get incorrect irq mask
> > during hibernation.
> >
> > Fix this by invoking the interface of irq_set_affinity_locked()
> > to also update the desc->irq_common_data.affinity.
> >
> > Link: https://bugzilla.kernel.org/show_bug.cgi?id=188281
> > Reported-and-tested-by: Thomas Mitterfellner <thomas@mitterfellner.at>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Len Brown <len.brown@intel.com>
> > Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Cc: x86@kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> > ---
> > arch/x86/kernel/irq.c | 13 +++++++------
> > 1 file changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> > index 4d8183b..a108ed2 100644
> > --- a/arch/x86/kernel/irq.c
> > +++ b/arch/x86/kernel/irq.c
> > @@ -480,13 +480,14 @@ void fixup_irqs(void)
> > if (!irqd_can_move_in_process_context(data) && chip->irq_mask)
> > chip->irq_mask(data);
> >
> > - if (chip->irq_set_affinity) {
> > - ret = chip->irq_set_affinity(data, affinity, true);
> > - if (ret == -ENOSPC)
> > + ret = irq_set_affinity_locked(data, affinity, true);
>
> This can't work. For interrupts which cannot set the affinity in normal
> context irq_set_affinity_locked() will queue the interrupt to move at the
> next arrival of an interrupt. So the irq stays affine to the dying
> CPU.
>
Ok, got it.
> After looking at the callsites, it's safe to change
> irq_set_affinity_locked() so that it uses the direct affinity setter
> function when force == true.
>
Sorry it took me sometime to understand this point(this is why I did not reply
to you at the first time :-)
I thought the defination of the word 'safe' here means, we should
not adjust the irq affinity in the process context if the ISR is
still running, otherwise there might be a race condition.
Currently, there are four drivers would set the force flag to true(AKA,
invoking irq_force_affinity()).
1. exynos4_mct_starting_cpu()
The irq affinity is set before the clockevent is registered,
so there would be no interrupt triggered when adjusting
the irq affinity in the process context. Safe.
2. sirfsoc_local_timer_starting_cpu()
The same as above. Safe.
3. arm_perf_starting_cpu()
During cpu offline, the pmu interrupt(non percpu pmu interrupt)
might be migrated to other online cpus. Then once the same cpu
is put online, the interrupt will be set back to this cpu again
by invoking irq_force_affinity(), but currently the pmu interrupt
might be still running on other cpus, so it would be unsafe to adjust
its irq affinity in the process context?
4. sunhv_migrate_hvcons_irq()
The cpu who encountered a panic needs to migrate the hvcons irq to the
current alive cpu, and send ipi to stop other cpus. So at the time to
adjust the irq affinity for the hvcons, the interrupt of the latter might
be running and it might be unsafe to adjust the irq affinity in the
process context?
Not sure if my understanding is correct, or do I miss something?
thanks,
Yu
> So we need that change first, before we can switch fixups_irqs() over.
>
> Thanks,
>
> tglx
next prev parent reply other threads:[~2017-07-03 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 7:46 Chen Yu
2017-06-04 20:04 ` Thomas Gleixner
2017-07-03 13:51 ` Chen Yu [this message]
2017-07-04 8:50 ` Thomas Gleixner
2017-07-05 3:20 ` Chen Yu
2017-07-05 6:46 ` Thomas Gleixner
2017-07-05 14:10 ` Chen Yu
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=20170703135109.GA26935@yu-desktop-1.sh.intel.com \
--to=yu.c.chen@intel.com \
--cc=bp@suse.de \
--cc=hpa@zytor.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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®