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 4D2722B9C7; Sun, 1 Sep 2024 16:39:11 +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=1725208752; cv=none; b=ktRMP6fGOr2c9wshZIZryyhozZCB3mhA6QipdRRr2lUak3Kn4zhBIxCxfJtratT8fFaEWszAupoc6lnMKSzMGIFQrQxCDDPtWr9h/GOsudZdA1+3jMgxAB2wQHWRxHNzxo/ayc/f17TUCASt5KzgaJso4iSfNGkFtH6Hc1HV7f4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725208752; c=relaxed/simple; bh=Q8qsO7K8W9NCtRxyIyML5zJECtGmtivSeeHZCZfBSJA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TPG+KaSxhpuabkvoW27L9q64C806tdjG3FmuVDjkqbHjZFrdqDUXl48Vom9xzhdlCYIU0rgEKlTTJ2TsdHLdZAcqXIaBbSGEahKRrZGJLnlopnqyM39JdF9qnAzKx0+55gEi1fzu09E7S78m18aKPoMSVS5VvyGmqO3yOjx1RrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Iu5y/lwV; 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="Iu5y/lwV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 604ECC4CEC3; Sun, 1 Sep 2024 16:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725208751; bh=Q8qsO7K8W9NCtRxyIyML5zJECtGmtivSeeHZCZfBSJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iu5y/lwVhi6n+YEeEgY5sl+9BYuGF+yqvwxqk8bd7GBJj467EpUnhAdLMySu7uyDa D5FT0APXH/RTaHbRumVf0ZUrvcz5JcsCkaWl0JWVsLes5iRbDmN9sHSSekYzLAoQ6x RDYqURI/HM3rkToTqzCRTFpo7F4u0qk4m/h2RehQ= 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 5.4 029/134] net: hns3: fix a deadlock problem when config TC during resetting Date: Sun, 1 Sep 2024 18:16:15 +0200 Message-ID: <20240901160811.202969617@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160809.752718937@linuxfoundation.org> References: <20240901160809.752718937@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 5.4-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 d09cc10b3517f..8736e254f098b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c @@ -4388,6 +4388,9 @@ static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) struct hns3_nic_priv *priv = netdev_priv(netdev); int ret; + 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