[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230621103411.113030-1-tsahu@linux.ibm.com>
Date: Wed, 21 Jun 2023 16:04:11 +0530
From: Tarun Sahu <tsahu@...ux.ibm.com>
To: nvdimm@...ts.linux.dev, linux-cxl@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, dave.jiang@...el.com,
dan.j.williams@...el.com, vishal.l.verma@...el.com,
aneesh.kumar@...ux.ibm.com, jaypatel@...ux.ibm.com,
tsahu@...ux.ibm.com
Subject: [PATCH v2] dax/kmem: Pass valid argument to memory_group_register_static
memory_group_register_static takes maximum number of pages as the argument
while dev_dax_kmem_probe passes total_len (in bytes) as the argument.
IIUC, I don't see any crash/panic impact as such. As,
memory_group_register_static just set the max_pages limit which is used in
auto_movable_zone_for_pfn to determine the zone.
which might cause these condition to behave differently,
This will be true always so jump will happen to kernel_zone
if (!auto_movable_can_online_movable(NUMA_NO_NODE, group, nr_pages))
goto kernel_zone;
---
kernel_zone:
return default_kernel_zone_for_pfn(nid, pfn, nr_pages);
---
Here, In below, zone_intersects compare range will be larger as nr_pages
will be higher (derived from total_len passed in dev_dax_kmem_probe).
static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn,
unsigned long nr_pages)
{
struct pglist_data *pgdat = NODE_DATA(nid);
int zid;
for (zid = 0; zid < ZONE_NORMAL; zid++) {
struct zone *zone = &pgdat->node_zones[zid];
if (zone_intersects(zone, start_pfn, nr_pages))
return zone;
}
return &pgdat->node_zones[ZONE_NORMAL];
}
Incorrect zone will be returned here, which in later time might cause bigger
problem.
Fixes: eedf634aac3b ("dax/kmem: use a single static memory group for a single probed unit")
Signed-off-by: Tarun Sahu <tsahu@...ux.ibm.com>
Reviewed-by: Vishal Verma <vishal.l.verma@...el.com>
---
drivers/dax/kmem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index 7b36db6f1cbd..898ca9505754 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -99,7 +99,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
if (!data->res_name)
goto err_res_name;
- rc = memory_group_register_static(numa_node, total_len);
+ rc = memory_group_register_static(numa_node, PFN_UP(total_len));
if (rc < 0)
goto err_reg_mgid;
data->mgid = rc;
--
2.31.1
Powered by blists - more mailing lists