]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
RDMA/hns: Fix warning in poll cq direct mode
authorLianfa Weng <wenglianfa@huawei.com>
Wed, 20 May 2026 05:57:58 +0000 (13:57 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 25 May 2026 14:39:04 +0000 (11:39 -0300)
CQs allocated by ib_alloc_cq() always have a comp_handler. Though
in direct mode this handler is never expected to be called, it
is still called when the driver is reset, triggering the following
WARN_ONCE():

Call trace:
ib_cq_completion_direct+0x38/0x60
hns_roce_cq_completion+0x54/0x90 (hns_roce_hw_v2]
hns_roce_handle_device_err+Ox1c8/0x340 [hns_roce_hw_v2]
hns_roce_hw_v2_uninit_instance.constprop.0+0x34/0x70 [hns_roce_hw_v2]
hns_roce_hw_v2_reset_notify+0xc4/0xe0 [hns_roce_hw_v2]
hclge_notify_roce_client+0x60/0xbc [hclge]
hclge_reset_rebuild+0x48/0x34c [hclge]
hclge_reset_subtask+0xcc/0xec [hclge]
hclge_reset_service_task+0x80/0x160 [hclge]
hclge_service_task+0x50/0x80 (hclge]
process_one_work+0x1cc/0x4d0
worker_thread+0x154/0x414
kthread+0x104/0x144
ret_from_fork+0x10/0x18

Fixes: f295e4cece5c ("RDMA/hns: Delete unnecessary callback functions for cq")
Link: https://patch.msgid.link/r/20260520055759.2354037-3-huangjunxian6@hisilicon.com
Signed-off-by: Lianfa Weng <wenglianfa@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_main.c

index c17ff5347a0147f6aee14d9300d52d5345f3ab27..77bad9f5d482bbf5b43cf5202ebd0cb8bdc277e3 100644 (file)
@@ -1112,7 +1112,7 @@ static void check_and_get_armed_cq(struct list_head *cq_list, struct ib_cq *cq)
        unsigned long flags;
 
        spin_lock_irqsave(&hr_cq->lock, flags);
-       if (cq->comp_handler) {
+       if (cq->comp_handler && hr_cq->ib_cq.poll_ctx != IB_POLL_DIRECT) {
                if (!hr_cq->is_armed) {
                        hr_cq->is_armed = 1;
                        list_add_tail(&hr_cq->node, cq_list);