Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6804480ybl; Mon, 23 Dec 2019 12:14:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzcblkWqGa5hY9iCkGIckbO/zSACFXT1tUM7mDimOdz7p2jbB30RRbD3uyIt7KZgVsMwpB7 X-Received: by 2002:a9d:6f0d:: with SMTP id n13mr35557743otq.165.1577132090017; Mon, 23 Dec 2019 12:14:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577132090; cv=none; d=google.com; s=arc-20160816; b=helRtJpvsqMVv61baYuRcerKQ3YTaifz5Zi9dM1bkZkZWYj+4TGVhk7cApZsO6utCZ D2Jx3tp8RtWuTg+2DKzs8uT5wtudC8TudsM7nnNbwoKZ4UhIToN2nvVgQX04rn3DmQZZ QB2y/ZojCIcKXINdkrHSCztAaClaGzNeoCqEUm7Hs1ASb+egnfzz8vZrcdKHhZ9mRpIn e8BPb6yNpNuYRaHPRFTN3/299bY+swWAv5JYuBkQb6gex/nzA+rew9Jw90a2suM8ybWw dE6thHiw/a8+uz2o10rzfLHxG/D8AsEb/jgXt0WAcNu3w2jZCjFCElR5XAxbKFsfVTKF NdbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=hq48wF9NhqAaFGpnbg5sjL9dGZLXnI5W9HK7qIe6Fno=; b=ko1KsENz5v8Wvm6y4QDmGcJpov0+JM7RtDKGMKzhZ6TFjHodMK1fyaXNtsizCGD6UA iroRzQJsufOlLwz5HDqXvTjNLf/WEygHkhEqskFaqsffw3UBvzG5At6w/BAQvg8PoY6/ wYi5Hseja9UeGT1uruu74qamQgvRs8kvsxTfpu22z8/pBXldDxoKBDpWv0S/K+RDRXYZ V1X1hdfmiZl+n4MJERNXNERUK27jyJmS6/i0i3DOG86NzQ7GflTPDiuZyZSbLKnZlx6l iIxLk1oMXfYfDax3+wcySEtTCeKg3slRh66ZHFFgny9slUiIfa+BUAgOKA4A6iVUcC/f wmow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d2HxwQKD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c79si9300797oig.208.2019.12.23.12.14.38; Mon, 23 Dec 2019 12:14:49 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=d2HxwQKD; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726961AbfLWUNC (ORCPT + 99 others); Mon, 23 Dec 2019 15:13:02 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:39552 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726834AbfLWUNA (ORCPT ); Mon, 23 Dec 2019 15:13:00 -0500 Received: by mail-yb1-f194.google.com with SMTP id b12so7464838ybg.6 for ; Mon, 23 Dec 2019 12:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hq48wF9NhqAaFGpnbg5sjL9dGZLXnI5W9HK7qIe6Fno=; b=d2HxwQKDPzhGn2LHQszYi+myVQHBF/f7O1+oD/srE9zlKJbYChBdWFSWGz/jrChDv/ /ju7o45CYz4mT397h8IRzn9nJ3bxyyEBaIaAHUOt0Zvf3EcC9ciTHndroYj+T/wGI2dO VvQsgjZro8k0VH/LfN5OiItrifUfdG83gsT05J9Lt/R3N1BhcFX9iQ8IHw18PuabckMV W/C+yY63gY2Vzv9nEuMRhhyWAfl2ARn2Uip36Pklgyrf+D+NiQ1jCmRENV/7HNd6c+oz /kAvoQAhoItS9PQOCU/nDgozgycTvrPE0CJGfY8FXWx6X3d/znr0618xY2KQqRJqWZou 5p7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hq48wF9NhqAaFGpnbg5sjL9dGZLXnI5W9HK7qIe6Fno=; b=om0BgSyubkXfgtzjw7d5eCGlO33GqXfL0wJ+Byie85WQb6rNFYiVdFIHz4+ZXh7YS+ fZZztSTMcLGDDOy9/LHJypNBwJhK9xBr7Vcjh53+lW52GEZPuCevpjkMNDwPY9k1B84S kZ/ECTLb3MN9/tlAh95PEGtv7m7DSK8jlCwwPZwX9jMryynol2tg58kz1A4/f5e4QrCs EURSCaE8TuZXF/fDDIzis3oR4k/zaxYrbr/UFqawuRAcX3cX7+ZMD+GXL1v+bRYIgR4v PlFtJL73J4G5SyZvuYkUpZPKY9PsJFkXmZpVVuM3d6qnU9xuq+gc+l2pjUzTDKKn5ZlG 85FA== X-Gm-Message-State: APjAAAWuEKc3O8Fsu+bIPTupJ8+cZJjom5QdUlbuUTogyGZ572nZpWdl xUgEJrRO3M2x6FVYB4Rz4v+HOJ35 X-Received: by 2002:a25:b810:: with SMTP id v16mr21746924ybj.98.1577131978352; Mon, 23 Dec 2019 12:12:58 -0800 (PST) Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com. [209.85.219.178]) by smtp.gmail.com with ESMTPSA id d13sm8340706ywj.91.2019.12.23.12.12.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Dec 2019 12:12:57 -0800 (PST) Received: by mail-yb1-f178.google.com with SMTP id w126so5578829yba.3 for ; Mon, 23 Dec 2019 12:12:57 -0800 (PST) X-Received: by 2002:a5b:c43:: with SMTP id d3mr22795971ybr.203.1577131976738; Mon, 23 Dec 2019 12:12:56 -0800 (PST) MIME-Version: 1.0 References: <20191223140322.20013-1-mst@redhat.com> In-Reply-To: From: Willem de Bruijn Date: Mon, 23 Dec 2019 15:12:20 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net] virtio_net: CTRL_GUEST_OFFLOADS depends on CTRL_VQ To: Willem de Bruijn Cc: Alistair Delva , "Michael S. Tsirkin" , LKML , Jason Wang , "David S. Miller" , virtualization@lists.linux-foundation.org, Network Development 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 On Mon, Dec 23, 2019 at 2:56 PM Willem de Bruijn wrote: > > 00fffe0ff0 DR7: 0000000000000400 > > > Call Trace: > > > ? preempt_count_add+0x58/0xb0 > > > ? _raw_spin_lock_irqsave+0x36/0x70 > > > ? _raw_spin_unlock_irqrestore+0x1a/0x40 > > > ? __wake_up+0x70/0x190 > > > virtnet_set_features+0x90/0xf0 [virtio_net] > > > __netdev_update_features+0x271/0x980 > > > ? nlmsg_notify+0x5b/0xa0 > > > dev_disable_lro+0x2b/0x190 > > > ? inet_netconf_notify_devconf+0xe2/0x120 > > > devinet_sysctl_forward+0x176/0x1e0 > > > proc_sys_call_handler+0x1f0/0x250 > > > proc_sys_write+0xf/0x20 > > > __vfs_write+0x3e/0x190 > > > ? __sb_start_write+0x6d/0xd0 > > > vfs_write+0xd3/0x190 > > > ksys_write+0x68/0xd0 > > > __ia32_sys_write+0x14/0x20 > > > do_fast_syscall_32+0x86/0xe0 > > > entry_SYSENTER_compat+0x7c/0x8e > > > > > > A similar crash will likely trigger when enabling XDP. > > > > > > Reported-by: Alistair Delva > > > Reported-by: Willem de Bruijn > > > Fixes: 3f93522ffab2 ("virtio-net: switch off offloads on demand if possible on XDP set") > > > Signed-off-by: Michael S. Tsirkin > > > --- > > > > > > Lightly tested. > > > > > > Alistair, could you please test and confirm that this resolves the > > > crash for you? > > > > This patch doesn't work. The reason is that NETIF_F_LRO is also turned > > on by TSO4/TSO6, which your patch didn't check for. So it ends up > > going through the same path and crashing in the same way. > > > > if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || > > virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6)) > > dev->features |= NETIF_F_LRO; > > > > It sounds like this patch is fixing something slightly differently to > > my patch fixed. virtnet_set_features() doesn't care about > > GUEST_OFFLOADS, it only tests against NETIF_F_LRO. Even if "offloads" > > is zero, it will call virtnet_set_guest_offloads(), which triggers the > > crash. > > > Interesting. It's surprising that it is trying to configure a flag > that is not configurable, i.e., absent from dev->hw_features > after Michael's change. > > > So either we need to ensure NETIF_F_LRO is never set, or > > LRO might be available, just not configurable. Indeed this was what I > observed in the past. dev_disable_lro expects that NETIF_F_LRO is always configurable. Which I guess is a reasonable assumption, just not necessarily the case in virtio_net. So I think we need both patches. Correctly mark the feature as fixed by removing from dev->hw_features and also ignore the request from dev_disable_lro, which does not check for this.