Message ID | 20221117031551.1142289-1-joel@joelfernandes.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp189491wrr; Wed, 16 Nov 2022 19:18:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf7s00dZdm8Ofi9WqrppQ2LwqCu/pZIvnB0nQRkHtayWtML7snwLyzuI+c3wYTx4UMV7WAhW X-Received: by 2002:a17:902:e84f:b0:186:ff4a:a1f0 with SMTP id t15-20020a170902e84f00b00186ff4aa1f0mr909124plg.57.1668655082999; Wed, 16 Nov 2022 19:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668655082; cv=none; d=google.com; s=arc-20160816; b=reg1lOqPt6Ck6T6eG0k0w57fBkYNPJuMJQLKig36gKtTImA8/fSIiwaOVEOBap4xG1 A5X/dH2GiG6rC+LMMYhl8JktvdreEmjf9zH32lddGLlsv0XEhO8K8bV5h6SWsDi58chx uooMepmgDOacxfsTaFLH5g8PVgmlFq0nkYm2VCF6ZZWZnAauNdUItENN636UYzJg380z vzoo454ACJ8lZw+GO5+VlvGJrnUp1dInKK0lOqepuL1awBWOX+jSXf1gIcETzO9BT2Cx 38qqGNujNaseSQfCz9EPcWJiO59o3476ODgc936v8/O7PKJrgvazv+WXUned75EHUdPA K8XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S1ptF9mncQNJ+YzPoHhaIMd3nHddn4TGB/DoUobLdZU=; b=V2TbiLy5ioa9cnld+daROGysrZqkXzChjOJlc52uHKO84B2Jr0Qhr/EYRndoQHKOkD YElEZScJQaurBc3JMBdeajqvrxtit9WnlSOvyUdn7am6HPMx/iTBMZN9ygBXqHzMNJZC tLnzPZHYPi+LjlqcuZ0T/owTQf5n97TVK8W33MhL3vu9afMIr/ZhByw0A6pdW6XRp3WM eYDCRsUuufpgbLTXjO2SsfEUJp09Zk6q3TVyV1UpFT5DYm9osw+dfEhgcw+qBBvz3GMH PUzesaYBMVFRuhRHBdbhBBSY8pUO1gbBRKu6SwwSVi3UxKMWv2aQJCMtvd7h2+hBPYmH 4ltQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=GcfN8q0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a056a00150c00b0056771c032f4si17438361pfu.28.2022.11.16.19.17.50; Wed, 16 Nov 2022 19:18:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=GcfN8q0c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234510AbiKQDQK (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Wed, 16 Nov 2022 22:16:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233331AbiKQDQG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 16 Nov 2022 22:16:06 -0500 Received: from mail-qt1-x82b.google.com (mail-qt1-x82b.google.com [IPv6:2607:f8b0:4864:20::82b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 906EE63CF5 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 19:16:04 -0800 (PST) Received: by mail-qt1-x82b.google.com with SMTP id fz10so390346qtb.3 for <linux-kernel@vger.kernel.org>; Wed, 16 Nov 2022 19:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=S1ptF9mncQNJ+YzPoHhaIMd3nHddn4TGB/DoUobLdZU=; b=GcfN8q0cdS6ovJPkcYbDaqLvjp2zegbXELs5S4CRJutF7b+qeUEjdTBvXgBMq/OP0O 5F0oDVaz0IMlsc3dJM130Zm51BsN/20FkgL5+YveFNxpF5QeQZUfW2actFnGJSzQOl7k 9FJPLPu3eSIQwGzgteA3hAdyBxrFV0KXV9dzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S1ptF9mncQNJ+YzPoHhaIMd3nHddn4TGB/DoUobLdZU=; b=zmoY84PR+8XKKqB8Ayg0815izaRkOx/0Cg22x7C4iLFE3Dcw8YxK3X25VfyTtGpeTA unV/9JBxovf88W0hKfOjYoRSzmRxmDUOSdyf96hw+iEgh1QGm+fl1znVM35etAQXubZw BzZCqDku+AmbhVcK2eggM383hhhZYTaD98riKDkUnjeqtIe3VRzKynmEZ5j8bNQU4OWh A5H4P/rjJtoTwmSOKec75O/ntVIALggBtXPO4PU2Kf5mmTtYPE+tfJLMqlGktlSFKz7e N+CUHyWmQNMnzkHgMWzrtqW6XAEs2mJyKhqHGJ1myolondEKOhNEGb6riifiy5QL9HYX yrIA== X-Gm-Message-State: ANoB5plNnUEXZDumyw+gxl5na8fVZvUc96Qhzemgio8+MT+6DvkHqAip MHKtQmGyhSSkImbmliHmZ7kijWnAKZoBmA== X-Received: by 2002:a05:622a:401b:b0:3a5:2c7c:c915 with SMTP id cf27-20020a05622a401b00b003a52c7cc915mr722597qtb.499.1668654963515; Wed, 16 Nov 2022 19:16:03 -0800 (PST) Received: from joelboxx.c.googlers.com.com (228.221.150.34.bc.googleusercontent.com. [34.150.221.228]) by smtp.gmail.com with ESMTPSA id k19-20020a05620a415300b006cdd0939ffbsm11398318qko.86.2022.11.16.19.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Nov 2022 19:16:03 -0800 (PST) From: "Joel Fernandes (Google)" <joel@joelfernandes.org> To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>, Cong Wang <xiyou.wangcong@gmail.com>, David Ahern <dsahern@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>, Jakub Kicinski <kuba@kernel.org>, Jamal Hadi Salim <jhs@mojatatu.com>, Jiri Pirko <jiri@resnulli.us>, netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>, rcu@vger.kernel.org, rostedt@goodmis.org, paulmck@kernel.org, fweisbec@gmail.com Subject: [PATCH rcu/dev 1/3] net: Use call_rcu_flush() for qdisc_free_cb Date: Thu, 17 Nov 2022 03:15:48 +0000 Message-Id: <20221117031551.1142289-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749711672287438358?= X-GMAIL-MSGID: =?utf-8?q?1749711672287438358?= |
Series |
[rcu/dev,1/3] net: Use call_rcu_flush() for qdisc_free_cb
|
|
Commit Message
Joel Fernandes
Nov. 17, 2022, 3:15 a.m. UTC
In a networking test on ChromeOS, we find that using the new CONFIG_RCU_LAZY
causes a networking test to fail in the teardown phase.
The failure happens during: ip netns del <name>
Using ftrace, I found the callbacks it was queuing which this series fixes. Use
call_rcu_flush() to revert to the old behavior. With that, the test passes.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
net/sched/sch_generic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Wed, Nov 16, 2022 at 7:16 PM Joel Fernandes (Google) <joel@joelfernandes.org> wrote: > > In a networking test on ChromeOS, we find that using the new CONFIG_RCU_LAZY > causes a networking test to fail in the teardown phase. > > The failure happens during: ip netns del <name> > > Using ftrace, I found the callbacks it was queuing which this series fixes. Use > call_rcu_flush() to revert to the old behavior. With that, the test passes. > > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> > --- > net/sched/sch_generic.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c > index a9aadc4e6858..63fbf640d3b2 100644 > --- a/net/sched/sch_generic.c > +++ b/net/sched/sch_generic.c > @@ -1067,7 +1067,7 @@ static void qdisc_destroy(struct Qdisc *qdisc) > > trace_qdisc_destroy(qdisc); > > - call_rcu(&qdisc->rcu, qdisc_free_cb); > + call_rcu_flush(&qdisc->rcu, qdisc_free_cb); > } I took a look at this one. qdisc_free_cb() is essentially freeing : Some per-cpu memory, and the 'struct Qdisc' I do not see why we need to force a flush for this (small ?) piece of memory.
> On Nov 17, 2022, at 4:44 PM, Eric Dumazet <edumazet@google.com> wrote: > > On Wed, Nov 16, 2022 at 7:16 PM Joel Fernandes (Google) > <joel@joelfernandes.org> wrote: >> >> In a networking test on ChromeOS, we find that using the new CONFIG_RCU_LAZY >> causes a networking test to fail in the teardown phase. >> >> The failure happens during: ip netns del <name> >> >> Using ftrace, I found the callbacks it was queuing which this series fixes. Use >> call_rcu_flush() to revert to the old behavior. With that, the test passes. >> >> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> >> --- >> net/sched/sch_generic.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c >> index a9aadc4e6858..63fbf640d3b2 100644 >> --- a/net/sched/sch_generic.c >> +++ b/net/sched/sch_generic.c >> @@ -1067,7 +1067,7 @@ static void qdisc_destroy(struct Qdisc *qdisc) >> >> trace_qdisc_destroy(qdisc); >> >> - call_rcu(&qdisc->rcu, qdisc_free_cb); >> + call_rcu_flush(&qdisc->rcu, qdisc_free_cb); >> } > > I took a look at this one. > > qdisc_free_cb() is essentially freeing : Some per-cpu memory, and the > 'struct Qdisc' > > I do not see why we need to force a flush for this (small ?) piece of memory. I’ll try to drop that and rerun the test, and get back to you. It could be that there is a different callback that this flush() is compensating for, or something. I am pretty sure at one point, dropping this patch made the test fail most of the time. Now it passes 100%. I’ll also attempt to collect a complete trace, maybe I’ll learn some networking code in the process.. Thanks!
On Thu, Nov 17, 2022 at 01:44:12PM -0800, Eric Dumazet wrote: > On Wed, Nov 16, 2022 at 7:16 PM Joel Fernandes (Google) > <joel@joelfernandes.org> wrote: > > > > In a networking test on ChromeOS, we find that using the new CONFIG_RCU_LAZY > > causes a networking test to fail in the teardown phase. > > > > The failure happens during: ip netns del <name> > > > > Using ftrace, I found the callbacks it was queuing which this series fixes. Use > > call_rcu_flush() to revert to the old behavior. With that, the test passes. > > > > Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> > > --- > > net/sched/sch_generic.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c > > index a9aadc4e6858..63fbf640d3b2 100644 > > --- a/net/sched/sch_generic.c > > +++ b/net/sched/sch_generic.c > > @@ -1067,7 +1067,7 @@ static void qdisc_destroy(struct Qdisc *qdisc) > > > > trace_qdisc_destroy(qdisc); > > > > - call_rcu(&qdisc->rcu, qdisc_free_cb); > > + call_rcu_flush(&qdisc->rcu, qdisc_free_cb); > > } > > I took a look at this one. > > qdisc_free_cb() is essentially freeing : Some per-cpu memory, and the > 'struct Qdisc' > > I do not see why we need to force a flush for this (small ?) piece of memory. Indeed! Just tested and dropping this one still makes the test pass. I believe this patch was papering over the issues fixed by the other patches, so it stuck. I will drop this one and move over to trying your suggestions for 2/3. Thanks for taking a look, - Joel
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index a9aadc4e6858..63fbf640d3b2 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -1067,7 +1067,7 @@ static void qdisc_destroy(struct Qdisc *qdisc) trace_qdisc_destroy(qdisc); - call_rcu(&qdisc->rcu, qdisc_free_cb); + call_rcu_flush(&qdisc->rcu, qdisc_free_cb); } void qdisc_put(struct Qdisc *qdisc)