From: Alison Schofield <alison.schofield@intel.com>
To: Richard Cheng <icheng@nvidia.com>
Cc: <dave@stgolabs.ne>, <jic23@kernel.org>, <dave.jiang@intel.com>,
<vishal.l.verma@intel.com>, <iweiny@kernel.org>, <djbw@kernel.og>,
<fabio.m.de.francesco@linux.intel.com>, <rrichter@amd.com>,
<ming.li@zohomail.com>, <linux-cxl@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <newtonl@nvidia.com>,
<kristinc@nvidia.com>, <kaihengf@nvidia.com>, <kobak@nvidia.com>
Subject: Re: [PATCH v3] cxl/test: Enforce PMD alignment for volatile mock regions
Date: Tue, 26 May 2026 22:48:55 -0700 [thread overview]
Message-ID: <ahaFx9Ah04aKd-De@aschofie-mobl2.lan> (raw)
In-Reply-To: <ahZsCOIoIt9Ejom_@MWDK4CY14F>
On Wed, May 27, 2026 at 12:08:07PM +0800, Richard Cheng wrote:
> On Tue, May 26, 2026 at 04:21:30PM +0800, Alison Schofield wrote:
> > On Fri, May 22, 2026 at 01:44:57PM +0800, Richard Cheng wrote:
snip
> > > diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c
> > > index 418669927fb0..7a1105f9a0bb 100644
> > > --- a/tools/testing/cxl/test/cxl.c
> > > +++ b/tools/testing/cxl/test/cxl.c
> > > @@ -318,7 +318,7 @@ static struct {
> > > .restrictions = ACPI_CEDT_CFMWS_RESTRICT_HOSTONLYMEM |
> > > ACPI_CEDT_CFMWS_RESTRICT_VOLATILE,
> > > .qtg_id = FAKE_QTG_ID,
> > > - .window_size = SZ_256M,
> > > + .window_size = SZ_256M > PMD_SIZE ? SZ_256M : PMD_SIZE,
> >
> > Why not this: max_t(resource_size_t, SZ_256M, PMD_SIZE)
> >
>
> Hi Alison,
>
> Thanks for the feedback, but I doubt this will work.
> "max_t()" expands to a statement expression, which isn't a constant expression so it can't be used in this file-scope static initializer.
>
> I did the change and compile, the error is
> """
> include/linux/minmax.h:86:9: error: braced-group within expression
> allowed only inside a function
> 86 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); })
> | ^
> test/cxl.c:295:40: note: in expansion of macro 'max_t'
> 295 | .window_size = max_t(resource_size_t, SZ_256M, PMD_SIZE),
> """
>
> So I don't think this approach works, I would like to stick to ternary form if that's ok for you.
Sounds good, and right. Thanks for the explanation.
> > > + BUILD_BUG_ON(!IS_ALIGNED(MOCK_AUTO_REGION_SIZE_DEFAULT, PMD_SIZE));
> >
> > The rule we need to enforce is tha the actual auto region size is
> > PMD aligned, not the default definition. So I think this needs to
> > be a runtime check of IS_ALIGNED(mock_auto_region_size, PMD_SIZE).
> >
> > -- Alison
> >
>
> Thanks for the catch, I'll fix this and send a v4 to make it runtime check.
>
> Do you prefer WARN_ON_ONCE() to be ammend or no? I mean
>
> """
> if (!IS_ALIGNED(mock_auto_region_size, PMD_SIZE))
> return -EINVAL;
> """
> or
> """
> if (WARN_ON_ONCE(!IS_ALIGNED(mock_auto_region_size, PMD_SIZE)))
> return -EINVAL;
> """
>
> Which one do you prefer ? or any other idea ? please let me know and I'll make the change.
I don't think we need the backtrace of warn, how about this:
if (!IS_ALIGNED(mock_auto_region_size, PMD_SIZE)) {
pr_err_once("mock_auto_region_size %d must be PMD-aligned\n",
mock_auto_region_size);
return -EINVAL;
}
>
> Best regards,
> Richard Cheng.
>
> > > +
> > > cxl_acpi_test();
> > > cxl_core_test();
> > > cxl_mem_test();
> > >
> > > base-commit: 6779b50faa562e6cca1aa6a4649a4d764c6c7e28
> > > --
> > > 2.43.0
> > >
prev parent reply other threads:[~2026-05-27 5:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 5:44 Richard Cheng
2026-05-26 23:21 ` Alison Schofield
2026-05-27 4:08 ` Richard Cheng
2026-05-27 5:48 ` Alison Schofield [this message]
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=ahaFx9Ah04aKd-De@aschofie-mobl2.lan \
--to=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.ne \
--cc=djbw@kernel.og \
--cc=fabio.m.de.francesco@linux.intel.com \
--cc=icheng@nvidia.com \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=kaihengf@nvidia.com \
--cc=kobak@nvidia.com \
--cc=kristinc@nvidia.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=newtonl@nvidia.com \
--cc=rrichter@amd.com \
--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
all inboxes | Powered by JetHome®