Received: by 10.223.185.116 with SMTP id b49csp5453947wrg; Wed, 7 Mar 2018 12:02:39 -0800 (PST) X-Google-Smtp-Source: AG47ELvVnaT6e8XwcCx4mrJK9+W+GyQ8gTDvy4UtxnRCvzK+GVyBXZhspv9StFnass+JIybpVNdB X-Received: by 10.99.38.135 with SMTP id m129mr11610201pgm.2.1520452959656; Wed, 07 Mar 2018 12:02:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520452959; cv=none; d=google.com; s=arc-20160816; b=MDmm3D7Jd28J9C3Q3jix57jmjIfg4xPdvVw/G+P6x5xm4wZ36AmSXYhu0X9r+mxY/2 ISDVPzfcZJNJSSYSaVV8G0W7+dteC2XSdATUKfPS4C3XDhG0THCerl/CBzZYkL962SI1 ke8guDQbS+sV37WTMSOmJ79yYzlvxFjrcL085bwTvM49sfnT7IvkBZunZZgo5APWsnu6 3dSQ0tAWAscmTGzBtoXx3YQDiBVPfxKDmZYsoSOugtfkQeblPsJFK85uDOafDdDQT3x+ n39jsLmAdW6T+xJ1GG8tTStvovRNVnRlc4UjZ9tPRVmOqlvrCt+DB4VXnScvrRkGOEe0 ut+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hbf4e03Snw1joiP9+JkX2+O8Vj5F3tK18B6MRR7rnv0=; b=gc+hBPhdCzvUJ4QrC2dtjlprDOZfqtuXkKZvJnuKKkj+IM80UqJ3wj+rq5AGk9SNH0 5ciejXydBEOHTJfEfQHxz6m8non9MeF9RD/gg97LReUTe9CAO/bEmnojr3JoEtYPn+YS V1twtA7F2HN0VIZSiAEkf1clcBUxf50rlU9WVOubRHUxMPlC4432JBPsq285AIgrhwC0 1wzTSaIkEHFfRF3HesM7Vzj1vV083sEHFJ6qqsaML/ghWf/VJmq7kb1rQcMJrGg+SXRu y93ND1XsFiRhEwjE99HqNRRi0u6jAm1xxMl8yzsPx0OkUpAHHhUIIo4fk2vpwEeZkt6b vwPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u82si14343187pfg.389.2018.03.07.12.02.24; Wed, 07 Mar 2018 12:02:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965639AbeCGTq7 (ORCPT + 99 others); Wed, 7 Mar 2018 14:46:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44832 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754916AbeCGTq5 (ORCPT ); Wed, 7 Mar 2018 14:46:57 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A61A510DA; Wed, 7 Mar 2018 19:46:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jason Wang , "Michael S. Tsirkin" , "David S. Miller" Subject: [PATCH 4.14 074/110] virtio-net: disable NAPI only when enabled during XDP set Date: Wed, 7 Mar 2018 11:38:57 -0800 Message-Id: <20180307191049.130846330@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jason Wang [ Upstream commit 4e09ff5362843dff3accfa84c805c7f3a99de9cd ] We try to disable NAPI to prevent a single XDP TX queue being used by multiple cpus. But we don't check if device is up (NAPI is enabled), this could result stall because of infinite wait in napi_disable(). Fixing this by checking device state through netif_running() before. Fixes: 4941d472bf95b ("virtio-net: do not reset during XDP set") Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/virtio_net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1995,8 +1995,9 @@ static int virtnet_xdp_set(struct net_de } /* Make sure NAPI is not using any XDP TX queues for RX. */ - for (i = 0; i < vi->max_queue_pairs; i++) - napi_disable(&vi->rq[i].napi); + if (netif_running(dev)) + for (i = 0; i < vi->max_queue_pairs; i++) + napi_disable(&vi->rq[i].napi); netif_set_real_num_rx_queues(dev, curr_qp + xdp_qp); err = _virtnet_set_queues(vi, curr_qp + xdp_qp); @@ -2015,7 +2016,8 @@ static int virtnet_xdp_set(struct net_de } if (old_prog) bpf_prog_put(old_prog); - virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); + if (netif_running(dev)) + virtnet_napi_enable(vi->rq[i].vq, &vi->rq[i].napi); } return 0;