From: Marc Zyngier <maz@kernel.org>
To: Huacai Chen <chenhuacai@kernel.org>
Cc: Huacai Chen <chenhuacai@loongson.cn>,
Thomas Gleixner <tglx@linutronix.de>,
linux-arch <linux-arch@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Xuerui Wang <kernel@xen0n.name>,
Xuefeng Li <lixuefeng@loongson.cn>,
Jiaxun Yang <jiaxun.yang@flygoat.com>
Subject: Re: [PATCH] LoongArch: Don't disable EIOINTC master core
Date: Tue, 09 Aug 2022 11:20:33 +0100 [thread overview]
Message-ID: <871qtpwwem.wl-maz@kernel.org> (raw)
In-Reply-To: <CAAhV-H50HERxjrmfDkSaHAVY7Q_ufpZP-e+qdZWVd=qEuQVXBg@mail.gmail.com>
On Tue, 09 Aug 2022 10:19:31 +0100,
Huacai Chen <chenhuacai@kernel.org> wrote:
>
> Hi, Marc,
>
> On Tue, Aug 9, 2022 at 4:56 PM Marc Zyngier <maz@kernel.org> wrote:
> >
> > On Tue, 09 Aug 2022 08:45:22 +0100,
> > Huacai Chen <chenhuacai@loongson.cn> wrote:
> > >
> > > This patch fix a CPU hotplug issue. The EIOINTC master core (the first
> > > core of an EIOINTC node) should not be disabled at runtime, since it has
> > > the responsibility of dispatching I/O interrupts.
> > >
> > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > > ---
> > > arch/loongarch/kernel/smp.c | 9 +++++++++
> > > drivers/irqchip/irq-loongson-eiointc.c | 5 +++++
> > > 2 files changed, 14 insertions(+)
> > >
> > > diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c
> > > index 09743103d9b3..54901716f8de 100644
> > > --- a/arch/loongarch/kernel/smp.c
> > > +++ b/arch/loongarch/kernel/smp.c
> > > @@ -242,9 +242,18 @@ void loongson3_smp_finish(void)
> > >
> > > static bool io_master(int cpu)
> > > {
> > > + int i, node, master;
> > > +
> > > if (cpu == 0)
> > > return true;
> > >
> > > + for (i = 1; i < loongson_sysconf.nr_io_pics; i++) {
> > > + node = eiointc_get_node(i);
> > > + master = cpu_number_map(node * CORES_PER_EIO_NODE);
> > > + if (cpu == master)
> > > + return true;
> > > + }
> > > +
> > > return false;
> > > }
> > >
> > > diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
> > > index 170dbc96c7d3..6c99a2ff95f5 100644
> > > --- a/drivers/irqchip/irq-loongson-eiointc.c
> > > +++ b/drivers/irqchip/irq-loongson-eiointc.c
> > > @@ -56,6 +56,11 @@ static void eiointc_enable(void)
> > > iocsr_write64(misc, LOONGARCH_IOCSR_MISC_FUNC);
> > > }
> > >
> > > +int eiointc_get_node(int id)
> > > +{
> > > + return eiointc_priv[id]->node;
> > > +}
> > > +
> > > static int cpu_to_eio_node(int cpu)
> > > {
> > > return cpu_logical_map(cpu) / CORES_PER_EIO_NODE;
> >
> >
> > I don't understand why it has to be this complex and make any use of
> > the node number.
> >
> > As I understand it, CPU-0 in any EIOINTC block is a master. So all you
> > need to find out is whether the CPU number is a multiple of
> > CORES_PER_EIO_NODE.
> CPU-0 in any EIOINTC block may be a master, but not absolutely be a
> master to dispatch I/O interrupts. If there is no bridge under a
> EIOINTC, then this EIOINTC doesn't handle I/O interrupts, and it can
> be disabled at runtime.
But that's not what your code is checking, is it? You're only
reporting the node number, irrespective of whether there is anything
behind the EIOINTC.
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2022-08-09 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-09 7:45 [PATCH] LoongArch: Don't disable EIOINTC master core Huacai Chen
2022-08-09 8:56 ` Marc Zyngier
2022-08-09 9:19 ` Huacai Chen
2022-08-09 10:20 ` Marc Zyngier [this message]
2022-08-09 10:39 ` Huacai Chen
2022-08-09 12:53 ` Marc Zyngier
2022-08-09 15:16 ` Huacai Chen
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=871qtpwwem.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=chenhuacai@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lixuefeng@loongson.cn \
--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