Re: [PATCH v7 5/7] cxl/memdev: Don't overwrite the error from an earlier partition poison query

From: Jonathan Cameron

Date: Tue Sep 15 2026 - 22:33:03 EST


On Thu, 3 Sep 2026 22:31:13 -0700
Alison Schofield <alison.schofield@xxxxxxxxx> wrote:

> On Wed, Sep 02, 2026 at 01:38:37PM +0800, Richard Cheng wrote:
> > cxl_get_poison_by_memdev() queries Get Poison List per partition but
> > never checks the result inside the loop, so a later partition's success
> > overwrites an earlier partition's failure and the whole scan reports
> > success while that partition's poison went unlisted. Before the loop
> > conversion the PMEM query returned early on error. Stop the loop on any
> > error not already tolerated as a RAM -EFAULT.
>
> Before be5cbd084027 pmem was queried first, then ram, so a ram failure
> was reported after the pmem records had been collected. Now w the order
> reversed, breaking on a ram error means pmem is never queried. I'm not
> sure that is what we want.
>
> What matters more to poison list user - a truthful return code or every
> record the device is able to give us?

If we can have both, that would be nice. That sort of multiple return code
fusing is nasty to read but here I think it makes sense.

Jonathan

>
> -- Alison
>
>
> >
> > Fixes: be5cbd084027 ("cxl: Kill enum cxl_decoder_mode")
> > Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>
> > Closes: https://sashiko.dev/#/patchset/20260708074228.43654-1-icheng@xxxxxxxxxx?part=5
> > Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
> > ---
> > drivers/cxl/core/memdev.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/cxl/core/memdev.c b/drivers/cxl/core/memdev.c
> > index b3419df586b9..e39b3d13fd56 100644
> > --- a/drivers/cxl/core/memdev.c
> > +++ b/drivers/cxl/core/memdev.c
> > @@ -231,6 +231,8 @@ static int cxl_get_poison_by_memdev(struct cxl_memdev *cxlmd)
> > */
> > if (rc == -EFAULT && cxlds->part[i].mode == CXL_PARTMODE_RAM)
> > rc = 0;
> > + if (rc)
> > + break;
> > }
> > return rc;
> > }
> > --
> > 2.53.0
> >
>