From: Anisa Su <anisa.su887@gmail.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Anisa Su <anisa.su887@gmail.com>,
linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
linux-kernel@vger.kernel.org, Dave Jiang <dave.jiang@intel.com>,
Jonathan Cameron <jic23@kernel.org>, Fan Ni <nifan.cxl@gmail.com>,
Li Ming <ming.li@zohomail.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Ira Weiny <iweiny@kernel.org>,
Benjamin Cheatham <benjamin.cheatham@amd.com>,
Wonjae Lee <wj28.lee@samsung.com>,
Junhee Park <jh9934.park@samsung.com>,
Heesoo Kim <habil.kim@samsung.com>
Subject: Re: [PATCH v12 6/8] cxl/mem: Configure dynamic capacity interrupts
Date: Fri, 7 Aug 2026 07:11:42 +0900 [thread overview]
Message-ID: <anUGnhq094ykZM1a@cxlqual> (raw)
In-Reply-To: <anEzpWk5jRdwMwvt@aschofie-mobl2.lan>
On Mon, Aug 03, 2026 at 05:34:45PM -0700, Alison Schofield wrote:
> On Fri, Jul 31, 2026 at 01:48:11AM -0700, Anisa Su wrote:
> > From: Ira Weiny <iweiny@kernel.org>
> >
> > Dynamic Capacity Devices (DCD) support extent change notifications
> > through the event log mechanism. The interrupt mailbox commands were
> > extended in CXL 3.1 to support these notifications. Firmware can't
> > configure DCD events to be FW controlled but can retain control of
> > memory events.
> >
> > Configure DCD event log interrupts on devices supporting dynamic
> > capacity. Disable DCD if interrupts are not supported.
> >
> > Care is taken to preserve the interrupt policy set by the FW if FW first
> > has been selected by the BIOS.
>
> Hi Anisa,
>
> I gave one comment in response to a Sashiko comment, wrt 'drain'.
> Another below-
>
>
> > +
> > + /*
> > + * A CXL 3.0+ device can carry dcd_settings field without DCD command
> > + * support, so size the request by the device's policy_size and only
> > + * enable the DCD interrupt when DCD commands are supported.
> > + */
> > + if (cxl_dcd_supported(mds))
> > + policy->dcd_settings = CXL_INT_MSI_MSIX;
> >
> > mbox_cmd = (struct cxl_mbox_cmd) {
> > .opcode = CXL_MBOX_OP_SET_EVT_INT_POLICY,
> > .payload_in = policy,
> > - .size_in = sizeof(*policy),
> > + .size_in = policy_size,
> > };
>
> Can you help me understand what happens if policy_size is only 4 bytes.
> dcd_settings is never sent in the Set command. How do we know cxl_irqsetup()
> isn't using a value the device never accepted?
>
Hmmm... good catch. If a non spec-compliant device reports support for all four 48h commands in the
CEL but simultaneously reports a 4 byte policy_size, the device will never see
policy->dcd_settings. Then the re-read at the end of cxl_event_config_msgnums()
doesn't erase the value that was never really set on the device:
/* Retrieve final interrupt settings */
return cxl_event_get_int_policy(mds, policy, NULL);
^ reads into the same struct, the device returns 4 bytes again, and byte 5
keeps the value the driver just wrote. So "final interrupt settings" is
the driver's own value round-tripping back for that field, and
cxl_irqsetup() arms the DCD interrupt from it.
A spec-compliant device can't trigger this, since cxl_dcd_supported() requires all
four 48h commands in the CEL, DCD is CXL 3.x, and a 3.x Get Event
Interrupt Policy returns the 5 byte policy including dcd_settings. But to
enforce it explicitly in the driver, added the check below in cxl_event_config(),
before cxl_event_config_msgnums():
/*
* dcd_settings cannot be sent to a device whose policy is too short
* to hold it, so the device would never accept the setting
* cxl_irqsetup() arms the DCD interrupt with.
*/
if (cxl_dcd_supported(mds) && policy_size < sizeof(policy)) {
dev_warn(mds->cxlds.dev,
"DCD supported but interrupt policy is only %zu bytes\n",
policy_size);
cxl_disable_dcd(mds);
}
Disabling DCD makes cxl_dcd_supported() false, so the Set stops setting
dcd_settings and cxl_irqsetup() skips the DCD interrupt.
Thanks,
Anisa
>
> > rc = cxl_internal_send_cmd(cxl_mbox, &mbox_cmd);
> > @@ -596,7 +635,7 @@ static int cxl_event_config_msgnums(struct cxl_memdev_state *mds,
> > }
> >
> > /* Retrieve final interrupt settings */
> > - return cxl_event_get_int_policy(mds, policy);
> > + return cxl_event_get_int_policy(mds, policy, NULL);
> > }
>
> snip
>
next prev parent reply other threads:[~2026-08-06 22:11 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 8:48 [PATCH v12 0/8] DCD Prep Series Anisa Su
2026-07-31 8:48 ` [PATCH v12 1/8] cxl/mbox: Flag support for Dynamic Capacity Devices (DCD) Anisa Su
2026-08-03 18:03 ` Dave Jiang
2026-08-03 21:30 ` Alison Schofield
2026-08-03 23:12 ` Jonathan Cameron
2026-08-04 15:45 ` Gregory Price
2026-08-04 15:45 ` Gregory Price
2026-08-04 18:10 ` Anisa Su
2026-08-04 16:55 ` Alison Schofield
2026-08-04 18:13 ` Anisa Su
2026-07-31 8:48 ` [PATCH v12 2/8] cxl/mem: Read dynamic capacity configuration from the device Anisa Su
2026-07-31 9:01 ` sashiko-bot
2026-08-04 20:30 ` Anisa Su
2026-08-03 14:33 ` Richard Cheng
2026-08-03 22:11 ` Anisa Su
2026-08-03 21:52 ` Alison Schofield
2026-08-04 9:12 ` Anisa Su
2026-08-04 16:00 ` Gregory Price
2026-08-03 23:55 ` Jonathan Cameron
2026-08-04 9:54 ` Anisa Su
2026-07-31 8:48 ` [PATCH v12 3/8] cxl/cdat: Gather DSMAS data for DCD partitions Anisa Su
2026-07-31 9:02 ` sashiko-bot
2026-08-04 0:07 ` Jonathan Cameron
2026-08-05 8:30 ` Anisa Su
2026-08-03 22:56 ` Alison Schofield
2026-08-05 6:58 ` Anisa Su
2026-07-31 8:48 ` [PATCH v12 4/8] cxl/events: Split event msgnum configuration from irq setup Anisa Su
2026-08-03 23:01 ` Alison Schofield
2026-07-31 8:48 ` [PATCH v12 5/8] cxl/pci: Factor out interrupt policy check Anisa Su
2026-08-03 23:55 ` Alison Schofield
2026-08-06 12:27 ` Anisa Su
2026-07-31 8:48 ` [PATCH v12 6/8] cxl/mem: Configure dynamic capacity interrupts Anisa Su
2026-07-31 9:04 ` sashiko-bot
2026-08-01 9:30 ` Anisa Su
2026-08-04 0:25 ` Alison Schofield
2026-08-06 23:27 ` Anisa Su
2026-08-04 0:13 ` Jonathan Cameron
2026-08-04 0:34 ` Alison Schofield
2026-08-06 22:11 ` Anisa Su [this message]
2026-07-31 8:48 ` [PATCH v12 7/8] cxl/core: Return endpoint decoder information from region search Anisa Su
2026-07-31 9:01 ` sashiko-bot
2026-08-04 1:02 ` Alison Schofield
2026-07-31 8:48 ` [PATCH v12 8/8] cxl/core: Enforce partition order/simplify partition calls Anisa Su
2026-08-04 0:16 ` Jonathan Cameron
2026-08-04 1:37 ` Alison Schofield
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=anUGnhq094ykZM1a@cxlqual \
--to=anisa.su887@gmail.com \
--cc=alison.schofield@intel.com \
--cc=benjamin.cheatham@amd.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=habil.kim@samsung.com \
--cc=iweiny@kernel.org \
--cc=jh9934.park@samsung.com \
--cc=jic23@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=nifan.cxl@gmail.com \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
--cc=wj28.lee@samsung.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 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.