Skip to contentSkip to conversation

cxl/mbox: Add debug messages for supported mailbox commands

PATCH Superseded Robert Richter 6 participants 10 messages Jan 19, 2023 – Jan 28, 2023 CXL

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl/mbox: Add debug messages for supported mailbox commands

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

On that occasion also add missing trailing newlines.

---
 drivers/cxl/core/mbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cxl/core/mbox.c +2 -1
index a48ade466d6a..ffa9f84c2dce 100644
@@ -629,11 +629,12 @@ static void cxl_walk_cel(struct cxl_dev_state *cxlds, size_t size, u8 *cel)
 
 		if (!cmd) {
 			dev_dbg(cxlds->dev,
-				"Opcode 0x%04x unsupported by driver", opcode);
+				"Opcode 0x%04x unsupported by driver\n", opcode);
 			continue;
 		}
 
 		set_bit(cmd->info.id, cxlds->enabled_cmds);
+		dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
 	}
 }
 

base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2

Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?
Alison

Quoted 31 lines

On that occasion also add missing trailing newlines.

---
 drivers/cxl/core/mbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cxl/core/mbox.c +2 -1
index a48ade466d6a..ffa9f84c2dce 100644
@@ -629,11 +629,12 @@ static void cxl_walk_cel(struct cxl_dev_state *cxlds, size_t size, u8 *cel)
 
 		if (!cmd) {
 			dev_dbg(cxlds->dev,
-				"Opcode 0x%04x unsupported by driver", opcode);
+				"Opcode 0x%04x unsupported by driver\n", opcode);
 			continue;
 		}
 
 		set_bit(cmd->info.id, cxlds->enabled_cmds);
+		dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
 	}
 }
 

base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2

Signature · 1 line
2.30.2
#2 lore raw

Hi Alison,

Quoted 9 lines · Alison Schofield
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?

There are 26 commands supported by the driver, so I assume there are at least 4 cards in your system? To me the number of messages looks ok for a debug kernel. And, most kernels have dyndbg enabled allowing to enable only messages of interest? Esp. if card initialization fails there is no way to get this information from userland. The list of unsupported commands is of less use than the one for supported. That is the intention for the change.

Thanks,

-Robert

maintainer
#3 lore raw
Quoted 13 lines · Robert Richter

Hi Alison,

Quoted 9 lines · Alison Schofield
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?

Quoted 7 lines

There are 26 commands supported by the driver, so I assume there are at least 4 cards in your system? To me the number of messages looks ok for a debug kernel. And, most kernels have dyndbg enabled allowing to enable only messages of interest? Esp. if card initialization fails there is no way to get this information from userland. The list of unsupported commands is of less use than the one for supported. That is the intention for the change.

cxl_walk_cel() job is to create the enabled_cmds list for the device. How about we use that language in the message, like:

		set_bit(cmd->info.id, cxlds->enabled_cmds);

- dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
+ dev_dbg(cxlds->dev, "Opcode 0x%04x enabled\n", opcode);

Because when we say, "Opcode 0x%04x supported by driver\n", that comes with the assumption that the device supported it too. By saying 'enabled', it's clear device and driver are aligned.

Quoted 4 lines

Thanks,

-Robert

#4 lore raw
Quoted 29 lines · Alison Schofield
Quoted 13 lines · Robert Richter

Hi Alison,

Quoted 9 lines · Alison Schofield
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?

Quoted 7 lines

There are 26 commands supported by the driver, so I assume there are at least 4 cards in your system? To me the number of messages looks ok for a debug kernel. And, most kernels have dyndbg enabled allowing to enable only messages of interest? Esp. if card initialization fails there is no way to get this information from userland. The list of unsupported commands is of less use than the one for supported. That is the intention for the change.

cxl_walk_cel() job is to create the enabled_cmds list for the device. How about we use that language in the message, like:

		set_bit(cmd->info.id, cxlds->enabled_cmds);
(quoted diff) +1 -1
-               dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
+               dev_dbg(cxlds->dev, "Opcode 0x%04x enabled\n", opcode);
Quoted 3 lines

Because when we say, "Opcode 0x%04x supported by driver\n", that comes with the assumption that the device supported it too. By saying 'enabled', it's clear device and driver are aligned.

Yes, that message is more meaningful.

Thanks,

-Robert

#5 lore raw
Quoted 30 lines · Robert Richter
Quoted 29 lines · Alison Schofield
Quoted 13 lines · Robert Richter

Hi Alison,

Quoted 9 lines · Alison Schofield
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?

Quoted 7 lines

There are 26 commands supported by the driver, so I assume there are at least 4 cards in your system? To me the number of messages looks ok for a debug kernel. And, most kernels have dyndbg enabled allowing to enable only messages of interest? Esp. if card initialization fails there is no way to get this information from userland. The list of unsupported commands is of less use than the one for supported. That is the intention for the change.

cxl_walk_cel() job is to create the enabled_cmds list for the device. How about we use that language in the message, like:

		set_bit(cmd->info.id, cxlds->enabled_cmds);
(quoted diff) +1 -1
-               dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
+               dev_dbg(cxlds->dev, "Opcode 0x%04x enabled\n", opcode);
Quoted 6 lines
Quoted 3 lines

Because when we say, "Opcode 0x%04x supported by driver\n", that comes with the assumption that the device supported it too. By saying 'enabled', it's clear device and driver are aligned.

Yes, that message is more meaningful.

Applied with this fixup.

#6 lore raw
In reply to Robert Richter
Quoted 13 lines · Robert Richter

Hi Alison,

Quoted 9 lines · Alison Schofield
Quoted 3 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

Hi Robert,
I wonder if you can get this info another way. When I try this loading cxl_test today, I get 99 new messages. Is this going to create too much noise with debug kernels?

Quoted 7 lines

There are 26 commands supported by the driver, so I assume there are at least 4 cards in your system? To me the number of messages looks ok for a debug kernel. And, most kernels have dyndbg enabled allowing to enable only messages of interest? Esp. if card initialization fails there is no way to get this information from userland. The list of unsupported commands is of less use than the one for supported. That is the intention for the change.

The debug message looks ok to me, I will just note that there has been consideration for exporting the enabled commands list via CXL_MEM_QUERY_COMMANDS [1]. I wouldn't be opposed to someone enabling that as well, just need to be clear with userspace that not all kernels will populate that status.

[1]: http://lore.kernel.org/r/[email protected]

#7 lore raw
Quoted 1 line · Dan Williams

Robert Richter wrote:

[snip]

Quoted 8 lines

The debug message looks ok to me, I will just note that there has been consideration for exporting the enabled commands list via CXL_MEM_QUERY_COMMANDS [1]. I wouldn't be opposed to someone enabling that as well, just need to be clear with userspace that not all kernels will populate that status.

[1]: http://lore.kernel.org/r/[email protected]

Sent as a v2 of 'CXL Misc fixes'

Ira

Reviewed-by on v1 1/1
#8 lore raw
In reply to Robert Richter
Quoted 7 lines · On Thu, 19 Jan 2023 14:04:50 +0100 Robert Richter <[email protected]> wrote:

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

On that occasion also add missing trailing newlines.

Seems reasonable to me.

Quoted 24 lines
---
 drivers/cxl/core/mbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cxl/core/mbox.c +2 -1
index a48ade466d6a..ffa9f84c2dce 100644
@@ -629,11 +629,12 @@ static void cxl_walk_cel(struct cxl_dev_state *cxlds, size_t size, u8 *cel)
 
 		if (!cmd) {
 			dev_dbg(cxlds->dev,
-				"Opcode 0x%04x unsupported by driver", opcode);
+				"Opcode 0x%04x unsupported by driver\n", opcode);
 			continue;
 		}
 
 		set_bit(cmd->info.id, cxlds->enabled_cmds);
+		dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
 	}
 }
 

base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2

maintainer Reviewed-by on v1 1/1
#9 lore raw
In reply to Robert Richter
Quoted 7 lines · Robert Richter

Only unsupported mailbox commands are reported in debug messages. A list of supported commands is useful too. Change debug messages to also report the opcodes of supported commands.

On that occasion also add missing trailing newlines.

Quoted 24 lines
---
  drivers/cxl/core/mbox.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cxl/core/mbox.c +2 -1
index a48ade466d6a..ffa9f84c2dce 100644
@@ -629,11 +629,12 @@ static void cxl_walk_cel(struct cxl_dev_state *cxlds, size_t size, u8 *cel)
 
  		if (!cmd) {
  			dev_dbg(cxlds->dev,
-				"Opcode 0x%04x unsupported by driver", opcode);
+				"Opcode 0x%04x unsupported by driver\n", opcode);
  			continue;
  		}
 
  		set_bit(cmd->info.id, cxlds->enabled_cmds);
+		dev_dbg(cxlds->dev, "Opcode 0x%04x supported by driver\n", opcode);
  	}
  }
 

base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2