Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1018789yba; Thu, 9 May 2019 09:24:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwB7Xe42KiIxjuD/A59wXaxaRXLWC/Aptrvp/n5CFdGqQbS4lodj2+8lEesvwohaOXZsiTK X-Received: by 2002:a63:1604:: with SMTP id w4mr6878546pgl.148.1557419075301; Thu, 09 May 2019 09:24:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557419075; cv=none; d=google.com; s=arc-20160816; b=aJm0A6ARrdVNws3cJb/MD3vDslJx5nLU9Mq+xUXhDrFjU+3WR4cLMIJ+m1rp8vJVev XKsSC0VjJHtLDWVcfcKOJMTJi8g+KQ4GfnZ/6a+Ru7OmbgyaWs6pqnhvLrWQZe1NVOEI 5APQ5pEnrAbZ+2lo6SaIVKmR4La+icTUZeHsEu8iHh+gl3j4VRhJLXLpexwNg2YwxJ9d VtbmpTlmzbpHUuoXkK8LnM+biE4jA6sVWcmh908SM8M/78bH4sby2s/5Eaz1bCca2yvC Id/PqqJUpwORMAymnKwEgEx2o1atBrrHeggfCTqu/4eBoA8r/BOoqwYz0BLAisdmD0cz RIJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=lJCk5fwb0jd/hUn5mTCAh90ugBrW5Ned963N2o98H4M=; b=waOCKpS83VYkn2ElyvJDFE4bvRAD/0PHf5XqgpJFiMYhiOvnlj/0YMkLcSgrbUeeEo 47Gy7uDKPHPTt18Gd0atKXb4TDxgbu5nfU7jHhWwB4tZlx5U1GAp0Xje+ny+19qQrqyp H8tuelxnXzMzDisBCj2BApPmRV8TVr9ORlXyOIcVcS2DelYyaRSOAb/zicwNwGUT2yNG qgWyngSlqhv2MaWNZ9d6SFC3Tr4o9bbX7MTjLX/RkKcWdjS22/GIP6nbv72VkI+cgdHY s4bZ4gJyoj5tJLeSsvnSMfah3yk8Q0K+XsJEA/UEKvMOR2YyTaIFvO+GjbFz29ZKm18O pcow== 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 h19si3669475pgg.125.2019.05.09.09.24.18; Thu, 09 May 2019 09:24:35 -0700 (PDT) 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 S1726802AbfEIQWo (ORCPT + 99 others); Thu, 9 May 2019 12:22:44 -0400 Received: from shards.monkeyblade.net ([23.128.96.9]:36462 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726631AbfEIQWn (ORCPT ); Thu, 9 May 2019 12:22:43 -0400 Received: from localhost (unknown [IPv6:2601:601:9f80:35cd::3d8]) (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 524EB14CF8672; Thu, 9 May 2019 09:22:43 -0700 (PDT) Date: Thu, 09 May 2019 09:22:42 -0700 (PDT) Message-Id: <20190509.092242.151546265607007899.davem@davemloft.net> To: jasowang@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yuehaibing@huawei.com, xiyou.wangcong@gmail.com, weiyongjun1@huawei.com, eric.dumazet@gmail.com Subject: Re: [PATCH net V3 2/2] tuntap: synchronize through tfiles array instead of tun->numqueues From: David Miller In-Reply-To: <1557372018-18544-2-git-send-email-jasowang@redhat.com> References: <1557372018-18544-1-git-send-email-jasowang@redhat.com> <1557372018-18544-2-git-send-email-jasowang@redhat.com> X-Mailer: Mew version 6.8 on Emacs 26.1 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]); Thu, 09 May 2019 09:22:43 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason Wang Date: Wed, 8 May 2019 23:20:18 -0400 > When a queue(tfile) is detached through __tun_detach(), we move the > last enabled tfile to the position where detached one sit but don't > NULL out last position. We expect to synchronize the datapath through > tun->numqueues. Unfortunately, this won't work since we're lacking > sufficient mechanism to order or synchronize the access to > tun->numqueues. > > To fix this, NULL out the last position during detaching and check > RCU protected tfile against NULL instead of checking tun->numqueues in > datapath. > > Cc: YueHaibing > Cc: Cong Wang > Cc: weiyongjun (A) > Cc: Eric Dumazet > Fixes: c8d68e6be1c3b ("tuntap: multiqueue support") > Signed-off-by: Jason Wang > --- > Changes from V2: > - resample during detach in tun_xdp_xmit() > Changes from V1: > - keep the check in tun_xdp_xmit() Applied and queued up for -stable.