Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2413984rdb; Wed, 21 Feb 2024 07:04:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWoJK4f6uEFaN+6pCpbLZqICDza5HH5qsZS5UriHoYfw9xhBxbRq+iyfwxEPuaBE0K6w+wJVOzOUrXkKKY8mKaWB795cwRsCUHSgsJ7WA== X-Google-Smtp-Source: AGHT+IEwcp654G9PPd9QGaO+0+1lQLs6dWY91SkXXu4SOgvR5GHiFZFy5sH7wWIjZbeboKv/loH3 X-Received: by 2002:a17:906:1555:b0:a3f:268:a8f8 with SMTP id c21-20020a170906155500b00a3f0268a8f8mr3442465ejd.71.1708527852349; Wed, 21 Feb 2024 07:04:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708527852; cv=pass; d=google.com; s=arc-20160816; b=Iqgo7gzkMhRocuVDPp9dz51eBwzN9Wp+hETxgkmSOD+5TxTBAlaOvaDGAAQhMVvXle YSRROlcAHun+UIMaU+UKqqa83Wsjc2zd6mCoYQW2eSzNdalp43ewlVfmuouN26z/Hxde A4HOgUS6Dz++RQ6icbcKqUSdTMJpNvgjfl4UyomY3T6qewYJVNpYAV/fOlq7Etw7JGFQ 6cSlVW4axeQxD278WMNno7Ky/LnDMUOzJLlXiFbJicjabC2tZ1aCnqf5I1TlNfcsrh82 fP4c2q9Work560erVerafKp1aOr4yb0QLnUJ7j0BE97SXj+lL+HdXj5zLe1Q1QX+WzBZ FDUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:references:in-reply-to :message-id:cc:to:from:date:dkim-signature; bh=8pSFKbDD0hHRKl9KpChoMfKBPYL3gXyV4FEuLeI7tSI=; fh=SffRrW6v+iFmEgdLU8N53iya2g98bWakSHsvir860rc=; b=EVq5aVL9fmir5V6Kn2xAqtC6nFUyI5tEXW4SZ29811JODgMbfXeu0n0qlZOmooMJ2e ASmixtSPGqqa445iw/Hk7TKYQK++0uneU4JyPSIGbBGsLPTddZIjSWPn193YZRfFj/yA I1v1feChrm+P8P7qnX8IHjaQP0J8jNPf9zoF0Mm0kgzg7vzcA/T40BhX+hdsxqk6tgcb 3qHx16skwaERTZjPcnmVTscdcPE1jf5WGJLNM28MNlKdS9W57/BxbFqApvGrUgCMla7h oyAYa1rgpAbF6l+a68l7byP/uKo23ALK+Sy8gatLy8jpJjPWRhDfUgsk7j4TEZBIldfW esFw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZoA6nDhx; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bw10-20020a170906c1ca00b00a3e37770e69si3795923ejb.926.2024.02.21.07.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 07:04:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ZoA6nDhx; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-74955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 06C2D1F24884 for ; Wed, 21 Feb 2024 15:04:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E3E47FBDD; Wed, 21 Feb 2024 15:04:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZoA6nDhx" Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D27E138398; Wed, 21 Feb 2024 15:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708527842; cv=none; b=kaqNQ58dYjH9L1alGNGFAt396VQz7RozFJMg/b2e1gjKeTR3q/LxP5+UGaMx0VEjUl4AxQJyGM4i0XPYauAHXRkgdUZ8Urvq37BE00kcoi59NFhHo2W38wBpoWc0+4zGm1yovHO7TXjOomIN+1Kr3GalrQV4hE0Y2KTBeZZ8h2M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708527842; c=relaxed/simple; bh=k0YKRdcXLv7T6Y/xtVvaPhBbS5q+kGmG8nilLb4h+RM=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: Mime-Version:Content-Type; b=bClQcKKRH8aog0h/oGsdcD7YSn/ipVWib7Yowg58HyYNGymE9Xuz+HlMpLfHgp7U/fb+JgHu1EtRGBWhRmNOmqT+ad3zc+/FrvnFL51nIVVj7L2OdOTpKG5M8OzL7yQKUIVEoLWzDVyMP8/hIqBxzd7yTgKebk5B3qI4DtYPyM0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZoA6nDhx; arc=none smtp.client-ip=209.85.222.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qk1-f169.google.com with SMTP id af79cd13be357-78725b62cf2so325089185a.1; Wed, 21 Feb 2024 07:04:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708527839; x=1709132639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=8pSFKbDD0hHRKl9KpChoMfKBPYL3gXyV4FEuLeI7tSI=; b=ZoA6nDhxJk2x/4YztFdkWvP9DW1XWqS7yAlH2ffZCbx2lZRvR8O0r9pJqPSmFZfAYf CTCPMk1yOYqfd2qXEpmapnHUYIQAavAiydo/Nz92Z8psuvb/EAXAjf72c76XsfVo4nCi /wXgpnBUivk4vmlorXiCtCnGWejb4pHr4Fv9fvics8RxYb85QYN1z/RU71kTLp6UOdqz C5mlui/IMwNZbD4EYFJAV1UtHQCN/UP7u+wlUoLDhe+I2TnRbZ1U+XpFn388c1ilH+vt EoRwKnsRKVp+qbL9mhz6HmJDcU6bulLGkLYS8ztr+u7k7SiFl5+gkM52eBvWS7UKd7Dz dGvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708527839; x=1709132639; h=content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=8pSFKbDD0hHRKl9KpChoMfKBPYL3gXyV4FEuLeI7tSI=; b=aNLSwGkCyEExsFpwU1bupbCojSrOYhPShxXHefnrSGmBGE9yoXcRvaH6R6Nsh+UM23 oFbl/8kxALJkqbwI22msVVSEhJ/Z9RL+d+swMkbdl1pZnTt0ll8IGsk8qWJRI61+YF/8 KjT5xgFrwDdxtVeBwNi2slgA4jx68PfHZIiezkapDHx2RBKy9sIamLLACfu3qTh3pLCK /12NC9HGKSsbf21sTDj0TTuup/4eHpmxOqTxDb+Zp69gjIKiSbr/r03R+PWMuuhkTNS1 sYXtP/mib98zWdcxL+eosoiLd+qJ1ouh1V2a0dWM1Xd+0Dx+Cw0aZKY7l/iIbq2pSNIL FEkA== X-Forwarded-Encrypted: i=1; AJvYcCWXyZ74xd/jkQ8apP6OwM0x3dYNUN1I4nBQZ7kxQUaU+bINC4hDPqnKbA0ihalXqmpx/TahlNKSz6ghWA5r+r475c0QTZqr3CwidQVp X-Gm-Message-State: AOJu0YwJArH2LhrDG1SS5l6PUjA0hHYQ86nJgwaa0KI9v15txb6F8V+k 06it3YyfAqQv4aXZbTAu819FkRgNRWxQs12EZy7jFfy5jlAl8AvfhHDeNSRv X-Received: by 2002:a05:620a:c16:b0:787:2275:3aa1 with SMTP id l22-20020a05620a0c1600b0078722753aa1mr18098886qki.10.1708527839421; Wed, 21 Feb 2024 07:03:59 -0800 (PST) Received: from localhost (56.148.86.34.bc.googleusercontent.com. [34.86.148.56]) by smtp.gmail.com with ESMTPSA id qs21-20020a05620a395500b00787388490d3sm4369591qkn.89.2024.02.21.07.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 07:03:58 -0800 (PST) Date: Wed, 21 Feb 2024 10:03:58 -0500 From: Willem de Bruijn To: wangyunjian , Willem de Bruijn , "jasowang@redhat.com" , "kuba@kernel.org" , "davem@davemloft.net" , Jesper Dangaard Brouer Cc: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , xudingke Message-ID: <65d610de7cd07_2824ff29494@willemb.c.googlers.com.notmuch> In-Reply-To: <3f175a5ef4e34a0394ae584a0b84523e@huawei.com> References: <1708398727-46308-1-git-send-email-wangyunjian@huawei.com> <65d4cc4b88e56_23483829431@willemb.c.googlers.com.notmuch> <3f175a5ef4e34a0394ae584a0b84523e@huawei.com> Subject: RE: [PATCH net] tun: Fix xdp_rxq_info's queue_index when detaching Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit wangyunjian wrote: > > > > -----Original Message----- > > From: Willem de Bruijn [mailto:willemdebruijn.kernel@gmail.com] > > Sent: Tuesday, February 20, 2024 11:59 PM > > To: wangyunjian ; > > willemdebruijn.kernel@gmail.com; jasowang@redhat.com; kuba@kernel.org; > > davem@davemloft.net > > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; > > brouer@redhat.com; xudingke ; wangyunjian > > > > Subject: Re: [PATCH net] tun: Fix xdp_rxq_info's queue_index when detaching > > > > Yunjian Wang wrote: > > > When a queue(tfile) is detached, we only update tfile's queue_index, > > > but do not update xdp_rxq_info's queue_index. This patch fixes it. > > > > > > Fixes: 8bf5c4ee1889 ("tun: setup xdp_rxq_info") > > > Signed-off-by: Yunjian Wang > > > --- > > > drivers/net/tun.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/net/tun.c b/drivers/net/tun.c index > > > bc80fc1d576e..be37235af55d 100644 > > > --- a/drivers/net/tun.c > > > +++ b/drivers/net/tun.c > > > @@ -652,6 +652,7 @@ static void __tun_detach(struct tun_file *tfile, bool > > clean) > > > tun->tfiles[tun->numqueues - 1]); > > > ntfile = rtnl_dereference(tun->tfiles[index]); > > > ntfile->queue_index = index; > > > + ntfile->xdp_rxq.queue_index = index; > > > rcu_assign_pointer(tun->tfiles[tun->numqueues - 1], > > > NULL); > > > > Does it matter that this value is stale when undetached? > > Yes, the detach tfile'queue_index is not important because the re-attach will update. > But this patch is to fix the 'ntfile'(that replaces the detach tfile)'s queue_index, it is wrong. Oh yes. This looks correct to me. Let's cc: the author of the patch listed as Fixed too. > > Thanks > > > > It is replaced in tun_attach if previously attached: > > > > /* Re-attach detached tfile, updating XDP queue_index */ > > WARN_ON(!xdp_rxq_info_is_reg(&tfile->xdp_rxq)); > > > > if (tfile->xdp_rxq.queue_index != tfile->queue_index) > > tfile->xdp_rxq.queue_index = tfile->queue_index;