public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/cm: Remove redundant WARN_ON in cm_free_priv_msg
@ 2025-05-09  8:18 Li Zhijian
  2025-05-12 10:53 ` Leon Romanovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhijian @ 2025-05-09  8:18 UTC (permalink / raw)
  To: jgg, leon, linux-rdma; +Cc: linux-kernel, Li Zhijian

Sometimes, the blktests triggered this WARN_ON():
 ------------[ cut here ]------------
 WARNING: CPU: 3 PID: 1330889 at cm.c:353 cm_free_priv_msg+0xaa/0xc0 [ib_cm]
...
 CPU: 3 UID: 0 PID: 1330889 Comm: kworker/u16:1 Tainted: G        W  OE      6.13.0-rc3+ #3
 Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
 Workqueue: ib_mad1 timeout_sends [ib_core]
 RIP: 0010:cm_free_priv_msg+0xaa/0xc0 [ib_cm]
...
 Call Trace:
  <TASK>
  ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
  ? __warn.cold+0x93/0xfa
  ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
  ? report_bug+0xff/0x140
  ? handle_bug+0x58/0x90
  ? exc_invalid_op+0x17/0x70
  ? asm_exc_invalid_op+0x1a/0x20
  ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
  cm_process_send_error+0x64/0x1f0 [ib_cm]
  timeout_sends+0x1e5/0x2d0 [ib_core]
  process_one_work+0x156/0x310
  worker_thread+0x252/0x390
  ? __pfx_worker_thread+0x10/0x10
  kthread+0xd2/0x100
  ? __pfx_kthread+0x10/0x10
  ret_from_fork+0x34/0x50
  ? __pfx_kthread+0x10/0x10
  ret_from_fork_asm+0x1a/0x30
  </TASK>
 ---[ end trace 0000000000000000 ]---

In cm_process_send_error(), cm_free_priv_msg() will be called
when (msg != cm_id_priv->msg) is true. And all other calling to
cm_free_priv_msg() cases, msg is always the same as cm_id_priv->msg.

So it's safe to remove this WARN_ON

Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
 drivers/infiniband/core/cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 142170473e75..1a8e5b0e4d85 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -350,7 +350,7 @@ static void cm_free_priv_msg(struct ib_mad_send_buf *msg)
 
 	lockdep_assert_held(&cm_id_priv->lock);
 
-	if (!WARN_ON(cm_id_priv->msg != msg))
+	if (cm_id_priv->msg == msg)
 		cm_id_priv->msg = NULL;
 
 	if (msg->ah)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/cm: Remove redundant WARN_ON in cm_free_priv_msg
  2025-05-09  8:18 [PATCH] IB/cm: Remove redundant WARN_ON in cm_free_priv_msg Li Zhijian
@ 2025-05-12 10:53 ` Leon Romanovsky
  2025-05-13  0:42   ` Zhijian Li (Fujitsu)
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2025-05-12 10:53 UTC (permalink / raw)
  To: Li Zhijian; +Cc: jgg, linux-rdma, linux-kernel

On Fri, May 09, 2025 at 04:18:40PM +0800, Li Zhijian wrote:
> Sometimes, the blktests triggered this WARN_ON():
>  ------------[ cut here ]------------
>  WARNING: CPU: 3 PID: 1330889 at cm.c:353 cm_free_priv_msg+0xaa/0xc0 [ib_cm]
> ...
>  CPU: 3 UID: 0 PID: 1330889 Comm: kworker/u16:1 Tainted: G        W  OE      6.13.0-rc3+ #3
>  Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
>  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
>  Workqueue: ib_mad1 timeout_sends [ib_core]
>  RIP: 0010:cm_free_priv_msg+0xaa/0xc0 [ib_cm]
> ...
>  Call Trace:
>   <TASK>
>   ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>   ? __warn.cold+0x93/0xfa
>   ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>   ? report_bug+0xff/0x140
>   ? handle_bug+0x58/0x90
>   ? exc_invalid_op+0x17/0x70
>   ? asm_exc_invalid_op+0x1a/0x20
>   ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>   cm_process_send_error+0x64/0x1f0 [ib_cm]
>   timeout_sends+0x1e5/0x2d0 [ib_core]
>   process_one_work+0x156/0x310
>   worker_thread+0x252/0x390
>   ? __pfx_worker_thread+0x10/0x10
>   kthread+0xd2/0x100
>   ? __pfx_kthread+0x10/0x10
>   ret_from_fork+0x34/0x50
>   ? __pfx_kthread+0x10/0x10
>   ret_from_fork_asm+0x1a/0x30
>   </TASK>
>  ---[ end trace 0000000000000000 ]---
> 
> In cm_process_send_error(), cm_free_priv_msg() will be called
> when (msg != cm_id_priv->msg) is true. And all other calling to
> cm_free_priv_msg() cases, msg is always the same as cm_id_priv->msg.
> 
> So it's safe to remove this WARN_ON

This patch should fix the issue.
https://lore.kernel.org/all/0c364c29142f72b7875fdeba51f3c9bd6ca863ee.1745839788.git.leon@kernel.org/
7590649ee7af ("IB/cm: Drop lockdep assert and WARN when freeing old msg")

Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IB/cm: Remove redundant WARN_ON in cm_free_priv_msg
  2025-05-12 10:53 ` Leon Romanovsky
@ 2025-05-13  0:42   ` Zhijian Li (Fujitsu)
  0 siblings, 0 replies; 3+ messages in thread
From: Zhijian Li (Fujitsu) @ 2025-05-13  0:42 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org



On 12/05/2025 18:53, Leon Romanovsky wrote:
> On Fri, May 09, 2025 at 04:18:40PM +0800, Li Zhijian wrote:
>> Sometimes, the blktests triggered this WARN_ON():
>>   ------------[ cut here ]------------
>>   WARNING: CPU: 3 PID: 1330889 at cm.c:353 cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>> ...
>>   CPU: 3 UID: 0 PID: 1330889 Comm: kworker/u16:1 Tainted: G        W  OE      6.13.0-rc3+ #3
>>   Tainted: [W]=WARN, [O]=OOT_MODULE, [E]=UNSIGNED_MODULE
>>   Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org 04/01/2014
>>   Workqueue: ib_mad1 timeout_sends [ib_core]
>>   RIP: 0010:cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>> ...
>>   Call Trace:
>>    <TASK>
>>    ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>>    ? __warn.cold+0x93/0xfa
>>    ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>>    ? report_bug+0xff/0x140
>>    ? handle_bug+0x58/0x90
>>    ? exc_invalid_op+0x17/0x70
>>    ? asm_exc_invalid_op+0x1a/0x20
>>    ? cm_free_priv_msg+0xaa/0xc0 [ib_cm]
>>    cm_process_send_error+0x64/0x1f0 [ib_cm]
>>    timeout_sends+0x1e5/0x2d0 [ib_core]
>>    process_one_work+0x156/0x310
>>    worker_thread+0x252/0x390
>>    ? __pfx_worker_thread+0x10/0x10
>>    kthread+0xd2/0x100
>>    ? __pfx_kthread+0x10/0x10
>>    ret_from_fork+0x34/0x50
>>    ? __pfx_kthread+0x10/0x10
>>    ret_from_fork_asm+0x1a/0x30
>>    </TASK>
>>   ---[ end trace 0000000000000000 ]---
>>
>> In cm_process_send_error(), cm_free_priv_msg() will be called
>> when (msg != cm_id_priv->msg) is true. And all other calling to
>> cm_free_priv_msg() cases, msg is always the same as cm_id_priv->msg.
>>
>> So it's safe to remove this WARN_ON
> 
> This patch should fix the issue.
> https://lore.kernel.org/all/0c364c29142f72b7875fdeba51f3c9bd6ca863ee.1745839788.git.leon@kernel.org/
> 7590649ee7af ("IB/cm: Drop lockdep assert and WARN when freeing old msg")


Yeah, thanks for this information.



> 
> Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-13  0:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09  8:18 [PATCH] IB/cm: Remove redundant WARN_ON in cm_free_priv_msg Li Zhijian
2025-05-12 10:53 ` Leon Romanovsky
2025-05-13  0:42   ` Zhijian Li (Fujitsu)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox