Linux CXL
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Richard Cheng <icheng@nvidia.com>
Cc: linux-cxl@vger.kernel.org, djbw@kernel.org, dave@stgolabs.net,
	jic23@kernel.org, alison.schofield@intel.com,
	vishal.l.verma@intel.com
Subject: Re: [PATCH v5 1/6] cxl/test: Add test for module parameters
Date: Fri, 12 Jun 2026 08:35:43 -0700	[thread overview]
Message-ID: <5cf32fe7-da4a-46ab-b1ff-8cc5b0678dc3@intel.com> (raw)
In-Reply-To: <aittuDSmdIzR7X5U@MWDK4CY14F>



On 6/11/26 7:33 PM, Richard Cheng wrote:
> On Thu, Jun 11, 2026 at 04:44:04PM +0800, Dave Jiang wrote:
>> Add a test for module paraters during module init to make sure that
>> only one is activated.
> 
> "paraters" -> "parameters".

ok

> 
>>
>> Suggested-by: Alison Schofield <alison.schofield@intel.com>
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>> v5:
>> - Add test for hmem_test module parameters. (sashiko)
>> ---
>>  tools/testing/cxl/test/cxl.c       | 20 ++++++++++++++++++++
>>  tools/testing/cxl/test/hmem_test.c |  3 ++-
>>  tools/testing/cxl/test/mock.h      |  2 ++
>>  3 files changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
>> index 296516eecfd6..1c8ac8bdd8f7 100644
>> --- a/tools/testing/cxl/test/cxl.c
>> +++ b/tools/testing/cxl/test/cxl.c
>> @@ -1814,11 +1814,31 @@ static struct attribute *cxl_acpi_attrs[] = {
>>  };
>>  ATTRIBUTE_GROUPS(cxl_acpi);
>>  
>> +static bool __init have_multiple_modparms(void)
>> +{
>> +	int count = 0;
>> +
>> +	if (interleave_arithmetic)
>> +		count++;
> 
> Should we make it a boolean ?
> It should only work with 0 or 1 right ?

I don't follow. The intention is that if there are >1 parameters then it fails.

DJ

> 
> --Richard
> 
>> +	if (extended_linear_cache)
>> +		count++;
>> +	if (fail_autoassemble)
>> +		count++;
>> +	if (hmem_test)
>> +		count++;
>> +
>> +	return count > 1;
>> +}
>> +
>>  static __init int cxl_test_init(void)
>>  {
>>  	int rc, i;
>>  	struct range mappable;
>>  
>> +	/* Enforce a single module param active at a time */
>> +	if (have_multiple_modparms())
>> +		return -EINVAL;
>> +
>>  	cxl_acpi_test();
>>  	cxl_core_test();
>>  	cxl_mem_test();
>> diff --git a/tools/testing/cxl/test/hmem_test.c b/tools/testing/cxl/test/hmem_test.c
>> index 3a1a089e1721..0fa00f7e16db 100644
>> --- a/tools/testing/cxl/test/hmem_test.c
>> +++ b/tools/testing/cxl/test/hmem_test.c
>> @@ -3,8 +3,9 @@
>>  #include <linux/moduleparam.h>
>>  #include <linux/workqueue.h>
>>  #include "../../../drivers/dax/bus.h"
>> +#include "mock.h"
>>  
>> -static bool hmem_test;
>> +bool hmem_test;
>>  
>>  static void hmem_test_work(struct work_struct *work)
>>  {
>> diff --git a/tools/testing/cxl/test/mock.h b/tools/testing/cxl/test/mock.h
>> index 4f57dc80ae7d..846d7c5d6eaa 100644
>> --- a/tools/testing/cxl/test/mock.h
>> +++ b/tools/testing/cxl/test/mock.h
>> @@ -5,6 +5,8 @@
>>  #include <linux/dax.h>
>>  #include <cxl.h>
>>  
>> +extern bool hmem_test;
>> +
>>  struct cxl_mock_ops {
>>  	struct list_head list;
>>  	bool (*is_mock_adev)(struct acpi_device *dev);
>> -- 
>> 2.54.0
>>
>>


  reply	other threads:[~2026-06-12 15:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-11 23:44 [PATCH v5 0/6] cxl: Add CXL type2 accelerator support for cxl_test Dave Jiang
2026-06-11 23:44 ` [PATCH v5 1/6] cxl/test: Add test for module parameters Dave Jiang
2026-06-11 23:59   ` sashiko-bot
2026-06-12  2:33   ` Richard Cheng
2026-06-12 15:35     ` Dave Jiang [this message]
2026-06-11 23:44 ` [PATCH v5 2/6] cxl/test: Add type2 support for mock CFMWS0 Dave Jiang
2026-06-11 23:56   ` sashiko-bot
2026-06-11 23:44 ` [PATCH v5 3/6] cxl/test: Refactor platform device enumerations Dave Jiang
2026-06-11 23:44 ` [PATCH v5 4/6] cxl/test: Add hierarchy enumeration support for type2 device Dave Jiang
2026-06-11 23:44 ` [PATCH v5 5/6] cxl/test: Fixup hdm init for auto region to support type2 Dave Jiang
2026-06-11 23:44 ` [PATCH v5 6/6] cxl/test: Add cxl_test accelerator driver Dave Jiang
2026-06-11 23:58   ` sashiko-bot
2026-06-12  2:44     ` Richard Cheng
2026-06-12 15:38       ` Dave Jiang
2026-06-17 14:24   ` Uwe Kleine-König
2026-06-17 17:28     ` 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=5cf32fe7-da4a-46ab-b1ff-8cc5b0678dc3@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dave@stgolabs.net \
    --cc=djbw@kernel.org \
    --cc=icheng@nvidia.com \
    --cc=jic23@kernel.org \
    --cc=linux-cxl@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