lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <681a34255194d_2b95d1294af@iweiny-mobl.notmuch>
Date: Tue, 6 May 2025 11:09:09 -0500
From: Ira Weiny <ira.weiny@...el.com>
To: Fan Ni <nifan.cxl@...il.com>, Jonathan Cameron
	<Jonathan.Cameron@...wei.com>
CC: Ira Weiny <ira.weiny@...el.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)

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);
...

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]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ