From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB711C5ACCC for ; Thu, 18 Oct 2018 05:30:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 66FB620866 for ; Thu, 18 Oct 2018 05:30:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66FB620866 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=davemloft.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727534AbeJRN3R (ORCPT ); Thu, 18 Oct 2018 09:29:17 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:55020 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727352AbeJRN3Q (ORCPT ); Thu, 18 Oct 2018 09:29:16 -0400 Received: from localhost (c-67-183-62-245.hsd1.wa.comcast.net [67.183.62.245]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 8B0B913AE209F; Wed, 17 Oct 2018 22:30:02 -0700 (PDT) Date: Wed, 17 Oct 2018 22:30:01 -0700 (PDT) Message-Id: <20181017.223001.1576138840071012489.davem@davemloft.net> To: ake@igel.co.jp Cc: jasowang@redhat.com, mst@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] virtio_net: avoid using netif_tx_disable() for serializing tx routine From: David Miller In-Reply-To: <20181017104419.13003-1-ake@igel.co.jp> References: <276ac5bb-90f7-5fb6-a826-0bb05ecfa069@redhat.com> <20181017104419.13003-1-ake@igel.co.jp> X-Mailer: Mew version 6.7 on Emacs 26 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 17 Oct 2018 22:30:02 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ake Koomsin Date: Wed, 17 Oct 2018 19:44:12 +0900 > Commit 713a98d90c5e ("virtio-net: serialize tx routine during reset") > introduces netif_tx_disable() after netif_device_detach() in order to > avoid use-after-free of tx queues. However, there are two issues. > > 1) Its operation is redundant with netif_device_detach() in case the > interface is running. > 2) In case of the interface is not running before suspending and > resuming, the tx does not get resumed by netif_device_attach(). > This results in losing network connectivity. > > It is better to use netif_tx_lock_bh()/netif_tx_unlock_bh() instead for > serializing tx routine during reset. This also preserves the symmetry > of netif_device_detach() and netif_device_attach(). > > Fixes commit 713a98d90c5e ("virtio-net: serialize tx routine during reset") > Signed-off-by: Ake Koomsin Applied and queued up for -stable.