Linux CXL
 help / color / mirror / Atom feed
From: Ira Weiny <ira.weiny@intel.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Ira Weiny <ira.weiny@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	"Jiang, Dave" <dave.jiang@intel.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ben Widawsky <bwidawsk@kernel.org>,
	Robert Richter <rrichter@amd.com>, <linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v3 3/4] cxl/uapi: Tag commands from cxl_query_cmd()
Date: Thu, 2 Feb 2023 15:58:38 -0800	[thread overview]
Message-ID: <63dc4e2e9de47_d9655294a3@iweiny-mobl.notmuch> (raw)
In-Reply-To: <20230202100125.0000590a@Huawei.com>

Jonathan Cameron wrote:
> On Thu, 2 Feb 2023 09:58:21 +0000
> Jonathan Cameron <Jonathan.Cameron@Huawei.com> wrote:
> 
> > On Wed, 01 Feb 2023 17:23:12 -0800
> > Ira Weiny <ira.weiny@intel.com> wrote:
> > 
> > > It was pointed out that commands not supported by the device or excluded
> > > by the kernel were being returned in cxl_query_cmd().[1]
> > > 
> > > While libcxl correctly handles failing commands, it is more efficient to
> > > not issue an invalid command in the first place.  This can't be done
> > > without additional information being returned from cxl_query_cmd().  In
> > > addition, information about the availability of commands can be useful
> > > for debugging.
> > > 
> > > Add flags to struct cxl_command_info which reflect if a command is
> > > enabled and/or exclusive to the kernel.
> > > 
> > > [1] https://lore.kernel.org/all/63b4ec4e37cc1_5178e2941d@dwillia2-xfh.jf.intel.com.notmuch/
> > > 
> > > Suggested-by: Dan Williams <dan.j.williams@intel.com>
> > > Signed-off-by: Ira Weiny <ira.weiny@intel.com>  
> > 
> > No mention of why we can use space in the existing defined flag mask?
> > 
> > I couldn't find a reason why we couldn't previously but Dan's proposal
> > was to reserve that first bit so I'm wondering on the reasoning one
> > way or the other!
> > 
> > Other than that detail, this looks like a good solution to me.

The reason was covered in the previous discussion.  I pointed out that the flag
Dan mentioned was an internal one which did not apply here at all.  So I did
not mention it.

	> > I also think it is a bug that this command passes kernel internal flags
	> > like CXL_CMD_FLAG_FORCE_ENABLE.
	> 
	> AFAICS It does not return that flag.  CXL_CMD_FLAG_FORCE_ENABLE is a flag
	> in struct cxl_mem_command while struct cxl_command_info has separate
	> flags.
	> 
	> AFAICS only struct cxl_command_info is exposed to userspace.
	
	Ah true, CXL_CMD() leaves info.flags unset.

	-- https://lore.kernel.org/all/63d85857b1648_8e2c29465@dwillia2-mobl3.amr.corp.intel.com.notmuch/

> 
> On second thoughts. Some docs for the two flags explaining what they
> mean would be good to have (as there isn't a reference to how to use
> them in the Docs patch that follows this).

Good point.

I'll respin with kdocs for the following:

/*
 * The given command id is supported by the driver and is supported by a
 * related opcode on the device.
 */
#define CXL_MEM_COMMAND_FLAG_USER_ENABLED BIT(1)

/*
 * Requests with the given command id will terminate with EBUSY as the
 * kernel actively owns management of the given resource. For example,
 * the label-storage-area can not be written while the kernel is
 * actively managing that space.
 */
#define CXL_MEM_COMMAND_FLAG_KERNEL_RESERVED BIT(2)

Ira

  reply	other threads:[~2023-02-02 23:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  1:23 [PATCH v3 0/4] CXL: Miscellaneous fixes Ira Weiny
2023-02-02  1:23 ` [PATCH v3 1/4] cxl/mem: Remove unused CXL_CMD_FLAG_NONE define Ira Weiny
2023-02-02  1:23 ` [PATCH v3 2/4] cxl/uapi: Add warning on CXL command enum Ira Weiny
2023-02-02  1:23 ` [PATCH v3 3/4] cxl/uapi: Tag commands from cxl_query_cmd() Ira Weiny
2023-02-02  9:58   ` Jonathan Cameron
2023-02-02 10:01     ` Jonathan Cameron
2023-02-02 23:58       ` Ira Weiny [this message]
2023-02-02  1:23 ` [PATCH v3 4/4] cxl/mem: Fix UAPI command comment Ira Weiny
2023-02-02 10:01   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63dc4e2e9de47_d9655294a3@iweiny-mobl.notmuch \
    --to=ira.weiny@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=bwidawsk@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=rrichter@amd.com \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox