Skip to contentSkip to conversation

CXL: Miscellaneous fixes

PATCH Superseded Ira Weiny 3 participants 9 messages Dec 27, 2022 – Jan 10, 2023 CXL

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Ira Weiny

author
#0 lore raw

cover CXL: Miscellaneous fixes

These are minor fixes I have seen along the way in the CXL code.

To: "Dan Williams" <[email protected]>

Cc "Jiang, Dave" <[email protected]>
Cc "Alison Schofield" <[email protected]>
Cc "Vishal Verma" <[email protected]>
Cc "Ben Widawsky" <[email protected]>

---
Ira Weiny (3):
cxl/mem: Fix command comment
cxl/mem: Remove unused CXL_CMD_FLAG_NONE define cxl/uapi: Add warning on CXL command enum

 drivers/cxl/cxlmem.h         |  1 -
 include/uapi/linux/cxl_mem.h | 10 +++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

---
base-commit: 8395ae05cb5a2e31d36106e8c85efa11cda849be
change-id: 20221222-cxl-misc-793ec2442455

Best regards,

Signature · 1 line
Ira Weiny <[email protected]>
author
#1 lore raw

PATCH 1/3 cxl/mem: Fix command comment

The command comment had some minor grammatical errors.

Fix them.

---
 include/uapi/linux/cxl_mem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/cxl_mem.h +3 -3
index c71021a2a9ed..555f9140e2bc 100644
@@ -11,9 +11,9 @@
 /**
  * DOC: UAPI
  *
- * Not all of all commands that the driver supports are always available for use
- * by userspace. Userspace must check the results from the QUERY command in
- * order to determine the live set of commands.
+ * Not all of the commands that the driver supports are available for use by
+ * userspace at all times.  Userspace must check the results from the QUERY
+ * command in order to determine the live set of commands.
  */
 
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
Signature · 1 line
2.38.1
#2 lore raw

RE: [PATCH 1/3] cxl/mem: Fix command comment

Quoted 14 lines · Ira Weiny

The command comment had some minor grammatical errors.

Fix them.

---
 include/uapi/linux/cxl_mem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/cxl_mem.h +0 -0
index c71021a2a9ed..555f9140e2bc 100644

include/uapi/linux/cxl_mem.h line 17

Quoted 10 lines
include/uapi/linux/cxl_mem.h +3 -3
@@ -11,9 +11,9 @@
 /**
  * DOC: UAPI
  *
- * Not all of all commands that the driver supports are always available for use
- * by userspace. Userspace must check the results from the QUERY command in
- * order to determine the live set of commands.
+ * Not all of the commands that the driver supports are available for use by
+ * userspace at all times.  Userspace must check the results from the QUERY
+ * command in order to determine the live set of commands.
  */

It's interesting that these grammatical fixups further highlight that the existing description was a lie. This new wording makes it seem like QUERY informs about temporarily disabled commands (like those in the cxlds->exclusive_cmds set), in addition to the device enabled commands (those in the cxlds->enabled_cmds set).

It turns out this has always been a lie and the cxl tool checks if a command is supported and enabled by trying to execute it if it exists in the cxl_query_cmd() payload.

Now we could either go fix that, or change this comment to reflect the current reality that cxl_command_info.flags is always zero and the command info array is just telling you if the driver knows how to attempt the given command.

Quoted 5 lines
include/uapi/linux/cxl_mem.h +0 -0
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
 
Signature · 1 line
2.38.1
#3 lore raw

Re: [PATCH 1/3] cxl/mem: Fix command comment

Quoted 32 lines · On Tue, 3 Jan 2023 19:02:38 -0800 Dan Williams <[email protected]> wrote:
Quoted 14 lines · Ira Weiny

The command comment had some minor grammatical errors.

Fix them.

---
 include/uapi/linux/cxl_mem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/cxl_mem.h +0 -0
index c71021a2a9ed..555f9140e2bc 100644

include/uapi/linux/cxl_mem.h line 17

Quoted 10 lines
include/uapi/linux/cxl_mem.h +3 -3
@@ -11,9 +11,9 @@
 /**
  * DOC: UAPI
  *
- * Not all of all commands that the driver supports are always available for use
- * by userspace. Userspace must check the results from the QUERY command in
- * order to determine the live set of commands.
+ * Not all of the commands that the driver supports are available for use by
+ * userspace at all times.  Userspace must check the results from the QUERY
+ * command in order to determine the live set of commands.
  */  

It's interesting that these grammatical fixups further highlight that the existing description was a lie. This new wording makes it seem like QUERY informs about temporarily disabled commands (like those in the cxlds->exclusive_cmds set), in addition to the device enabled commands (those in the cxlds->enabled_cmds set).

Quoted 8 lines

It turns out this has always been a lie and the cxl tool checks if a command is supported and enabled by trying to execute it if it exists in the cxl_query_cmd() payload.

Now we could either go fix that, or change this comment to reflect the current reality that cxl_command_info.flags is always zero and the command info array is just telling you if the driver knows how to attempt the given command.

I'd really like to see a query mechanism that reflects whether the hardware supports the command (plus all the other reasons why we might not be able to use it - ultimately the question is 'can I issue this'). Some commands may 'take a while' so it's not nice to have to issue them to find out if they exist given the discoverable nature hardware side.

Possible that mechanism is different from this one though...

Jonathan

Quoted 8 lines
Quoted 6 lines
include/uapi/linux/cxl_mem.h +0 -0
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
 
Signature · 1 line
2.38.1  
author
#4 lore raw

Re: [PATCH 1/3] cxl/mem: Fix command comment

Quoted 44 lines · Jonathan Cameron
Quoted 32 lines · On Tue, 3 Jan 2023 19:02:38 -0800 Dan Williams <[email protected]> wrote:
Quoted 14 lines · Ira Weiny

The command comment had some minor grammatical errors.

Fix them.

---
 include/uapi/linux/cxl_mem.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/linux/cxl_mem.h +0 -0
index c71021a2a9ed..555f9140e2bc 100644

include/uapi/linux/cxl_mem.h line 17

Quoted 10 lines
include/uapi/linux/cxl_mem.h +3 -3
@@ -11,9 +11,9 @@
 /**
  * DOC: UAPI
  *
- * Not all of all commands that the driver supports are always available for use
- * by userspace. Userspace must check the results from the QUERY command in
- * order to determine the live set of commands.
+ * Not all of the commands that the driver supports are available for use by
+ * userspace at all times.  Userspace must check the results from the QUERY
+ * command in order to determine the live set of commands.
  */  

It's interesting that these grammatical fixups further highlight that the existing description was a lie. This new wording makes it seem like QUERY informs about temporarily disabled commands (like those in the cxlds->exclusive_cmds set), in addition to the device enabled commands (those in the cxlds->enabled_cmds set).

Quoted 8 lines

It turns out this has always been a lie and the cxl tool checks if a command is supported and enabled by trying to execute it if it exists in the cxl_query_cmd() payload.

Now we could either go fix that, or change this comment to reflect the current reality that cxl_command_info.flags is always zero and the command info array is just telling you if the driver knows how to attempt the given command.

Quoted 7 lines

I'd really like to see a query mechanism that reflects whether the hardware supports the command (plus all the other reasons why we might not be able to use it - ultimately the question is 'can I issue this'). Some commands may 'take a while' so it's not nice to have to issue them to find out if they exist given the discoverable nature hardware side.

Possible that mechanism is different from this one though...

Yea but I agree with Dan that the comment is wrong right now. I somewhat misinterpreted the comment and so my change was not correct despite Dan and I being on the same page (at least in my head).

So Dan is not going to take this and I'm going to attempt to make the comment correct per the current behavior. If another mechanism is built then we can document that when it comes along.

Ira

Quoted 12 lines

Jonathan

Quoted 8 lines
Quoted 6 lines
include/uapi/linux/cxl_mem.h +0 -0
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
 
Signature · 1 line
2.38.1  
author
#5 lore raw

PATCH 2/3 cxl/mem: Remove unused CXL_CMD_FLAG_NONE define

In reply to Ira Weiny

CXL_CMD_FLAG_NONE is not used, remove it.

---
 drivers/cxl/cxlmem.h | 1 -
 1 file changed, 1 deletion(-)
drivers/cxl/cxlmem.h +0 -1
index ab138004f644..2d85776236dd 100644
@@ -393,7 +393,6 @@ struct cxl_mem_command {
 	struct cxl_command_info info;
 	enum cxl_opcode opcode;
 	u32 flags;
-#define CXL_CMD_FLAG_NONE 0
 #define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
 };
 
Signature · 1 line
2.38.1
Reviewed-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] cxl/mem: Remove unused CXL_CMD_FLAG_NONE define

Quoted 3 lines · On Tue, 27 Dec 2022 06:52:10 -0800 Ira Weiny <[email protected]> wrote:

CXL_CMD_FLAG_NONE is not used, remove it.

That is a bit odd. Good to get rid of it.

Quoted 17 lines
---
 drivers/cxl/cxlmem.h | 1 -
 1 file changed, 1 deletion(-)
drivers/cxl/cxlmem.h +0 -1
index ab138004f644..2d85776236dd 100644
@@ -393,7 +393,6 @@ struct cxl_mem_command {
 	struct cxl_command_info info;
 	enum cxl_opcode opcode;
 	u32 flags;
-#define CXL_CMD_FLAG_NONE 0
 #define CXL_CMD_FLAG_FORCE_ENABLE BIT(0)
 };
 
author
#7 lore raw

PATCH 3/3 cxl/uapi: Add warning on CXL command enum

In reply to Ira Weiny

The CXL command enum is exported to user space and must maintain backwards compatibility.

Add comment that new defines must be added to the end of the list.

---
 include/uapi/linux/cxl_mem.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/cxl_mem.h +4 -0
index 555f9140e2bc..b3fd46af70f8 100644
@@ -19,6 +19,10 @@
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
 #define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
 
+/*
+ * NOTE: New defines must be added to the end of the list to preserve
+ * compatibility because this enum is exported to user space.
+ */
 #define CXL_CMDS                                                          \
 	___C(INVALID, "Invalid Command"),                                 \
 	___C(IDENTIFY, "Identify Command"),                               \
Signature · 1 line
2.38.1
Reviewed-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] cxl/uapi: Add warning on CXL command enum

Quoted 7 lines · On Tue, 27 Dec 2022 06:52:11 -0800 Ira Weiny <[email protected]> wrote:

The CXL command enum is exported to user space and must maintain backwards compatibility.

Add comment that new defines must be added to the end of the list.

Quoted 20 lines
---
 include/uapi/linux/cxl_mem.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/cxl_mem.h +4 -0
index 555f9140e2bc..b3fd46af70f8 100644
@@ -19,6 +19,10 @@
 #define CXL_MEM_QUERY_COMMANDS _IOR(0xCE, 1, struct cxl_mem_query_commands)
 #define CXL_MEM_SEND_COMMAND _IOWR(0xCE, 2, struct cxl_send_command)
 
+/*
+ * NOTE: New defines must be added to the end of the list to preserve
+ * compatibility because this enum is exported to user space.
+ */
 #define CXL_CMDS                                                          \
 	___C(INVALID, "Invalid Command"),                                 \
 	___C(IDENTIFY, "Identify Command"),                               \