libie: log more info when virtchnl fails
PATCH 1/1 libie: log more info when virtchnl fails
Virtchnl failures can be hard to debug without logs. Logging the details of virtchnl transactions can be useful for debugging virtchnl-related issues.
Tested: Built and booted on a test machine.
--- drivers/net/ethernet/intel/libie/controlq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ethernet/intel/libie/controlq.c +15 -0
@@ -762,6 +762,16 @@ libie_ctlq_xn_process_recv(struct libie_ctlq_xn_recv_params *params, status = ctlq_msg->chnl_retval ? -EFAULT :0 ; xn = &xnm->ring[xn_index]; + +if (ctlq_msg->chnl_retval) { +dev_err_ratelimited ( + params->ctlq->dev, +"Non-zero virtchnl ret val (msg op: %u, ret val: %u, msg_cookie: %u, data_len: %u); xn op: %u, id: %u, cookie: %u\n" , + ctlq_msg->chnl_opcode, ctlq_msg->chnl_retval, + msg_cookie, ctlq_msg->data_len, xn->virtchnl_opcode, + xn->index, xn->cookie); + } +if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || msg_cookie != xn->cookie)return false;
@@ -1011,6 +1021,11 @@ int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) params->recv_mem = xn->recv_mem;break ;default : +dev_notice_ratelimited ( + params->ctlq->dev, +"Transaction failed (op %u, xn state: %d, id: %u, cookie: %u, size: %zu)\n" , + params->chnl_opcode, xn->state, xn->index, xn->cookie, + xn->recv_mem.iov_len); ret = -EBADMSG ;break ; }
Signature · 1 line
2.54.0.rc2.544.gc7ae2d5bb8-goog
Quoted 56 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Li Li via Intel-wired-lan
Sent: Friday, April 24, 2026 5:16 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Li Li <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] libie: log more info when virtchnl failsVirtchnl failures can be hard to debug without logs. Logging the details of virtchnl transactions can be useful for debugging virtchnl- related issues.
Tested: Built and booted on a test machine.
Signed-off-by Li Li <[email protected]>--- drivers/net/ethernet/intel/libie/controlq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/net/ethernet/intel/libie/controlq.c +10
-0@@ -762,6 +762,16 @@ libie_ctlq_xn_process_recv(structlibie_ctlq_xn_recv_params *params, status = ctlq_msg->chnl_retval ? -EFAULT :0 ; xn = &xnm->ring[xn_index]; + +if (ctlq_msg->chnl_retval) { +dev_err_ratelimited ( + params->ctlq->dev, + "Non-zero virtchnl ret val (msg op: %u, ret val: %u, msg_cookie: %u, data_len: %u); xn op: %u, id: %u, cookie: %u\n", + ctlq_msg->chnl_opcode, ctlq_msg->chnl_retval, + msg_cookie, ctlq_msg->data_len, xn- >virtchnl_opcode, + xn->index, xn->cookie); + } +drivers/net/ethernet/intel/libie/controlq.c +0
-0if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || msg_cookie != xn->cookie)return false;@@ -1011,6 +1021,11 @@ int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params)
drivers/net/ethernet/intel/libie/controlq.c int libie_ctlq_xn_send(struct · line 1031
Quoted 10 lines
drivers/net/ethernet/intel/libie/controlq.c +5
-0params->recv_mem = xn->recv_mem;break ;default : +dev_notice_ratelimited ( + params->ctlq->dev, + "Transaction failed (op %u, xn state: %d, id: %u, cookie: %u, size: %zu)\n", + params->chnl_opcode, xn->state, xn->index, xn- >cookie, + xn->recv_mem.iov_len);
For me dev_notice_ratelimited() level is low for a failure messages. Why not dev_warn_ratelimited() instead?
Quoted 5 lines
drivers/net/ethernet/intel/libie/controlq.c +0
-1ret = -EBADMSG ;break ; } --2.54.0.rc2.544.gc7ae2d5bb8-goog
Quoted 65 lines · Aleksandr
Quoted 65 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Li Li via Intel-wired-lan
Sent: Friday, April 24, 2026 5:16 AM
To: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Eric Dumazet <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; David Decotigny <[email protected]>; Singhai, Anjali <[email protected]>; Samudrala, Sridhar <[email protected]>; Brian Vazquez <[email protected]>; Li Li <[email protected]>; Tantilov, Emil S <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] libie: log more info when virtchnl failsVirtchnl failures can be hard to debug without logs. Logging the details of virtchnl transactions can be useful for debugging virtchnl- related issues.
Tested: Built and booted on a test machine.
Signed-off-by Li Li <[email protected]>--- drivers/net/ethernet/intel/libie/controlq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/net/ethernet/intel/libie/controlq.c +10
-0@@ -762,6 +762,16 @@ libie_ctlq_xn_process_recv(structlibie_ctlq_xn_recv_params *params, status = ctlq_msg->chnl_retval ? -EFAULT :0 ; xn = &xnm->ring[xn_index]; + +if (ctlq_msg->chnl_retval) { +dev_err_ratelimited ( + params->ctlq->dev, + "Non-zero virtchnl ret val (msg op: %u, ret val: %u, msg_cookie: %u, data_len: %u); xn op: %u, id: %u, cookie: %u\n", + ctlq_msg->chnl_opcode, ctlq_msg->chnl_retval, + msg_cookie, ctlq_msg->data_len, xn- >virtchnl_opcode, + xn->index, xn->cookie); + } +if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || msg_cookie != xn->cookie) return false;drivers/net/ethernet/intel/libie/controlq.c +4
-0@@ -1011,6 +1021,11 @@ int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) params->recv_mem = xn->recv_mem;break ;default : +dev_notice_ratelimited ( + params->ctlq->dev, + "Transaction failed (op %u, xn state: %d, id: %u, cookie: %u, size: %zu)\n", + params->chnl_opcode, xn->state, xn->index, xn-
Quoted 4 lines
drivers/net/ethernet/intel/libie/controlq.c int libie_ctlq_xn_send(struct · line 1031
Quoted 2 lines
drivers/net/ethernet/intel/libie/controlq.c +1
-0>cookie, + xn->recv_mem.iov_len);For me
dev_notice_ratelimited()level is low for a failure messages. Why notdev_warn_ratelimited()instead?
Good call. Switched to using dev_warn_ratelimited() in the v2 patch. Thanks for the suggestion!
Quoted 7 lines
Quoted 6 lines
ret = -EBADMSG; break; }--
2.54.0.rc2.544.gc7ae2d5bb8-goog
Dear Li,
Thank you for your patch.
Am 24.04.26 um 05:15 schrieb Li Li via Intel-wired-lan:
Quoted 3 lines
Virtchnl failures can be hard to debug without logs. Logging the details of virtchnl transactions can be useful for debugging virtchnl-related issues.
Why is the first added one added as error, and the second as info?
Do you have a reproducer to get each of the new log messages?
Quoted 1 line
Tested: Built and booted on a test machine.
Please paste the new messages.
Quoted 28 lines
Signed-off-by Li Li <[email protected]>--- drivers/net/ethernet/intel/libie/controlq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/net/ethernet/intel/libie/controlq.c +10
-0@@ -762,6 +762,16 @@ libie_ctlq_xn_process_recv(struct libie_ctlq_xn_recv_params *params, status = ctlq_msg->chnl_retval ? -EFAULT :0 ; xn = &xnm->ring[xn_index]; + +if (ctlq_msg->chnl_retval) { +dev_err_ratelimited ( + params->ctlq->dev, +"Non-zero virtchnl ret val (msg op: %u, ret val: %u, msg_cookie: %u, data_len: %u); xn op: %u, id: %u, cookie: %u\n" , + ctlq_msg->chnl_opcode, ctlq_msg->chnl_retval, + msg_cookie, ctlq_msg->data_len, xn->virtchnl_opcode, + xn->index, xn->cookie); + } +if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || msg_cookie != xn->cookie)return false;@@ -1011,6 +1021,11 @@ int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) params->recv_mem = xn->recv_mem;
drivers/net/ethernet/intel/libie/controlq.c int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) · line 1031
Quoted 10 lines
drivers/net/ethernet/intel/libie/controlq.c +5
-0break ;default : +dev_notice_ratelimited ( + params->ctlq->dev, +"Transaction failed (op %u, xn state: %d, id: %u, cookie: %u, size: %zu)\n" , + params->chnl_opcode, xn->state, xn->index, xn->cookie, + xn->recv_mem.iov_len); ret = -EBADMSG ;break ; }
Kind regards,
Paul
Quoted 4 lines · Paul Menzel
Dear Li,
Quoted 8 lines
Thank you for your patch.
Am 24.04.26 um 05:15 schrieb Li Li via Intel-wired-lan:
Quoted 3 lines
Virtchnl failures can be hard to debug without logs. Logging the details of virtchnl transactions can be useful for debugging virtchnl-related issues.
Why is the first added one added as error, and the second as info?
Originally I was thinking the second log doesn't warrant an err level log, but on second thought, I think it makes more sense to use dev_err_ratelimited() in both places. I will send out a v3 patch to update it.
Quoted 3 lines
Do you have a reproducer to get each of the new log messages?
We recently had an IOMMU subsystem bug in our internal kernel that caused virtchnl failures, and this patch helped root cause the IOMMU subsystem issue. However, the patch we used internally was applied to the OOT driver, which is implemented slightly differently than the upstream driver. Example log we saw in our OOT driver, with the patch applied:
idpf 0000:43:00.0: Non-zero virtchnl ret val (msg: 523, ret val: 6,data_len: 0) (xn 523, id: 254, salt: 40, iov len: 128)
The message looks slightly different from the log added in this patch because the OOT driver uses different terminology.
Quoted 4 lines
Quoted 2 lines
Tested: Built and booted on a test machine.
Please paste the new messages.
As mentioned above, I don't have a reproducer for a real virtchnl error in the upstream kernel, but I synthetically produced an error by changing ctlq_msg->chnl_retval, and the following message appeared:
[ 309.891790] idpf 0000:01:00.0: Non-zero virtchnl ret val (msg op: 1, ret val: 6, msg_cookie: 0, data_len: 8); xn op: 1, id: 0, cookie: 0 [ 309.892357] idpf 0000:01:00.0: Transaction failed (op 1, xn state:
3, id: 0, cookie: 0, size: 8)
I will mention it in the v3 patch as well.
Quoted 44 lines
Quoted 29 lines
Signed-off-by Li Li <[email protected]>--- drivers/net/ethernet/intel/libie/controlq.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/net/ethernet/intel/libie/controlq.c +10
-0@@ -762,6 +762,16 @@ libie_ctlq_xn_process_recv(struct libie_ctlq_xn_recv_params *params, status = ctlq_msg->chnl_retval ? -EFAULT :0 ; xn = &xnm->ring[xn_index]; + +if (ctlq_msg->chnl_retval) { +dev_err_ratelimited ( + params->ctlq->dev, +"Non-zero virtchnl ret val (msg op: %u, ret val: %u, msg_cookie: %u, data_len: %u); xn op: %u, id: %u, cookie: %u\n" , + ctlq_msg->chnl_opcode, ctlq_msg->chnl_retval, + msg_cookie, ctlq_msg->data_len, xn->virtchnl_opcode, + xn->index, xn->cookie); + } +if (ctlq_msg->chnl_opcode != xn->virtchnl_opcode || msg_cookie != xn->cookie)return false;@@ -1011,6 +1021,11 @@ int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) params->recv_mem = xn->recv_mem;drivers/net/ethernet/intel/libie/controlq.c int libie_ctlq_xn_send(struct libie_ctlq_xn_send_params *params) · line 1031
Quoted 10 lines
drivers/net/ethernet/intel/libie/controlq.c +5
-0break ;default : +dev_notice_ratelimited ( + params->ctlq->dev, +"Transaction failed (op %u, xn state: %d, id: %u, cookie: %u, size: %zu)\n" , + params->chnl_opcode, xn->state, xn->index, xn->cookie, + xn->recv_mem.iov_len); ret = -EBADMSG ;break ; }Kind regards,
Paul