Return EBUSY on inject poison limit reached
[email protected]
maintainerv2 cover Return EBUSY on inject poison limit reached
From: Alison Schofield <[email protected]>
Changes in v2:
- Use poison_inject_dev_max in cxl-test dev_dbg() msg and note that change in the Patch 2 commit log (Xingtao)
Link to v1: https://lore.kernel.org/[email protected]/
Validation users are asking for the ability to recognize when their injection testing has hit the limit of the device.
Change the drivers error code for this failure to EBUSY and do the same in the cxl-test mock of inject poison.
Alison Schofield (2):
cxl/memdev: Replace ENXIO with EBUSY for inject poison limit reached cxl/test: Replace ENXIO with EBUSY for inject poison limit reached
Documentation/ABI/testing/debugfs-cxl | 7 ++++--- drivers/cxl/cxlmem.h | 2 +- tools/testing/cxl/test/mem.c | 15 +++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-)
base-commit: 22a40d14b572deb80c0648557f4bd502d7e83826
Signature · 1 line
2.37.3
[email protected]
maintainerPATCH v2 1/2 cxl/memdev: Replace ENXIO with EBUSY for inject poison limit reached
From: Alison Schofield <[email protected]>
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.
--- Documentation/ABI/testing/debugfs-cxl | 7 ++++--- drivers/cxl/cxlmem.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
Documentation/ABI/testing/debugfs-cxl +4 -3
@@ -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
drivers/cxl/cxlmem.h +1 -1
@@ -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"), \
Signature · 1 line
2.37.3
[email protected]
maintainerPATCH v2 2/2 cxl/test: Replace ENXIO with EBUSY for inject poison limit reached
In reply to [email protected]From: Alison Schofield <[email protected]>
The CXL driver was recently updated to return EBUSY rather than ENXIO when the device reports that an injection request exceeds the device's limit. That change to EBUSY allows debug users to differentiate between limit reached and inject failures for any other reason.
Change cxl-test to also return EBUSY and tidy up the dev_dbg() messaging to emit the correct limit.
Reminder: the cxl-test per device injection limit is a configurable
attribute: /sys/bus/platform/drivers/cxl_mock_mem/poison_inject_max
--- tools/testing/cxl/test/mem.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
tools/testing/cxl/test/mem.c +7 -8
@@ -1131,27 +1131,28 @@ static bool mock_poison_dev_max_injected(struct cxl_dev_state *cxlds)return (count >= poison_inject_dev_max); } -static bool mock_poison_add (struct cxl_dev_state *cxlds,u64 dpa) +static int mock_poison_add (struct cxl_dev_state *cxlds,u64 dpa) { +/* Return EBUSY to match the CXL driver handling */ if (mock_poison_dev_max_injected (cxlds)) {dev_dbg (cxlds->dev,"Device poison injection limit has been reached: %d\n" , -MOCK_INJECT_DEV_MAX ); -return false; + poison_inject_dev_max); +return -EBUSY ; }for (int i =0 ; i <MOCK_INJECT_TEST_MAX ; i++) {if (!mock_poison_list[i].cxlds) { mock_poison_list[i].cxlds = cxlds; mock_poison_list[i].dpa = dpa; -return true; +return 0 ; } }dev_dbg (cxlds->dev,"Mock test poison injection limit has been reached: %d\n" ,MOCK_INJECT_TEST_MAX ); -return false; +return -ENXIO ; }static bool mock_poison_found (struct cxl_dev_state *cxlds,u64 dpa)
@@ -1175,10 +1176,8 @@ static int mock_inject_poison(struct cxl_dev_state *cxlds,dev_dbg (cxlds->dev,"DPA: 0x%llx already poisoned\n" , dpa);return 0 ; } -if (!mock_poison_add (cxlds, dpa)) -return -ENXIO ; -return 0 ; +return mock_poison_add (cxlds, dpa); }static bool mock_poison_del (struct cxl_dev_state *cxlds,u64 dpa)
Signature · 1 line
2.37.3