Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Roman Demidov" <roman.demidov.nn@gmail.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH 5.10] RDMA/hns: Fix WQ_MEM_RECLAIM warning
Date: Tue, 06 Oct 2026 08:37:47 +0000	[thread overview]
Message-ID: <20261006083748.310031F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261006081840.125567-1-roman.demidov.nn@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] workqueue: WQ_MEM_RECLAIM rescuer deadlock via GFP_KERNEL
--

commit 324f8a5f04c3f5e308cb6f7d1d9cb0367924235e
Author: Chengchang Tang <tangchengchang@huawei.com>

RDMA/hns: Fix WQ_MEM_RECLAIM warning

This commit adds the WQ_MEM_RECLAIM flag to the hns_roce_irq_workq
workqueue to resolve a check_flush_dependency warning triggered during
QP destruction.

Link: https://patch.msgid.link/20260104064057.1582216-2-huangjunxian6@hisilicon.com

> diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> index 0468028ffe390..3e49baf2abf61 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
> @@ -6082,7 +6082,8 @@ static int hns_roce_v2_init_eq_table(struct hns_roce_dev *hr_dev)
>  		goto err_request_irq_fail;
>  	}
>  
> -	hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq", 0);
> +	hr_dev->irq_workq = alloc_ordered_workqueue("hns_roce_irq_workq",
> +						    WQ_MEM_RECLAIM);

[Severity: High]
Adding WQ_MEM_RECLAIM to a workqueue creates a rescuer thread that
executes during memory pressure to guarantee forward progress. Can this
introduce a deadlock if the work items perform GFP_KERNEL allocations?

Looking at the work executed by this queue, flush_work_handle() calls
hns_roce_modify_qp(), which eventually calls hns_roce_alloc_cmd_mailbox().

In hns_roce_alloc_cmd_mailbox(), memory is allocated using GFP_KERNEL:

drivers/infiniband/hw/hns/hns_roce_cmd.c:hns_roce_alloc_cmd_mailbox() {
        ...
        mailbox = kmalloc(sizeof(*mailbox), GFP_KERNEL);
        if (!mailbox)
                return ERR_PTR(-ENOMEM);

        mailbox->buf = dma_pool_alloc(hr_dev->cmd.pool, GFP_KERNEL,
                                      &mailbox->dma);
        ...
}

Since the rescuer thread is supposed to relieve memory pressure, blocking
on GFP_KERNEL allocations defeats its purpose and could permanently block
the rescuer. Does this patch trade a flush dependency warning for a
potential deadlock?

>  	if (!hr_dev->irq_workq) {
>  		dev_err(dev, "Create irq workqueue failed!\n");
>  		ret = -ENOMEM;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006081840.125567-1-roman.demidov.nn@gmail.com?part=1

      reply	other threads:[~2026-10-06  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06  8:18 [PATCH 5.10] RDMA/hns: Fix WQ_MEM_RECLAIM warning Roman Demidov
2026-10-06  8:37 ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261006083748.310031F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=roman.demidov.nn@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox