From: Jonathan Cameron via <qemu-devel@nongnu.org> To: Vikram Sethi <vsethi@nvidia.com> Cc: Ankit Agrawal <ankita@nvidia.com>, Jason Gunthorpe <jgg@nvidia.com>, "alex.williamson@redhat.com" <alex.williamson@redhat.com>, "clg@redhat.com" <clg@redhat.com>, "shannon.zhaosl@gmail.com" <shannon.zhaosl@gmail.com>, "peter.maydell@linaro.org" <peter.maydell@linaro.org>, "ani@anisinha.ca" <ani@anisinha.ca>, "berrange@redhat.com" <berrange@redhat.com>, "eduardo@habkost.net" <eduardo@habkost.net>, "imammedo@redhat.com" <imammedo@redhat.com>, "mst@redhat.com" <mst@redhat.com>, "eblake@redhat.com" <eblake@redhat.com>, "armbru@redhat.com" <armbru@redhat.com>, "david@redhat.com" <david@redhat.com>, "gshan@redhat.com" <gshan@redhat.com>, Aniket Agashe <aniketa@nvidia.com>, Neo Jia <cjia@nvidia.com>, Kirti Wankhede <kwankhede@nvidia.com>, "Tarun Gupta (SW-GPU)" <targupta@nvidia.com>, Andy Currid <ACurrid@nvidia.com>, Dheeraj Nigam <dnigam@nvidia.com>, Uday Dhoke <udhoke@nvidia.com>, "qemu-arm@nongnu.org" <qemu-arm@nongnu.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, Dave Jiang <dave.jiang@intel.com>, "Shanker Donthineni" <sdonthineni@nvidia.com> Subject: Re: [PATCH v2 1/3] qom: new object to associate device to numa node Date: Thu, 12 Oct 2023 09:59:54 +0100 [thread overview] Message-ID: <20231012095954.00006ebb@Huawei.com> (raw) In-Reply-To: <BYAPR12MB3336E4ABBB0CBD3C87222DA7BDCCA@BYAPR12MB3336.namprd12.prod.outlook.com> On Wed, 11 Oct 2023 17:37:11 +0000 Vikram Sethi <vsethi@nvidia.com> wrote: > Hi Jonathan, > > > -----Original Message----- > > From: Jonathan Cameron <Jonathan.Cameron@Huawei.com> > > Sent: Monday, October 9, 2023 7:27 AM > > To: Ankit Agrawal <ankita@nvidia.com> > > Cc: Jason Gunthorpe <jgg@nvidia.com>; alex.williamson@redhat.com; > > clg@redhat.com; shannon.zhaosl@gmail.com; peter.maydell@linaro.org; > > ani@anisinha.ca; berrange@redhat.com; eduardo@habkost.net; > > imammedo@redhat.com; mst@redhat.com; eblake@redhat.com; > > armbru@redhat.com; david@redhat.com; gshan@redhat.com; Aniket > > Agashe <aniketa@nvidia.com>; Neo Jia <cjia@nvidia.com>; Kirti Wankhede > > <kwankhede@nvidia.com>; Tarun Gupta (SW-GPU) <targupta@nvidia.com>; > > Vikram Sethi <vsethi@nvidia.com>; Andy Currid <acurrid@nvidia.com>; > > Dheeraj Nigam <dnigam@nvidia.com>; Uday Dhoke <udhoke@nvidia.com>; > > qemu-arm@nongnu.org; qemu-devel@nongnu.org; Dave Jiang > > <dave.jiang@intel.com> > > Subject: Re: [PATCH v2 1/3] qom: new object to associate device to numa > > node > > > > > > On Sun, 8 Oct 2023 01:47:38 +0530 > > <ankita@nvidia.com> wrote: > > > > > From: Ankit Agrawal <ankita@nvidia.com> > > > > > > The CPU cache coherent device memory can be added as NUMA nodes > > > distinct from the system memory nodes. These nodes are associated with > > > the device and Qemu needs a way to maintain this link. > > > > Hi Ankit, > > > > I'm not sure I'm convinced of the approach to creating nodes for memory > > usage (or whether that works in Linux on all NUMA ACPI archs), but I am > > keen to see Generic Initiator support in QEMU. I'd also like to see it done in a > > way that naturally extends to Generic Ports which are very similar (but don't > > hang memory off them! :) Dave Jiang posted a PoC a while back for generic > > ports. > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore. > > kernel.org%2Fqemu- > > devel%2F168185633821.899932.322047053764766056.stgit%40djiang5- > > mobl3%2F&data=05%7C01%7Cvsethi%40nvidia.com%7C846b19f87bc5424d > > c33608dbc8c3015d%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7 > > C638324512146712954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C% > > 7C%7C&sdata=v318MXognoITHyv7AFqZAfvUi2hLy2ZUVnLvyQ2IAfY%3D&res > > erved=0 > > > > My concern with this approach is that it is using a side effect of a Linux > > implementation detail that the infra structure to bring up coherent memory > > is all present even for a GI only node (if it is which I can't recall) I'm also fairly > > sure we never tidied up the detail of going from the GI to the device in Linux > > (because it's harder than a _PXM entry for the device). It requires stashing a > > better description than the BDF before potentially doing reenumeration so > > that we can rebuild the association after that is done. > > > > I'm not sure I understood the concern. Are you suggesting that the ACPI specification > somehow prohibits memory associated with a GI node in the same PXM? i.e whether the GI is memory-less > or with memory isn't mandated by the spec IIRC. Certainly seems perfectly normal > for an accelerator with memory to have a GI with memory and that memory be able to be associated with the same PXM. Indeed reasonable that a GI would have associated memory, but if it's "normal memory" (i.e. coherent and not device private memory accessed by PCI bar etc) then expectation would be that memory is in SRAT as a memory entry. Which brings us back to the original question of whether 0 sized memory nodes are fine. > So what about this patch is using a Linux implementation detail? Even if Linux wasn't currently supporting > that use case, it is something that would have been reasonable to add IMO. What am I missing? Linux is careful to only bring up the infrastructure for specific types of roximity node. It works its way through SRAT and sets appropriate bitmap bits to say which combination of PXM node types a given node is. (CPU, Memory, GI etc) After that walk is done it then brings up various infrastructure. What I can't remember (you'll need to experiment) is if there is anything not brought up for a non Memory node that you would need. Might be fine, but that doesn't mean it will remain fine. Maybe we just need to make sure the documentation / comments in Linux cover this use case. You are on your own for what other OSes decided is valid here as the specifcation does not mention this AFAIK. If it does then add a reference. There is a non trivial (potential) cost to enabling facilities on NUMA nodes that will never make use of them - a bunch of longer searches etc when looking for memory. For GIs we enable pretty much everything a CPU node uses. That was controversial though only well after support was already in - the controversy being that it added costs to paths that didn't care about GIs. Basically it boils down to using unexpected corners of specifications may prove fragile. For one thing I'm doubtful if the NUMA description the kernel exposes (coming from a subset of HMAT) won't deal with this case. Not tried it though so you may be lucky. Jonathan
WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com> To: Vikram Sethi <vsethi@nvidia.com> Cc: Ankit Agrawal <ankita@nvidia.com>, Jason Gunthorpe <jgg@nvidia.com>, "alex.williamson@redhat.com" <alex.williamson@redhat.com>, "clg@redhat.com" <clg@redhat.com>, "shannon.zhaosl@gmail.com" <shannon.zhaosl@gmail.com>, "peter.maydell@linaro.org" <peter.maydell@linaro.org>, "ani@anisinha.ca" <ani@anisinha.ca>, "berrange@redhat.com" <berrange@redhat.com>, "eduardo@habkost.net" <eduardo@habkost.net>, "imammedo@redhat.com" <imammedo@redhat.com>, "mst@redhat.com" <mst@redhat.com>, "eblake@redhat.com" <eblake@redhat.com>, "armbru@redhat.com" <armbru@redhat.com>, "david@redhat.com" <david@redhat.com>, "gshan@redhat.com" <gshan@redhat.com>, Aniket Agashe <aniketa@nvidia.com>, Neo Jia <cjia@nvidia.com>, Kirti Wankhede <kwankhede@nvidia.com>, "Tarun Gupta (SW-GPU)" <targupta@nvidia.com>, Andy Currid <ACurrid@nvidia.com>, Dheeraj Nigam <dnigam@nvidia.com>, Uday Dhoke <udhoke@nvidia.com>, "qemu-arm@nongnu.org" <qemu-arm@nongnu.org>, "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>, Dave Jiang <dave.jiang@intel.com>, "Shanker Donthineni" <sdonthineni@nvidia.com> Subject: Re: [PATCH v2 1/3] qom: new object to associate device to numa node Date: Thu, 12 Oct 2023 09:59:54 +0100 [thread overview] Message-ID: <20231012095954.00006ebb@Huawei.com> (raw) Message-ID: <20231012085954.JY0yEdqqQElrg5f2LXy4jLDnQVotq5UowZhCYasbwYA@z> (raw) In-Reply-To: <BYAPR12MB3336E4ABBB0CBD3C87222DA7BDCCA@BYAPR12MB3336.namprd12.prod.outlook.com> On Wed, 11 Oct 2023 17:37:11 +0000 Vikram Sethi <vsethi@nvidia.com> wrote: > Hi Jonathan, > > > -----Original Message----- > > From: Jonathan Cameron <Jonathan.Cameron@Huawei.com> > > Sent: Monday, October 9, 2023 7:27 AM > > To: Ankit Agrawal <ankita@nvidia.com> > > Cc: Jason Gunthorpe <jgg@nvidia.com>; alex.williamson@redhat.com; > > clg@redhat.com; shannon.zhaosl@gmail.com; peter.maydell@linaro.org; > > ani@anisinha.ca; berrange@redhat.com; eduardo@habkost.net; > > imammedo@redhat.com; mst@redhat.com; eblake@redhat.com; > > armbru@redhat.com; david@redhat.com; gshan@redhat.com; Aniket > > Agashe <aniketa@nvidia.com>; Neo Jia <cjia@nvidia.com>; Kirti Wankhede > > <kwankhede@nvidia.com>; Tarun Gupta (SW-GPU) <targupta@nvidia.com>; > > Vikram Sethi <vsethi@nvidia.com>; Andy Currid <acurrid@nvidia.com>; > > Dheeraj Nigam <dnigam@nvidia.com>; Uday Dhoke <udhoke@nvidia.com>; > > qemu-arm@nongnu.org; qemu-devel@nongnu.org; Dave Jiang > > <dave.jiang@intel.com> > > Subject: Re: [PATCH v2 1/3] qom: new object to associate device to numa > > node > > > > > > On Sun, 8 Oct 2023 01:47:38 +0530 > > <ankita@nvidia.com> wrote: > > > > > From: Ankit Agrawal <ankita@nvidia.com> > > > > > > The CPU cache coherent device memory can be added as NUMA nodes > > > distinct from the system memory nodes. These nodes are associated with > > > the device and Qemu needs a way to maintain this link. > > > > Hi Ankit, > > > > I'm not sure I'm convinced of the approach to creating nodes for memory > > usage (or whether that works in Linux on all NUMA ACPI archs), but I am > > keen to see Generic Initiator support in QEMU. I'd also like to see it done in a > > way that naturally extends to Generic Ports which are very similar (but don't > > hang memory off them! :) Dave Jiang posted a PoC a while back for generic > > ports. > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore. > > kernel.org%2Fqemu- > > devel%2F168185633821.899932.322047053764766056.stgit%40djiang5- > > mobl3%2F&data=05%7C01%7Cvsethi%40nvidia.com%7C846b19f87bc5424d > > c33608dbc8c3015d%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7 > > C638324512146712954%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjA > > wMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C% > > 7C%7C&sdata=v318MXognoITHyv7AFqZAfvUi2hLy2ZUVnLvyQ2IAfY%3D&res > > erved=0 > > > > My concern with this approach is that it is using a side effect of a Linux > > implementation detail that the infra structure to bring up coherent memory > > is all present even for a GI only node (if it is which I can't recall) I'm also fairly > > sure we never tidied up the detail of going from the GI to the device in Linux > > (because it's harder than a _PXM entry for the device). It requires stashing a > > better description than the BDF before potentially doing reenumeration so > > that we can rebuild the association after that is done. > > > > I'm not sure I understood the concern. Are you suggesting that the ACPI specification > somehow prohibits memory associated with a GI node in the same PXM? i.e whether the GI is memory-less > or with memory isn't mandated by the spec IIRC. Certainly seems perfectly normal > for an accelerator with memory to have a GI with memory and that memory be able to be associated with the same PXM. Indeed reasonable that a GI would have associated memory, but if it's "normal memory" (i.e. coherent and not device private memory accessed by PCI bar etc) then expectation would be that memory is in SRAT as a memory entry. Which brings us back to the original question of whether 0 sized memory nodes are fine. > So what about this patch is using a Linux implementation detail? Even if Linux wasn't currently supporting > that use case, it is something that would have been reasonable to add IMO. What am I missing? Linux is careful to only bring up the infrastructure for specific types of roximity node. It works its way through SRAT and sets appropriate bitmap bits to say which combination of PXM node types a given node is. (CPU, Memory, GI etc) After that walk is done it then brings up various infrastructure. What I can't remember (you'll need to experiment) is if there is anything not brought up for a non Memory node that you would need. Might be fine, but that doesn't mean it will remain fine. Maybe we just need to make sure the documentation / comments in Linux cover this use case. You are on your own for what other OSes decided is valid here as the specifcation does not mention this AFAIK. If it does then add a reference. There is a non trivial (potential) cost to enabling facilities on NUMA nodes that will never make use of them - a bunch of longer searches etc when looking for memory. For GIs we enable pretty much everything a CPU node uses. That was controversial though only well after support was already in - the controversy being that it added costs to paths that didn't care about GIs. Basically it boils down to using unexpected corners of specifications may prove fragile. For one thing I'm doubtful if the NUMA description the kernel exposes (coming from a subset of HMAT) won't deal with this case. Not tried it though so you may be lucky. Jonathan
next prev parent reply other threads:[~2023-10-12 9:00 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-07 20:17 [PATCH v2 0/3] acpi: report numa nodes for device memory using GI ankita 2023-10-07 20:17 ` [PATCH v2 1/3] qom: new object to associate device to numa node ankita 2023-10-09 12:26 ` Jonathan Cameron via 2023-10-09 12:26 ` Jonathan Cameron 2023-10-11 17:37 ` Vikram Sethi 2023-10-12 8:59 ` Jonathan Cameron via [this message] 2023-10-12 8:59 ` Jonathan Cameron 2023-10-09 21:16 ` Alex Williamson 2023-10-13 13:16 ` Markus Armbruster 2023-10-17 13:44 ` Ankit Agrawal 2023-10-07 20:17 ` [PATCH v2 2/3] hw/acpi: Implement the SRAT GI affinity structure ankita 2023-10-09 21:16 ` Alex Williamson 2023-10-17 13:51 ` Ankit Agrawal 2023-10-07 20:17 ` [PATCH v2 3/3] qom: Link multiple numa nodes to device using a new object ankita 2023-10-09 12:30 ` Jonathan Cameron via 2023-10-09 12:30 ` Jonathan Cameron 2023-10-09 12:57 ` David Hildenbrand 2023-10-09 21:27 ` Alex Williamson 2023-10-17 14:18 ` Ankit Agrawal 2023-10-09 21:16 ` Alex Williamson 2023-10-17 14:00 ` Ankit Agrawal 2023-10-17 15:21 ` Alex Williamson 2023-10-17 15:28 ` Jason Gunthorpe 2023-10-17 16:54 ` Alex Williamson 2023-10-17 17:24 ` Jason Gunthorpe 2023-10-13 13:17 ` Markus Armbruster
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=20231012095954.00006ebb@Huawei.com \ --to=qemu-devel@nongnu.org \ --cc=ACurrid@nvidia.com \ --cc=Jonathan.Cameron@Huawei.com \ --cc=alex.williamson@redhat.com \ --cc=ani@anisinha.ca \ --cc=aniketa@nvidia.com \ --cc=ankita@nvidia.com \ --cc=armbru@redhat.com \ --cc=berrange@redhat.com \ --cc=cjia@nvidia.com \ --cc=clg@redhat.com \ --cc=dave.jiang@intel.com \ --cc=david@redhat.com \ --cc=dnigam@nvidia.com \ --cc=eblake@redhat.com \ --cc=eduardo@habkost.net \ --cc=gshan@redhat.com \ --cc=imammedo@redhat.com \ --cc=jgg@nvidia.com \ --cc=kwankhede@nvidia.com \ --cc=mst@redhat.com \ --cc=peter.maydell@linaro.org \ --cc=qemu-arm@nongnu.org \ --cc=sdonthineni@nvidia.com \ --cc=shannon.zhaosl@gmail.com \ --cc=targupta@nvidia.com \ --cc=udhoke@nvidia.com \ --cc=vsethi@nvidia.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: linkBe 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; as well as URLs for NNTP newsgroup(s).