All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: <dave.jiang@intel.com>, <djbw@kernel.org>, <jic23@kernel.org>,
	<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] cxl/test: Map mock device nodes to an online node
Date: Mon, 17 Aug 2026 17:26:11 -0700	[thread overview]
Message-ID: <aoOmo-DZudbSOV3N@aschofie-mobl2.lan> (raw)
In-Reply-To: <20260723180630.1302871-1-dave@stgolabs.net>

On Thu, Jul 23, 2026 at 11:06:30AM -0700, Davidlohr Bueso wrote:
> cxl_mem_init() assigns alternating NUMA nodes to the mock memdevs
> to model multi-node topologies. On a single-node host node 1 has
> no pgdat, and the first node-aware allocation in an odd device's
> probe faults on a NULL zonelist:
> 
>   Oops: general protection fault, probably for non-canonical address 0xdffffc00000006e3
>   KASAN: probably user-memory-access in range [0x0000000000003718-0x000000000000371f]
>   Workqueue: async async_run_entry_fn
>   RIP: __alloc_frozen_pages_noprof+0x288
>    new_slab
>    ___slab_alloc
>    __kmalloc_node_track_caller_noprof
>    devm_kmalloc
>    cxl_mock_mem_probe
> 
> Map the requested node to an online one, as dax_hmem already does
> for its target node.
> 
> Fixes: cf1f6877b088 ("cxl/memdev: Add numa_node attribute")
> Fixes: e41c8452b9b2 ("tools/testing/cxl: Add a single-port host-bridge regression config")
> Fixes: c9435dbee119 ("tools/testing/cxl: Add an RCH topology")
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
> ---
> Found while regression testing unrelated work.

Hi Davidlohr,

Thanks for fixing up cxl-test!
My short response is:
	Reviewed-by: Alison Schofield <alison.schofield@intel.com>
	Tested-by: Alison Schofield <alison.schofield@intel.com>

And the long version is, I tested this and it failed somewhere
else. I have CONFIG_PINCTRL=y so the first node aware allocation 
lands in the device core, not in cxl_mock_mem_probe(). Looks like:

BUG: unable to handle page fault for address: 0000000000002d18
    RIP: 0010:__alloc_frozen_pages_noprof+0x120/0x310
     allocate_slab
     new_slab
     __slab_alloc_node
     __kmalloc_node_track_caller_noprof
     devm_kmalloc
     pinctrl_bind_pins
     really_probe

We (me) had not seen this because our cxl_test guests always have two or more
CPU-and-memory nodes, plus memory-only and nvdimm nodes on top. Node 1 is
online, so numa_map_to_online_node() is a no-op.

It reproduces with a single -numa node holding the CPUs and all memory.
That is one proximity domain, node_possible_map == {0}, no pgdat for node 1.

These settings appear as different presets for folks using run_qemu [1].
The 'tiny' option must be selected to hit this.

I'm thinking about how to work 'tiny' into the regular regression runs.

Good find Davidlohr!


-- Alison

[1] https://github.com/pmem/run_qemu


> 
>  tools/testing/cxl/test/cxl.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> index ef92dd35e030..5156516a82d2 100644
> --- a/tools/testing/cxl/test/cxl.c
> +++ b/tools/testing/cxl/test/cxl.c
> @@ -1748,7 +1748,7 @@ static int cxl_mem_init(void)
>  		if (!pdev)
>  			goto err_mem;
>  		pdev->dev.parent = &dport->dev;
> -		set_dev_node(&pdev->dev, i % 2);
> +		set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
>  
>  		rc = cxl_mock_platform_device_add(pdev, &cxl_mem[i]);
>  		if (rc)
> @@ -1763,7 +1763,7 @@ static int cxl_mem_init(void)
>  		if (!pdev)
>  			goto err_single;
>  		pdev->dev.parent = &dport->dev;
> -		set_dev_node(&pdev->dev, i % 2);
> +		set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
>  
>  		rc = cxl_mock_platform_device_add(pdev, &cxl_mem_single[i]);
>  		if (rc)
> @@ -1779,7 +1779,7 @@ static int cxl_mem_init(void)
>  		if (!pdev)
>  			goto err_rcd;
>  		pdev->dev.parent = &rch->dev;
> -		set_dev_node(&pdev->dev, i % 2);
> +		set_dev_node(&pdev->dev, numa_map_to_online_node(i % 2));
>  
>  		rc = cxl_mock_platform_device_add(pdev, &cxl_rcd[i]);
>  		if (rc)
> -- 
> 2.39.5
> 

  parent reply	other threads:[~2026-08-18  0:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 18:06 [PATCH] cxl/test: Map mock device nodes to an online node Davidlohr Bueso
2026-07-23 20:44 ` Dave Jiang
2026-08-18  0:26 ` Alison Schofield [this message]
2026-08-18 16:06 ` shaikh kamaluddin
2026-08-19 16:19 ` Gregory Price
2026-08-19 21:12   ` Dave Jiang

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=aoOmo-DZudbSOV3N@aschofie-mobl2.lan \
    --to=alison.schofield@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.