diff mbox series

[1/2] cxl/memdev: Replace ENXIO with EBUSY for inject poison limit reached

Message ID 3d37cb23115a99dbf38913360c65e360038ad6a1.1720052137.git.alison.schofield@intel.com
State Superseded
Headers show
Series Return EBUSY on inject poison limit reached | expand

Commit Message

Alison Schofield July 4, 2024, 12:38 a.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

The CXL driver provides a debugfs interface offering users the
ability to inject and clear poison to a memdev. Once a user has
injected up to the devices limit further injection requests fail
with ENXIO until a clear poison is issued.

Users may not have device specs in hand or may want to intentionally
hit the limit and then clear. Replace the usual ENXIO return status
with EBUSY so users can recognize this failure.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 Documentation/ABI/testing/debugfs-cxl | 7 ++++---
 drivers/cxl/cxlmem.h                  | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

Comments

Xingtao Yao (Fujitsu) July 5, 2024, 6:59 a.m. UTC | #1
Tested-by: Xingtao Yao <yaoxt.fnst@fujitsu.com>

> -----Original Message-----
> From: alison.schofield@intel.com <alison.schofield@intel.com>
> Sent: Thursday, July 4, 2024 8:38 AM
> To: Davidlohr Bueso <dave@stgolabs.net>; Jonathan Cameron
> <Jonathan.Cameron@huawei.com>; Dave Jiang <dave.jiang@intel.com>; Alison
> Schofield <alison.schofield@intel.com>; Vishal Verma
> <vishal.l.verma@intel.com>; Ira Weiny <ira.weiny@intel.com>; Dan Williams
> <dan.j.williams@intel.com>
> Cc: linux-cxl@vger.kernel.org
> Subject: [PATCH 1/2] cxl/memdev: Replace ENXIO with EBUSY for inject poison
> limit reached
> 
> From: Alison Schofield <alison.schofield@intel.com>
> 
> The CXL driver provides a debugfs interface offering users the
> ability to inject and clear poison to a memdev. Once a user has
> injected up to the devices limit further injection requests fail
> with ENXIO until a clear poison is issued.
> 
> Users may not have device specs in hand or may want to intentionally
> hit the limit and then clear. Replace the usual ENXIO return status
> with EBUSY so users can recognize this failure.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
>  Documentation/ABI/testing/debugfs-cxl | 7 ++++---
>  drivers/cxl/cxlmem.h                  | 2 +-
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/debugfs-cxl
> b/Documentation/ABI/testing/debugfs-cxl
> index c61f9b813973..12488c14be64 100644
> --- a/Documentation/ABI/testing/debugfs-cxl
> +++ b/Documentation/ABI/testing/debugfs-cxl
> @@ -14,9 +14,10 @@ Description:
>  		event to its internal Informational Event log, updates the
>  		Event Status register, and if configured, interrupts the host.
>  		It is not an error to inject poison into an address that
> -		already has poison present and no error is returned. The
> -		inject_poison attribute is only visible for devices supporting
> -		the capability.
> +		already has poison present and no error is returned. If the
> +		device returns 'Inject Poison Limit Reached' an -EBUSY error
> +		is returned to the user. The inject_poison attribute is only
> +		visible for devices supporting the capability.
> 
> 
>  What:		/sys/kernel/debug/memX/clear_poison
> diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> index 19aba81cdf13..942063c09459 100644
> --- a/drivers/cxl/cxlmem.h
> +++ b/drivers/cxl/cxlmem.h
> @@ -161,7 +161,7 @@ struct cxl_mbox_cmd {
>  	C(FWRESET, -ENXIO, "FW failed to activate, needs cold reset"),
> 	\
>  	C(HANDLE, -ENXIO, "one or more Event Record Handles were invalid"),
> \
>  	C(PADDR, -EFAULT, "physical address specified is invalid"),
> 	\
> -	C(POISONLMT, -ENXIO, "poison injection limit has been reached"),
> \
> +	C(POISONLMT, -EBUSY, "poison injection limit has been reached"),
> \
>  	C(MEDIAFAILURE, -ENXIO, "permanent issue with the media"),
> 	\
>  	C(ABORT, -ENXIO, "background cmd was aborted by device"),
> \
>  	C(SECURITY, -ENXIO, "not valid in the current security state"),         \
> --
> 2.37.3
>
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl
index c61f9b813973..12488c14be64 100644
--- a/Documentation/ABI/testing/debugfs-cxl
+++ b/Documentation/ABI/testing/debugfs-cxl
@@ -14,9 +14,10 @@  Description:
 		event to its internal Informational Event log, updates the
 		Event Status register, and if configured, interrupts the host.
 		It is not an error to inject poison into an address that
-		already has poison present and no error is returned. The
-		inject_poison attribute is only visible for devices supporting
-		the capability.
+		already has poison present and no error is returned. If the
+		device returns 'Inject Poison Limit Reached' an -EBUSY error
+		is returned to the user. The inject_poison attribute is only
+		visible for devices supporting the capability.
 
 
 What:		/sys/kernel/debug/memX/clear_poison
diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
index 19aba81cdf13..942063c09459 100644
--- a/drivers/cxl/cxlmem.h
+++ b/drivers/cxl/cxlmem.h
@@ -161,7 +161,7 @@  struct cxl_mbox_cmd {
 	C(FWRESET, -ENXIO, "FW failed to activate, needs cold reset"),		\
 	C(HANDLE, -ENXIO, "one or more Event Record Handles were invalid"),     \
 	C(PADDR, -EFAULT, "physical address specified is invalid"),		\
-	C(POISONLMT, -ENXIO, "poison injection limit has been reached"),        \
+	C(POISONLMT, -EBUSY, "poison injection limit has been reached"),        \
 	C(MEDIAFAILURE, -ENXIO, "permanent issue with the media"),		\
 	C(ABORT, -ENXIO, "background cmd was aborted by device"),               \
 	C(SECURITY, -ENXIO, "not valid in the current security state"),         \