linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] virtio_pmem: populate numa information
@ 2022-11-15 21:40 Michael Sammler
  2022-12-06 19:03 ` Michael Sammler
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Sammler @ 2022-11-15 21:40 UTC (permalink / raw)
  To: Pankaj Gupta, Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Pasha Tatashin, Mina Almasry, nvdimm, linux-kernel
  Cc: Michael Sammler, Pankaj Gupta

Compute the numa information for a virtio_pmem device from the memory
range of the device. Previously, the target_node was always 0 since
the ndr_desc.target_node field was never explicitly set. The code for
computing the numa node is taken from cxl_pmem_region_probe in
drivers/cxl/pmem.c.

Signed-off-by: Michael Sammler <sammler@google.com>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@amd.com>
Tested-by: Mina Almasry <almasrymina@google.com>
---
Changes from v1:
- added Reviewed-by and Tested-by
- synced with mainline

drivers/nvdimm/virtio_pmem.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c
index 20da455d2ef6..a92eb172f0e7 100644
--- a/drivers/nvdimm/virtio_pmem.c
+++ b/drivers/nvdimm/virtio_pmem.c
@@ -32,7 +32,6 @@ static int init_vq(struct virtio_pmem *vpmem)
 static int virtio_pmem_probe(struct virtio_device *vdev)
 {
 	struct nd_region_desc ndr_desc = {};
-	int nid = dev_to_node(&vdev->dev);
 	struct nd_region *nd_region;
 	struct virtio_pmem *vpmem;
 	struct resource res;
@@ -79,7 +78,15 @@ static int virtio_pmem_probe(struct virtio_device *vdev)
 	dev_set_drvdata(&vdev->dev, vpmem->nvdimm_bus);

 	ndr_desc.res = &res;
-	ndr_desc.numa_node = nid;
+
+	ndr_desc.numa_node = memory_add_physaddr_to_nid(res.start);
+	ndr_desc.target_node = phys_to_target_node(res.start);
+	if (ndr_desc.target_node == NUMA_NO_NODE) {
+		ndr_desc.target_node = ndr_desc.numa_node;
+		dev_dbg(&vdev->dev, "changing target node from %d to %d",
+			NUMA_NO_NODE, ndr_desc.target_node);
+	}
+
 	ndr_desc.flush = async_pmem_flush;
 	ndr_desc.provider_data = vdev;
 	set_bit(ND_REGION_PAGEMAP, &ndr_desc.flags);
--
2.38.1.431.g37b22c650d-goog

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_pmem: populate numa information
  2022-11-15 21:40 [PATCH v2] virtio_pmem: populate numa information Michael Sammler
@ 2022-12-06 19:03 ` Michael Sammler
  2022-12-07  4:09   ` Gupta, Pankaj
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Sammler @ 2022-12-06 19:03 UTC (permalink / raw)
  To: Pankaj Gupta, Dan Williams, Vishal Verma, Dave Jiang, Ira Weiny,
	Pasha Tatashin, Mina Almasry, nvdimm, linux-kernel,
	Michael Sammler
  Cc: Pankaj Gupta

This patch is reviewed and tested. Is there anything that needs to be
done from my side (e.g. sync with mainline)?

(Adding my alternative email address to this thread as I will soon
lose access to the address I am sending this email from.)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_pmem: populate numa information
  2022-12-06 19:03 ` Michael Sammler
@ 2022-12-07  4:09   ` Gupta, Pankaj
  2022-12-07 10:33     ` Michael S. Tsirkin
  0 siblings, 1 reply; 5+ messages in thread
From: Gupta, Pankaj @ 2022-12-07  4:09 UTC (permalink / raw)
  To: Michael Sammler, Pankaj Gupta, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Pasha Tatashin, Mina Almasry, nvdimm,
	linux-kernel, Michael Sammler, virtualization
  Cc: dan.j.williams, Michael S. Tsirkin

+Cc [MST, virtualization-list]

Hi Dan, MST,

> This patch is reviewed and tested. Is there anything that needs to be
> done from my side (e.g. sync with mainline)?

If there are no further comments, Can we please merge this patch?

Thank You,
Pankaj

> 
> (Adding my alternative email address to this thread as I will soon
> lose access to the address I am sending this email from.)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_pmem: populate numa information
  2022-12-07  4:09   ` Gupta, Pankaj
@ 2022-12-07 10:33     ` Michael S. Tsirkin
  2022-12-07 10:40       ` Gupta, Pankaj
  0 siblings, 1 reply; 5+ messages in thread
From: Michael S. Tsirkin @ 2022-12-07 10:33 UTC (permalink / raw)
  To: Gupta, Pankaj
  Cc: Michael Sammler, Pankaj Gupta, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Pasha Tatashin, Mina Almasry, nvdimm,
	linux-kernel, Michael Sammler, virtualization

On Wed, Dec 07, 2022 at 05:09:42AM +0100, Gupta, Pankaj wrote:
> +Cc [MST, virtualization-list]
> 
> Hi Dan, MST,
> 
> > This patch is reviewed and tested. Is there anything that needs to be
> > done from my side (e.g. sync with mainline)?
> 
> If there are no further comments, Can we please merge this patch?
> 
> Thank You,
> Pankaj


I'll take a look. Generally if you want my attention you
should CC me on the patch.

Thanks,
MST

> > 
> > (Adding my alternative email address to this thread as I will soon
> > lose access to the address I am sending this email from.)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] virtio_pmem: populate numa information
  2022-12-07 10:33     ` Michael S. Tsirkin
@ 2022-12-07 10:40       ` Gupta, Pankaj
  0 siblings, 0 replies; 5+ messages in thread
From: Gupta, Pankaj @ 2022-12-07 10:40 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Michael Sammler, Pankaj Gupta, Dan Williams, Vishal Verma,
	Dave Jiang, Ira Weiny, Pasha Tatashin, Mina Almasry, nvdimm,
	linux-kernel, Michael Sammler, virtualization


> 
> I'll take a look. Generally if you want my attention you
> should CC me on the patch.

Sorry for that! Did not notice the entire Cc list earlier.

Best regards,
Pankaj


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-12-07 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-15 21:40 [PATCH v2] virtio_pmem: populate numa information Michael Sammler
2022-12-06 19:03 ` Michael Sammler
2022-12-07  4:09   ` Gupta, Pankaj
2022-12-07 10:33     ` Michael S. Tsirkin
2022-12-07 10:40       ` Gupta, Pankaj

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).