From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F11919F485; Tue, 27 Aug 2024 15:21:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724772083; cv=none; b=HtGLdVSiyMaMNSeNLBJcA+WYcaJ2gWG6MEOLeRM0rjVKl/6VaJJ6ucha3CxPaYZhG7R9mAh/bMp8trQmZN7RqNfMEYSJ8QyYg9nRNAo0Tn2THYgs27uj75jsL5RCTBecRhj978IJhbWMgsDgOlkD8YOgGJQOXkZaBGFBgLXNkaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724772083; c=relaxed/simple; bh=ots0cEN/nTq/ZVEs32JOMuDJezkKaDRzgaRUurXrt+Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lFHjBs9l8PK+L1a9NfN4VLQ5jsNOQviGwuIGNL9pxk7ZA8+/3B3j/9MDcZLik5QVk6jVjxR8X359v22kBWM6MPUoH39BkQ0En8eUhYz1hGV7QHBx0ul0Q1v70daq9aVPlnT0ZeFfKJRgf12mE3ZSpQTMDBBrgl5XAevlmiIpuXo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EfQ695r3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EfQ695r3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 983FDC4FE08; Tue, 27 Aug 2024 15:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724772083; bh=ots0cEN/nTq/ZVEs32JOMuDJezkKaDRzgaRUurXrt+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EfQ695r3QmyDvYbTY8G5FjcAx+/HnhZmwUgGVumA/y4siZXkQgxXNWiooY0MzJzWB vtpXHeBYpucu9iMcMHwLx5Gi+Vo6AW2K0rr7wkjXPNNYAOjx7F6OHB0PmukNTY1d6x 1SisqaPBLPAJVJUCps9wZPdAd8RvioZH+rMBXmwQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jie Wang , Jijie Shao , Paolo Abeni , Sasha Levin Subject: [PATCH 6.1 109/321] net: hns3: fix a deadlock problem when config TC during resetting Date: Tue, 27 Aug 2024 16:36:57 +0200 Message-ID: <20240827143842.395409183@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240827143838.192435816@linuxfoundation.org> References: <20240827143838.192435816@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jie Wang [ Upstream commit be5e816d00a506719e9dbb1a9c861c5ced30a109 ] When config TC during the reset process, may cause a deadlock, the flow is as below: pf reset start │ ▼ ...... setup tc │ │ ▼ ▼ DOWN: napi_disable() napi_disable()(skip) │ │ │ ▼ ▼ ...... ...... │ │ ▼ │ napi_enable() │ ▼ UINIT: netif_napi_del() │ ▼ ...... │ ▼ INIT: netif_napi_add() │ ▼ ...... global reset start │ │ ▼ ▼ UP: napi_enable()(skip) ...... │ │ ▼ ▼ ...... napi_disable() In reset process, the driver will DOWN the port and then UINIT, in this case, the setup tc process will UP the port before UINIT, so cause the problem. Adds a DOWN process in UINIT to fix it. Fixes: bb6b94a896d4 ("net: hns3: Add reset interface implementation in client") Signed-off-by: Jie Wang Signed-off-by: Jijie Shao Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c index 4ce43c3a00a37..0377a056aaecc 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -5728,6 +5728,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) struct net_device *netdev = handle->kinfo.netdev; struct hns3_nic_priv *priv = netdev_priv(netdev); + if (!test_bit(HNS3_NIC_STATE_DOWN, &priv->state)) + hns3_nic_net_stop(netdev); + if (!test_and_clear_bit(HNS3_NIC_STATE_INITED, &priv->state)) { netdev_warn(netdev, "already uninitialized\n"); return 0; -- 2.43.0