Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Jonathan Lemon <jonathan.lemon@gmail.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Hanjun Guo <guohanjun@huawei.com>,
	Barry Song <song.bao.hua@hisilicon.com>,
	Len Brown <lenb@kernel.org>, Jakub Kicinski <kuba@kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	<kernel-team@fb.com>, <linux-pci@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH] : Revert "ACPI: Remove side effect of partly creating a node in acpi_get_node()"
Date: Thu, 12 May 2022 11:15:25 +0100	[thread overview]
Message-ID: <20220512111525.0000570e@Huawei.com> (raw)
In-Reply-To: <CAJZ5v0hSJExYtxEZuw-+ZUf1YoZesOtS+x9UbdoBNXtTKPiYxg@mail.gmail.com>

On Wed, 11 May 2022 19:44:14 +0200
"Rafael J. Wysocki" <rafael@kernel.org> wrote:

> On Wed, May 11, 2022 at 7:42 PM Jonathan Lemon <jonathan.lemon@gmail.com> wrote:
> >
> > On 11 May 2022, at 10:33, Rafael J. Wysocki wrote:
> >  
> > > On Wed, May 11, 2022 at 7:24 PM Jonathan Lemon <jonathan.lemon@gmail.com> wrote:  
> > >>
> > >> This reverts commit a62d07e0006a3a3ce77041ca07f3c488ec880790.
> > >>
> > >> The change calls pxm_to_node(), which ends up returning -1
> > >> (NUMA_NO_NODE) on some systems for the pci bus, as opposed
> > >> to the prior call to acpi_map_pxm_to_node(), which returns 0.
> > >>
> > >> The default numa node is then inherited by all pci devices, and is
> > >> visible in /sys/bus/pci/devices/*/numa_node
> > >>
> > >> The prior behavior shows:
> > >>  # cat /sys/bus/pci/devices/*/numa_node | sort | uniq -c
> > >>      122 0
> > >>
> > >> While the new behavior has:
> > >>  # cat /sys/bus/pci/devices/*/numa_node | sort | uniq -c
> > >>        1 0

Curious, which device is turning up in node 0?

> > >>      121 -1
> > >>
> > >> While arguably NUMA_NO_NODE is correct on single-socket systems which
> > >> have only one numa domain, this breaks scripts that attempt to read the
> > >> NIC numa_node and pass that to numactl in order to pin memory allocation
> > >> when running applications (like iperf).  E.g.:
> > >>
> > >>   # numactl -p -1 iperf3
> > >>   libnuma: Warning: node argument -1 is out of range
> > >>   <-1> is invalid
> > >>
> > >> Reverting this change restores the prior behavior.  
> > >
> > > Well, that's not a recent commit and it fixed a real and serious issue.
> > >
> > > Isn't there a way to fix this other than reverting it?  
> >
> > The userspace behavior changed - is there another way to fix things
> > so that a valid numa_node is returned?  
> 
> Well, that's my question.

As Rafael noted, we don't want to change the internal kernel representation because
previous kernel behavior resulting in several paths where you could
get NULL pointer de-references, but maybe we could special case
it at the userspace boundary.

e.g. override dev_to_node() return value here
https://elixir.bootlin.com/linux/v5.18-rc6/source/drivers/pci/pci-sysfs.c#L358

What's problematic is we missed this being being an issue until now and hence
have shipping kernels with both behaviors.

+CC Bjorn and linux-pci

Jonathan




       reply	other threads:[~2022-05-12 10:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220511171754.avfrrqg6eihku55s@bsd-mbp.dhcp.thefacebook.com>
     [not found] ` <CAJZ5v0jHDNBqCfmgyLUOs7yUZaEjQ96m5HVZKHP3x7_uamH5zQ@mail.gmail.com>
     [not found]   ` <7A00774E-13F2-4FB4-9979-D7827C92F5B8@gmail.com>
     [not found]     ` <CAJZ5v0hSJExYtxEZuw-+ZUf1YoZesOtS+x9UbdoBNXtTKPiYxg@mail.gmail.com>
2022-05-12 10:15       ` Jonathan Cameron [this message]
2022-05-12 13:35         ` [PATCH] : Revert "ACPI: Remove side effect of partly creating a node in acpi_get_node()" Jonathan Lemon

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=20220512111525.0000570e@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=guohanjun@huawei.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=kuba@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=song.bao.hua@hisilicon.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