Re: [RFC PATCH 3/3] cxl/test: Exercise Type-2 automatic region creation
[email protected] Wed, 05 Aug 2026 07:59:37 +0000
| Newsgroups | org.kernel.vger.linux-cxl |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(= s) to consider: - [Medium] Failure to restore a previously-enabled manual decoder permanent= ly destroys its manual configuration across unbind/rebind cycles. -- --- Patch [3]: [RFC PATCH 3/3] cxl/test: Exercise Type-2 automatic region c= reation --- commit e8d600bcac1235041afc295954c1b2f226a9c8d7 Author: Richard Cheng <[email protected]> cxl/test: Exercise Type-2 automatic region creation This patch adds a second mock Type-2 accelerator with an independent single-target CFMWS and an uncommitted manual DEVMEM decoder. It verifies that devm_cxl_probe_mem() creates the missing region and preserves the manu= al decoder config after reset so the fallback remains available across unbind = and rebind. > diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c > index 8ab2ce1262f30..305a0c3705da4 100644 > --- a/tools/testing/cxl/test/cxl.c > +++ b/tools/testing/cxl/test/cxl.c [ ... ] > @@ -1121,7 +1159,9 @@ static enum cxld_init_type get_decoder_init_type(st= ruct cxl_decoder *cxld, > MOCK_DECODER_INIT_TYPE3_AUTO; > } > =20 > -static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, struct c= xl_test_decoder *td) > +static bool mock_decoder_handle_saved(struct cxl_decoder *cxld, > + struct cxl_test_decoder *td, > + struct platform_device *pdev) > { > bool enabled; > =20 > @@ -1133,6 +1173,11 @@ static bool mock_decoder_handle_saved(struct cxl_d= ecoder *cxld, struct cxl_test_ > if (enabled) > return !cxld_registry_restore(cxld, td); > =20 > + if (is_type2_manual_decoder(cxld, pdev)) { [Severity: Medium] If cxld_registry_restore() fails, does this bypass the manual fallback logi= c? Looking at the preceding lines: if (enabled) return !cxld_registry_restore(cxld, td); If the decoder was enabled but cxld_registry_restore() fails (e.g., due to a DPA reservation error), this function returns immediately.=20 Since cxld_registry_restore() internally calls init_disabled_mock_decoder() on failure, the decoder is forcefully reverted to a HOSTONLYMEM state inste= ad of the intended DEVMEM fallback state. Would it be better to fall through to the is_type2_manual_decoder() check when cxld_registry_restore() fails, so the manual configuration isn't lost across unbind and rebind cycles? > + init_type2_manual_decoder(to_cxl_endpoint_decoder(&cxld->dev)); > + return false; > + } > + > init_disabled_mock_decoder(cxld); > return false; > } --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260805074042.3017= [email protected]?part=3D3