Skip to content

Commit 3a8617c

Browse files
AlisonSchofielddavejiang
authored andcommitted
cxl/test: Replace ENXIO with EBUSY for inject poison limit reached
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 Signed-off-by: Alison Schofield <alison.schofield@intel.com> Tested-by: Xingtao Yao <yaoxt.fnst@fujitsu.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Link: https://patch.msgid.link/ba1b80e1658b644d85d0d5e2287112d00a48b9cf.1720316188.git.alison.schofield@intel.com Signed-off-by: Dave Jiang <dave.jiang@intel.com>
1 parent 591209c commit 3a8617c

File tree

1 file changed

+7
-8
lines changed
  • tools/testing/cxl/test

1 file changed

+7
-8
lines changed

tools/testing/cxl/test/mem.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,27 +1135,28 @@ static bool mock_poison_dev_max_injected(struct cxl_dev_state *cxlds)
11351135
return (count >= poison_inject_dev_max);
11361136
}
11371137

1138-
static bool mock_poison_add(struct cxl_dev_state *cxlds, u64 dpa)
1138+
static int mock_poison_add(struct cxl_dev_state *cxlds, u64 dpa)
11391139
{
1140+
/* Return EBUSY to match the CXL driver handling */
11401141
if (mock_poison_dev_max_injected(cxlds)) {
11411142
dev_dbg(cxlds->dev,
11421143
"Device poison injection limit has been reached: %d\n",
1143-
MOCK_INJECT_DEV_MAX);
1144-
return false;
1144+
poison_inject_dev_max);
1145+
return -EBUSY;
11451146
}
11461147

11471148
for (int i = 0; i < MOCK_INJECT_TEST_MAX; i++) {
11481149
if (!mock_poison_list[i].cxlds) {
11491150
mock_poison_list[i].cxlds = cxlds;
11501151
mock_poison_list[i].dpa = dpa;
1151-
return true;
1152+
return 0;
11521153
}
11531154
}
11541155
dev_dbg(cxlds->dev,
11551156
"Mock test poison injection limit has been reached: %d\n",
11561157
MOCK_INJECT_TEST_MAX);
11571158

1158-
return false;
1159+
return -ENXIO;
11591160
}
11601161

11611162
static bool mock_poison_found(struct cxl_dev_state *cxlds, u64 dpa)
@@ -1179,10 +1180,8 @@ static int mock_inject_poison(struct cxl_dev_state *cxlds,
11791180
dev_dbg(cxlds->dev, "DPA: 0x%llx already poisoned\n", dpa);
11801181
return 0;
11811182
}
1182-
if (!mock_poison_add(cxlds, dpa))
1183-
return -ENXIO;
11841183

1185-
return 0;
1184+
return mock_poison_add(cxlds, dpa);
11861185
}
11871186

11881187
static bool mock_poison_del(struct cxl_dev_state *cxlds, u64 dpa)

0 commit comments

Comments
 (0)