From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Will Deacon <will@kernel.org>
Cc: lorenzo.pieralisi@arm.com, catalin.marinas@arm.com,
baolin.wang7@gmail.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arm64: PCI: Validate the node before setting node id for root bus
Date: Mon, 28 Sep 2020 22:49:57 +0800 [thread overview]
Message-ID: <20200928144957.GA90366@VM20190228-100.tbsite.net> (raw)
In-Reply-To: <20200928140054.GA11500@willie-the-truck>
On Mon, Sep 28, 2020 at 03:00:55PM +0100, Will Deacon wrote:
> [+ Lorenzo]
>
> On Tue, Sep 22, 2020 at 06:33:24PM +0800, Baolin Wang wrote:
> > If the BIOS disabled the NUMA configuration, but did not change the
> > proximity domain description in the SRAT table, so the PCI root bus
> > device may get a incorrect node id by acpi_get_node().
>
> How "incorrect" are we talking here? What actually goes wrong? At some
> point, we have to trust what the firmware is telling us.
What I mean is, if we disable the NUMA from BIOS, but we did not change
the PXM for the PCI devices, so the PCI devices can still get a numa
node id from acpi_get_node(). For example, we can still get the numa
node id = 1 in this case from acpi_get_node(), but the numa_nodes_parsed
is empty, which means the node id 1 is invalid. We should add a
validation for the node id when setting the root bus node id.
>
> > Thus better to add a numa node validation before setting numa node
> > for the PCI root bus, like pci_acpi_root_get_node() does for X86
> > architecture.
> >
> > Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> > ---
> > arch/arm64/kernel/pci.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/kernel/pci.c b/arch/arm64/kernel/pci.c
> > index 1006ed2..24fe2bd 100644
> > --- a/arch/arm64/kernel/pci.c
> > +++ b/arch/arm64/kernel/pci.c
> > @@ -86,9 +86,13 @@ int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
> > struct pci_config_window *cfg = bridge->bus->sysdata;
> > struct acpi_device *adev = to_acpi_device(cfg->parent);
> > struct device *bus_dev = &bridge->bus->dev;
> > + int node = acpi_get_node(acpi_device_handle(adev));
> > +
> > + if (node != NUMA_NO_NODE && !node_online(node))
> > + node = NUMA_NO_NODE;
>
> Hmm. afaict, acpi_get_node() tries quite hard to return a valid node when
> it gets back NUMA_NO_NODE in acpi_map_pxm_to_node(). Seems like we're
> undoing all of that here, which worries me because NUMA_NO_NODE is a bit
> of a loaded gun if you interpret it as a valid node.
I did not treate NUMA_NO_NODE as a valid node, I just add a validation
to validate if it is a valid node before setting. See my previous comments,
hopes I make things clear. Thanks.
>
> Anyway, I defer to Lorenzo on this.
>
> Will
next prev parent reply other threads:[~2020-09-28 14:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 10:33 [PATCH] arm64: PCI: Validate the node before setting node id for root bus Baolin Wang
2020-09-28 14:00 ` Will Deacon
2020-09-28 14:49 ` Baolin Wang [this message]
2020-09-28 15:23 ` Lorenzo Pieralisi
2020-09-29 15:41 ` Baolin Wang
2020-10-01 8:55 ` Lorenzo Pieralisi
2020-10-03 9:35 ` Baolin Wang
2020-11-09 12:27 ` Baolin Wang
2020-11-12 17:05 ` Lorenzo Pieralisi
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=20200928144957.GA90366@VM20190228-100.tbsite.net \
--to=baolin.wang@linux.alibaba.com \
--cc=baolin.wang7@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=will@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