netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Zhengchao Shao <shaozhengchao@huawei.com>,
	linux-s390@vger.kernel.org,  netdev@vger.kernel.org,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org
Cc: wenjia@linux.ibm.com, jaka@linux.ibm.com,
	alibuda@linux.alibaba.com,  tonylu@linux.alibaba.com,
	guwen@linux.alibaba.com, weiyongjun1@huawei.com,
	 yuehaibing@huawei.com, tangchengchang@huawei.com
Subject: Re: [PATCH net] net/smc: fix potential sleeping issue in smc_switch_conns
Date: Tue, 16 Apr 2024 14:06:42 +0200	[thread overview]
Message-ID: <b2573ccf2340a19b6cb039dac639b2d431c1404c.camel@redhat.com> (raw)
In-Reply-To: <20240413035150.3338977-1-shaozhengchao@huawei.com>

On Sat, 2024-04-13 at 11:51 +0800, Zhengchao Shao wrote:
> Potential sleeping issue exists in the following processes:
> smc_switch_conns
>   spin_lock_bh(&conn->send_lock)
>   smc_switch_link_and_count
>     smcr_link_put
>       __smcr_link_clear
>         smc_lgr_put
>           __smc_lgr_free
>             smc_lgr_free_bufs
>               __smc_lgr_free_bufs
>                 smc_buf_free
>                   smcr_buf_free
>                     smcr_buf_unmap_link
>                       smc_ib_put_memory_region
>                         ib_dereg_mr
>                           ib_dereg_mr_user
>                             mr->device->ops.dereg_mr
> If scheduling exists when the IB driver implements .dereg_mr hook
> function, the bug "scheduling while atomic" will occur. For example,
> cxgb4 and efa driver. Use mutex lock instead of spin lock to fix it.

I tried to inspect all the lock call sites, and it *look* like they are
all in process context, so the switch should be feasible.

Still the fact that the existing lock is a BH variant is suspect.
Either the BH part was not needed or this can introduce subtle
regressions/issues. 

I think this deserves at least a 3rd party testing.

Thanks,

Paolo


  parent reply	other threads:[~2024-04-16 12:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-13  3:51 [PATCH net] net/smc: fix potential sleeping issue in smc_switch_conns Zhengchao Shao
2024-04-15 17:37 ` Wenjia Zhang
2024-04-16 12:06 ` Paolo Abeni [this message]
2024-04-17  7:32   ` Guangguan Wang
2024-04-17 15:17     ` Wenjia Zhang
2024-04-17  8:00 ` Guangguan Wang
2024-04-17  8:29   ` shaozhengchao
2024-04-17 15:23     ` Wenjia Zhang
2024-04-18  1:48       ` shaozhengchao
2024-04-18  7:50         ` Wenjia Zhang
2024-04-18 11:01           ` shaozhengchao
2024-04-18 11:57             ` Wenjia Zhang

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=b2573ccf2340a19b6cb039dac639b2d431c1404c.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=guwen@linux.alibaba.com \
    --cc=jaka@linux.ibm.com \
    --cc=kuba@kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shaozhengchao@huawei.com \
    --cc=tangchengchang@huawei.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=weiyongjun1@huawei.com \
    --cc=wenjia@linux.ibm.com \
    --cc=yuehaibing@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).