Linux CXL
 help / color / mirror / Atom feed
* [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
@ 2025-02-07 19:34 alison.schofield
  2025-02-07 20:06 ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: alison.schofield @ 2025-02-07 19:34 UTC (permalink / raw)
  To: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Alison Schofield,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl

From: Alison Schofield <alison.schofield@intel.com>

The CXL specification defines CXL_MBOX_OP_SET_SHUTDOWN_STATE as
optional. Check the enabled_cmds bitmap before sending to device.

This appeared with cxl-test where mock support for this command
is not present and -EIO is returned, leading to a WARN_ONCE()
stack trace and dev_warn()'s on every cxl_nvdimm_probe.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---

Not sure what we actually want to do when not supported.
Most cmds just return 0, like I did here, but maybe for
this functionality something more is warranted.

wrt cxl-test support, also not sure if this feature wants some
round-trip testing support via cxl-test mocking. I do like the
-EIO from cxl-test as a loud reminder when running cxl-test 
that something new has come in that cxl-test doesn't know about.


 drivers/cxl/core/mbox.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
index c5eedcae3b02..f06a1ed81a6c 100644
--- a/drivers/cxl/core/mbox.c
+++ b/drivers/cxl/core/mbox.c
@@ -1289,6 +1289,10 @@ int cxl_dirty_shutdown_state(struct cxl_memdev_state *mds)
 		.state = 1
 	};
 
+	if (!test_bit(CXL_MEM_COMMAND_ID_SET_SHUTDOWN_STATE,
+		      cxl_mbox->enabled_cmds))
+		return 0;
+
 	mbox_cmd = (struct cxl_mbox_cmd) {
 		.opcode = CXL_MBOX_OP_SET_SHUTDOWN_STATE,
 		.size_in = sizeof(in),

base-commit: 5585e342e8d38cc598279bdb87f235f8b954dd5a
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
  2025-02-07 19:34 [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE alison.schofield
@ 2025-02-07 20:06 ` Dan Williams
  2025-02-07 21:19   ` Alison Schofield
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2025-02-07 20:06 UTC (permalink / raw)
  To: alison.schofield, Davidlohr Bueso, Jonathan Cameron, Dave Jiang,
	Vishal Verma, Ira Weiny, Dan Williams
  Cc: linux-cxl

alison.schofield@ wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> The CXL specification defines CXL_MBOX_OP_SET_SHUTDOWN_STATE as
> optional. Check the enabled_cmds bitmap before sending to device.

Table 8-126 defines it as mandatory for devices that support PMEM, see
the "PM" in the "Mailbox" column.

> This appeared with cxl-test where mock support for this command
> is not present and -EIO is returned, leading to a WARN_ONCE()
> stack trace and dev_warn()'s on every cxl_nvdimm_probe.

Davidlohr and I talked about this here:

http://lore.kernel.org/679430b145dc0_20fa2947b@dwillia2-xfh.jf.intel.com.notmuch

The plan was to follow up with mock device support... oh, that came in
on Tuesday, I need to go take a look at that:

http://lore.kernel.org/20250205040842.1253616-1-dave@stgolabs.net

> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> 
> Not sure what we actually want to do when not supported.
> Most cmds just return 0, like I did here, but maybe for
> this functionality something more is warranted.
> 
> wrt cxl-test support, also not sure if this feature wants some
> round-trip testing support via cxl-test mocking. I do like the
> -EIO from cxl-test as a loud reminder when running cxl-test 
> that something new has come in that cxl-test doesn't know about.

Have a look at that follow-up series and see if it addresses the
concerns.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE
  2025-02-07 20:06 ` Dan Williams
@ 2025-02-07 21:19   ` Alison Schofield
  0 siblings, 0 replies; 3+ messages in thread
From: Alison Schofield @ 2025-02-07 21:19 UTC (permalink / raw)
  To: Dan Williams
  Cc: Davidlohr Bueso, Jonathan Cameron, Dave Jiang, Vishal Verma,
	Ira Weiny, linux-cxl

On Fri, Feb 07, 2025 at 12:06:07PM -0800, Dan Williams wrote:
> alison.schofield@ wrote:
> > From: Alison Schofield <alison.schofield@intel.com>
> > 
> > The CXL specification defines CXL_MBOX_OP_SET_SHUTDOWN_STATE as
> > optional. Check the enabled_cmds bitmap before sending to device.
> 
> Table 8-126 defines it as mandatory for devices that support PMEM, see
> the "PM" in the "Mailbox" column.
> 
> > This appeared with cxl-test where mock support for this command
> > is not present and -EIO is returned, leading to a WARN_ONCE()
> > stack trace and dev_warn()'s on every cxl_nvdimm_probe.
> 
> Davidlohr and I talked about this here:
> 
> http://lore.kernel.org/679430b145dc0_20fa2947b@dwillia2-xfh.jf.intel.com.notmuch
> 
> The plan was to follow up with mock device support... oh, that came in
> on Tuesday, I need to go take a look at that:
> 
> http://lore.kernel.org/20250205040842.1253616-1-dave@stgolabs.net

Ah, I see it now. I saw the GPF patch in cxl/next and didn't want
to dilly-dally! Should've dillied a bit.

I'll try out your cxl-test patch David.

--Alison


> 
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> > ---
> > 
> > Not sure what we actually want to do when not supported.
> > Most cmds just return 0, like I did here, but maybe for
> > this functionality something more is warranted.
> > 
> > wrt cxl-test support, also not sure if this feature wants some
> > round-trip testing support via cxl-test mocking. I do like the
> > -EIO from cxl-test as a loud reminder when running cxl-test 
> > that something new has come in that cxl-test doesn't know about.
> 
> Have a look at that follow-up series and see if it addresses the
> concerns.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-07 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-07 19:34 [PATCH] cxl/mbox: Check enabled_cmds before sending SET_SHUTDOWN_STATE alison.schofield
2025-02-07 20:06 ` Dan Williams
2025-02-07 21:19   ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox