From: Li Ming <ming.li@zohomail.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: dave@stgolabs.net, jic23@kernel.org, dave.jiang@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com, djbw@kernel.org,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/1] cxl/test: Update mock dev array before calling platform_device_add()
Date: Fri, 22 May 2026 19:50:59 +0800 [thread overview]
Message-ID: <83dc5f69-115b-4d2a-bc0e-46ed0c3cee10@zohomail.com> (raw)
In-Reply-To: <082c7b2d-e9dc-443a-b385-79585cf8e48d@zohomail.com>
在 2026/5/21 20:25, Li Ming 写道:
>
> 在 2026/5/21 15:25, Alison Schofield 写道:
>> On Wed, May 20, 2026 at 08:14:57PM +0800, Li Ming wrote:
>>> CXL test environment hits the following error sometimes.
>>>
>>> cxl_mem mem9: endpoint7 failed probe
>>>
>>> All mock memdevs are platform firmware devices added by cxl_test
>>> module,
>>> and cxl_test module also provides a platform device driver for them to
>>> create a memdev device to CXL subsystem. cxl_test module uses
>>> cxl_rcd/mem_single/mem arrays to store different types of mock memdevs.
>>> CXL drivers calls registered mock functions for a mock memdev by
>>> checking if a given memdev is in these arrays.
>>>
>>> When cxl_test module adds these mock memdevs, it always calls
>>> platform_device_add() before adding them to a suitable mock memdev
>>> array. However, there is a small window where CXL drivers calls mock
>>> function for a added memdev before it added to a mock memdev array. In
>>> above case, cxl endpoint driver considers a added memdev was not a mock
>>> memdev, then calling devm_cxl_endpoint_decoders_setup() for it rather
>>> than mock_endpoint_decoders_setup().
>>>
>>> An appropriate solution is that adding a new mock device to a mock
>>> device array before calling platform_device_add() for it. It can
>>> guarantee the new mock device is visible to CXL subsystem.
>>>
>>> This patch introduces a new helped called
>>> cxl_mock_platform_device_add()
>>> to handle the issue, and uses the function for all mock devices
>>> addition.
>>>
>> Reviewed-by: Alison Schofield <alison.schofield@intel.com>
>
> Hi Alison,
>
>
> I missed that you mentioned putting platform_device_alloc() into the
> helper. I will send out v3 for that.
>
>
After taking a look into the implementation, maybe keep current
implementation would be better.
This helper is responsible for performing the platform_device_add()
operation for all mock devices. However, each type of mock device has
its own specific logic between platform_device_alloc() and
platform_device_add().
If I move platform_device_alloc() into this helper,I will also have to
incorporate all these device-specific implementations.
Ming
> Ming
>
>>
>>
>>> Fixes: 3a2b97b3210b ("cxl/test: Improve init-order fidelity relative
>>> to real-world systems")
>>> Signed-off-by: Li Ming <ming.li@zohomail.com>
>>> ---
>>> Changes from v1:
>>> - Rebase to v7.1-rc4.
>>> - Introduce a new helper to handle the issue. (Alison)
>>> - Use new helper for all mock device addition.
>>> ---
>>> tools/testing/cxl/test/cxl.c | 105
>>> ++++++++++++++---------------------
>>> 1 file changed, 43 insertions(+), 62 deletions(-)
>>>
next prev parent reply other threads:[~2026-05-22 11:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 12:14 [PATCH v2 1/1] cxl/test: Update mock dev array before calling platform_device_add() Li Ming
2026-05-21 7:25 ` Alison Schofield
2026-05-21 12:25 ` Li Ming
2026-05-22 11:50 ` Li Ming [this message]
2026-05-26 20:49 ` Alison Schofield
2026-05-26 21:36 ` 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=83dc5f69-115b-4d2a-bc0e-46ed0c3cee10@zohomail.com \
--to=ming.li@zohomail.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=djbw@kernel.org \
--cc=ira.weiny@intel.com \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.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: link
Be 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