netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Jijie Shao <shaojijie@huawei.com>
Cc: yisen.zhuang@huawei.com, salil.mehta@huawei.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, shenjian15@huawei.com, wangjie125@huawei.com,
	liuyonglong@huawei.com, wangpeiyang1@huawei.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2 net 4/4] net: hns3: fix deadlock issue when externel_lb and reset are executed together
Date: Tue, 8 Aug 2023 21:41:16 +0300	[thread overview]
Message-ID: <20230808184116.GF94631@unreal> (raw)
In-Reply-To: <20230807113452.474224-5-shaojijie@huawei.com>

On Mon, Aug 07, 2023 at 07:34:52PM +0800, Jijie Shao wrote:
> From: Yonglong Liu <liuyonglong@huawei.com>
> 
> When externel_lb and reset are executed together, a deadlock may
> occur:
> [ 3147.217009] INFO: task kworker/u321:0:7 blocked for more than 120 seconds.
> [ 3147.230483] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
> [ 3147.238999] task:kworker/u321:0  state:D stack:    0 pid:    7 ppid:     2 flags:0x00000008
> [ 3147.248045] Workqueue: hclge hclge_service_task [hclge]
> [ 3147.253957] Call trace:
> [ 3147.257093]  __switch_to+0x7c/0xbc
> [ 3147.261183]  __schedule+0x338/0x6f0
> [ 3147.265357]  schedule+0x50/0xe0
> [ 3147.269185]  schedule_preempt_disabled+0x18/0x24
> [ 3147.274488]  __mutex_lock.constprop.0+0x1d4/0x5dc
> [ 3147.279880]  __mutex_lock_slowpath+0x1c/0x30
> [ 3147.284839]  mutex_lock+0x50/0x60
> [ 3147.288841]  rtnl_lock+0x20/0x2c
> [ 3147.292759]  hclge_reset_prepare+0x68/0x90 [hclge]
> [ 3147.298239]  hclge_reset_subtask+0x88/0xe0 [hclge]
> [ 3147.303718]  hclge_reset_service_task+0x84/0x120 [hclge]
> [ 3147.309718]  hclge_service_task+0x2c/0x70 [hclge]
> [ 3147.315109]  process_one_work+0x1d0/0x490
> [ 3147.319805]  worker_thread+0x158/0x3d0
> [ 3147.324240]  kthread+0x108/0x13c
> [ 3147.328154]  ret_from_fork+0x10/0x18
> 
> In externel_lb process, the hns3 driver call napi_disable()
> first, then the reset happen, then the restore process of the
> externel_lb will fail, and will not call napi_enable(). When
> doing externel_lb again, napi_disable() will be double call,
> cause a deadlock of rtnl_lock().
> 
> This patch use the HNS3_NIC_STATE_DOWN state to protect the
> calling of napi_disable() and napi_enable() in externel_lb
> process, just as the usage in ndo_stop() and ndo_start().
> 
> Fixes: 04b6ba143521 ("net: hns3: add support for external loopback test")
> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>
> ---
>  drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 

Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

  reply	other threads:[~2023-08-08 18:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 11:34 [PATCH V2 net 0/4] There are some bugfix for the HNS3 ethernet driver Jijie Shao
2023-08-07 11:34 ` [PATCH V2 net 1/4] net: hns3: restore user pause configure when disable autoneg Jijie Shao
2023-08-08 18:40   ` Leon Romanovsky
2023-08-07 11:34 ` [PATCH V2 net 2/4] net: hns3: refactor hclge_mac_link_status_wait for interface reuse Jijie Shao
2023-08-08 18:40   ` Leon Romanovsky
2023-08-07 11:34 ` [PATCH V2 net 3/4] net: hns3: add wait until mac link down Jijie Shao
2023-08-08 18:41   ` Leon Romanovsky
2023-08-07 11:34 ` [PATCH V2 net 4/4] net: hns3: fix deadlock issue when externel_lb and reset are executed together Jijie Shao
2023-08-08 18:41   ` Leon Romanovsky [this message]
2023-08-08 23:40 ` [PATCH V2 net 0/4] There are some bugfix for the HNS3 ethernet driver patchwork-bot+netdevbpf

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=20230808184116.GF94631@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=wangjie125@huawei.com \
    --cc=wangpeiyang1@huawei.com \
    --cc=yisen.zhuang@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).