[1/2] drivers/dax/kmem: use default numa_mem_id if target_node is invalid
diff mbox series

Message ID 20190816111844.87442-2-justin.he@arm.com
State New
Headers show
Series
  • Fix and support dax kmem on arm64
Related show

Commit Message

Jia He Aug. 16, 2019, 11:18 a.m. UTC
In some platforms(e.g arm64 guest), the NFIT info might not be ready.
Then target_node might be -1. But if there is a default numa_mem_id(),
we can use it to avoid unnecessary fatal EINVL error.

devm_memremap_pages() also uses this logic if nid is invalid, we can
keep the same page with it.

Signed-off-by: Jia He <justin.he@arm.com>
---
 drivers/dax/kmem.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jia He Sept. 3, 2019, 9:26 a.m. UTC | #1
Hi
Ping.
The target_node will be -1 if numa disabled. IIUC, it is a generic issue, not only on arm64.


--
Cheers,
Justin (Jia He)



> -----Original Message-----
> From: Jia He <justin.he@arm.com>
> Sent: 2019年8月16日 19:19
> To: Dan Williams <dan.j.williams@intel.com>; Vishal Verma
> <vishal.l.verma@intel.com>
> Cc: Keith Busch <keith.busch@intel.com>; Dave Jiang
> <dave.jiang@intel.com>; linux-nvdimm@lists.01.org; linux-
> kernel@vger.kernel.org; Justin He (Arm Technology China)
> <Justin.He@arm.com>
> Subject: [PATCH 1/2] drivers/dax/kmem: use default numa_mem_id if
> target_node is invalid
>
> In some platforms(e.g arm64 guest), the NFIT info might not be ready.
> Then target_node might be -1. But if there is a default numa_mem_id(),
> we can use it to avoid unnecessary fatal EINVL error.
>
> devm_memremap_pages() also uses this logic if nid is invalid, we can
> keep the same page with it.
>
> Signed-off-by: Jia He <justin.he@arm.com>
> ---
>  drivers/dax/kmem.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
> index a02318c6d28a..ad62d551d94e 100644
> --- a/drivers/dax/kmem.c
> +++ b/drivers/dax/kmem.c
> @@ -33,9 +33,9 @@ int dev_dax_kmem_probe(struct device *dev)
>        */
>       numa_node = dev_dax->target_node;
>       if (numa_node < 0) {
> -             dev_warn(dev, "rejecting DAX region %pR with invalid
> node: %d\n",
> -                      res, numa_node);
> -             return -EINVAL;
> +             dev_warn(dev, "DAX %pR with invalid node, assume it
> as %d\n",
> +                             res, numa_node, numa_mem_id());
> +             numa_node = numa_mem_id();
>       }
>
>       /* Hotplug starting at the beginning of the next block: */
> --
> 2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Patch
diff mbox series

diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index a02318c6d28a..ad62d551d94e 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -33,9 +33,9 @@  int dev_dax_kmem_probe(struct device *dev)
 	 */
 	numa_node = dev_dax->target_node;
 	if (numa_node < 0) {
-		dev_warn(dev, "rejecting DAX region %pR with invalid node: %d\n",
-			 res, numa_node);
-		return -EINVAL;
+		dev_warn(dev, "DAX %pR with invalid node, assume it as %d\n",
+				res, numa_node, numa_mem_id());
+		numa_node = numa_mem_id();
 	}
 
 	/* Hotplug starting at the beginning of the next block: */