[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBpa02RH0CnRv6Jl@lg>
Date: Tue, 6 May 2025 11:54:11 -0700
From: Fan Ni <nifan.cxl@...il.com>
To: Ira Weiny <ira.weiny@...el.com>
Cc: Fan Ni <nifan.cxl@...il.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Davidlohr Bueso <dave@...olabs.net>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>, linux-cxl@...r.kernel.org,
nvdimm@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 01/19] cxl/mbox: Flag support for Dynamic Capacity
Devices (DCD)
On Tue, May 06, 2025 at 11:09:09AM -0500, Ira Weiny wrote:
> Fan Ni wrote:
> > On Mon, Apr 14, 2025 at 03:19:50PM +0100, Jonathan Cameron wrote:
> > > On Sun, 13 Apr 2025 17:52:09 -0500
> > > Ira Weiny <ira.weiny@...el.com> wrote:
>
> [snip]
>
> > >
> > > > +
> > > > +static bool cxl_verify_dcd_cmds(struct cxl_memdev_state *mds, unsigned long *cmds_seen)
> > >
> > > It's not immediately obvious to me what the right behavior
> > > from something called cxl_verify_dcd_cmds() is. A comment might help with that.
> > >
> > > I think all it does right now is check if any bits are set. In my head
> > > it was going to check that all bits needed for a useful implementation were
> > > set. I did have to go check what a 'logical and' of a bitmap was defined as
> > > because that bit of the bitmap_and() return value wasn't obvious to me either!
> >
> > The code only checks if any DCD command (48xx) is supported, if any is
> > set, it will set "dcd_supported".
> > As you mentioned, it seems we should check all the related commands are
> > supported, otherwise it is not valid implementation.
> >
> > Fan
> > >
> > >
> > > > +{
> > > > + DECLARE_BITMAP(all_cmds, CXL_DCD_ENABLED_MAX);
> > > > + DECLARE_BITMAP(dst, CXL_DCD_ENABLED_MAX);
> > > > +
> > > > + bitmap_fill(all_cmds, CXL_DCD_ENABLED_MAX);
> > > > + return bitmap_and(dst, cmds_seen, all_cmds, CXL_DCD_ENABLED_MAX);
>
> Yea... so this should read:
>
> ...
> bitmap_and(dst, cmds_seen, all_cmds, CXL_DCD_ENABLED_MAX);
> return bitmap_equal(dst, all_cmds, CXL_DCD_ENABLED_MAX);
Maybe only
return bitmap_equal(cmds_seen, all_cmds, CXL_DCD_ENABLED_MAX)?
Fan
> ...
>
> Of course if a device has set any of these commands true it better have
> set them all. Otherwise the device is broken and it will fail in bad
> ways.
>
> But I agree with both of you that this is much better and explicit that
> something went wrong. A dev_dbg() might be in order to debug such an
> issue.
>
> Ira
>
> [snip]
--
Fan Ni
Powered by blists - more mailing lists