Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2411961rwb; Thu, 17 Nov 2022 10:21:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf6GEQA3W4ZDlPUGlLphSu2dobTQ4eDkFp+cxMEA+jXW0L57pEv5fTSOuUIGmM1sCCLzpJoT X-Received: by 2002:a17:906:844:b0:78c:2c03:804c with SMTP id f4-20020a170906084400b0078c2c03804cmr3235048ejd.107.1668709266590; Thu, 17 Nov 2022 10:21:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668709266; cv=none; d=google.com; s=arc-20160816; b=vwPXQh6DXIqKifOnjXm4CJNoQ7v9RHhpuDPLhciyxxCNv2FZT36HpFUTCaIhN+Lig3 dlL6YZLOECIsAVSWFSqBQevjRvHgnCk5tOkZv49ut9EgVf0qrS3hOGWp+uxtRsw17eKM e1GxEriq/NEjTYZp6jyiw10Ef97SmLQuPOMrC5hF+BY3M97zhF06VI33mSmie+5Lq70p GB047QLP923FwCE0P33natNR8vqxbypSOylUst+ZB3cZ6+ATH1fUT1heZH9VnBOgCgM2 W3Ha7lf16FCEq5B0B7NNqLwbHFGZYDqoCpnkdPKKISWcaiWEInCo14MRZrNAPQk2nXIq dwlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W+agF9DCPi0CmTXNslJLojtkhYZZILaz8RI8h0MhFWk=; b=wR5OB0rQ/SdtXk3dV0DOxSUtkXtJeEUStpK3ElYpWewTI+6Jjka4vp9OYA2MMHDly9 0VQHWTkNg9o5aV6z4l4Px1fx8w3g6jjdnWNepFCnctEhrOhjV9rLS3lOwDE6iuwK8QYd YxKvYnq4NhN0kdP0zvQGsBWDnKnHCjLQQVwSUgnrCE2vQdyc45Nkiv3FpbGfMUeLSBKT FFPnpy9jVTQR9UXJ2xj3fjU3HbeJJ624XaX5BGdlnJiGlM/AM/4Ft8U+YlfzhACtT0hT ey44ZWBEZzeROXuCwodskPrU1boJ1mg8lz9AfSsFmfUC65nDfe52X3SLhpUJ8cubz/oj Ds8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=eLuE4ITl; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp8-20020a1709071b0800b007aee2977f40si1143676ejc.484.2022.11.17.10.20.37; Thu, 17 Nov 2022 10:21:06 -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=eLuE4ITl; 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 S240151AbiKQRlF (ORCPT + 92 others); Thu, 17 Nov 2022 12:41:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240267AbiKQRkx (ORCPT ); Thu, 17 Nov 2022 12:40:53 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66E14C27B for ; Thu, 17 Nov 2022 09:40:51 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id e205so2618833oif.11 for ; Thu, 17 Nov 2022 09:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=W+agF9DCPi0CmTXNslJLojtkhYZZILaz8RI8h0MhFWk=; b=eLuE4ITld85hdDpkXNA8s3kN9JtRiylP5lPCD0e5LAQrtsIGZO00npXSNYO4e5UtkL P9qPVl42nTjtMzxCDmZiOue3Ju+5ijhWDSVHkMfb5ggGr69JuVRrpLtqYfEBVAF0PdwJ RrBRySPhMcp1Tb7Cqphd9GsF9w4VlBGd0zbJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W+agF9DCPi0CmTXNslJLojtkhYZZILaz8RI8h0MhFWk=; b=wxHukkj/cA1vwCxME8IiCbZTTLXi5TRXlhoHbLU7+caf6cbUYZ5V0x8iS2fi9qcKdL ziTlCsLxzDJLifg1ehR4W8p9QBU0yfVVuqaZr2zxOIA2aWA8RudhDGgTNr/+kg+awM36 R8FgQM/6LDiFCp3eWcA/Dty8RjwgKrduRl6SGG9X4QUUQ5MOUxFErAUZxR5DubODvatS ZMxc2AOGA36xsJJi2ie0tnWAyu/+GOAmLAlwv0jUX1csxvQsoNh/euyUCkYlJLmjG+ta Fw0D5iCW37hzVjTzfEduKmhK3ks7trauSTdStEi9NfpgKJp9vuZ8f+0q7g57nKH3OABY IFqA== X-Gm-Message-State: ANoB5pnGElQg9oO/tLxEDTMfsMxON7+ZSHfCRy0DQV5WMuE3VCLWhDLX WShRDXgEpJDm7rZ04HjAXkN8dg8ZX/VbNzFAohectQ== X-Received: by 2002:a05:6808:1a09:b0:354:4a36:aa32 with SMTP id bk9-20020a0568081a0900b003544a36aa32mr4522417oib.15.1668706850859; Thu, 17 Nov 2022 09:40:50 -0800 (PST) MIME-Version: 1.0 References: <20221117031551.1142289-1-joel@joelfernandes.org> <20221117031551.1142289-3-joel@joelfernandes.org> In-Reply-To: From: Joel Fernandes Date: Thu, 17 Nov 2022 17:40:40 +0000 Message-ID: Subject: Re: [PATCH rcu/dev 3/3] net: Use call_rcu_flush() for dst_destroy_rcu To: Eric Dumazet Cc: linux-kernel@vger.kernel.org, Cong Wang , David Ahern , "David S. Miller" , Hideaki YOSHIFUJI , Jakub Kicinski , Jamal Hadi Salim , Jiri Pirko , netdev@vger.kernel.org, Paolo Abeni , rcu@vger.kernel.org, rostedt@goodmis.org, paulmck@kernel.org, fweisbec@gmail.com, jiejiang@google.com, Thomas Glexiner Content-Type: text/plain; charset="UTF-8" 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: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 17, 2022 at 5:38 PM Joel Fernandes wrote: > > On Thu, Nov 17, 2022 at 5:17 PM Eric Dumazet wrote: > > > > On Thu, Nov 17, 2022 at 7:58 AM Joel Fernandes wrote: > > > > > > Hello Eric, > > > > > > On Wed, Nov 16, 2022 at 07:44:41PM -0800, Eric Dumazet wrote: > > > > On Wed, Nov 16, 2022 at 7:16 PM Joel Fernandes (Google) > > > > 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 > > > > > > > > And ? What happens then next ? > > > > > > The test is doing the 'ip netns del ' and then polling for the > > > disappearance of a network interface name for upto 5 seconds. I believe it is > > > using netlink to get a table of interfaces. That polling is timing out. > > > > > > Here is some more details from the test's owner (copy pasting from another > > > bug report): > > > In the cleanup, we remove the netns, and thus will cause the veth pair being > > > removed automatically, so we use a poll to check that if the veth in the root > > > netns still exists to know whether the cleanup is done. > > > > > > Here is a public link to the code that is failing (its in golang): > > > https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/tast-tests/src/chromiumos/tast/local/network/virtualnet/env/env.go;drc=6c2841d6cc3eadd23e07912ec331943ee33d7de8;l=161 > > > > > > Here is a public link to the line of code in the actual test leading up to the above > > > path (this is the test that is run: > > > network.RoutingFallthrough.ipv4_only_primary) : > > > https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/tast-tests/src/chromiumos/tast/local/bundles/cros/network/routing_fallthrough.go;drc=8fbf2c53960bc8917a6a01fda5405cad7c17201e;l=52 > > > > > > > > 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. > > > > > > > > What is this test about ? What barrier was used to make it not flaky ? > > > > > > I provided the links above, let me know if you have any questions. > > > > > > > Was it depending on some undocumented RCU behavior ? > > > > > > This is a new RCU feature posted here for significant power-savings on > > > battery-powered devices: > > > https://lore.kernel.org/rcu/20221017140726.GG5600@paulmck-ThinkPad-P17-Gen-1/T/#m7a54809b8903b41538850194d67eb34f203c752a > > > > > > There is also an LPC presentation about the same, I can dig the link if you > > > are interested. > > > > > > > Maybe adding a sysctl to force the flush would be better for functional tests ? > > > > > > > > I would rather change the test(s), than adding call_rcu_flush(), > > > > adding merge conflicts to future backports. > > > > > > I am not too sure about that, I think a user might expect the network > > > interface to disappear from the networking tables quickly enough without > > > dealing with barriers or kernel iternals. However, I added the authors of the > > > test to this email in the hopes he can provide is point of views as well. > > > > > > The general approach we are taking with this sort of thing is to use > > > call_rcu_flush() which is basically the same as call_rcu() for systems with > > > CALL_RCU_LAZY=n. You can see some examples of that in the patch series link > > > above. Just to note, CALL_RCU_LAZY depends on CONFIG_RCU_NOCB_CPU so its only > > > Android and ChromeOS that are using it. I am adding Jie to share any input, > > > he is from the networking team and knows this test well. > > > > > > > > > > I do not know what is this RCU_LAZY thing, but IMO this should be opt-in > > You should read the links I sent you. We did already try opt-in, > Thomas Gleixner made a point at LPC that we should not add new APIs > for this purpose and confuse kernel developers. > > > For instance, only kfree_rcu() should use it. > > No. Most of the call_rcu() usages are for freeing memory, so the > consensus is we should apply this as opt out and fix issues along the > way. We already did a lot of research/diligence on seeing which users > need conversion. > > > We can not review hundreds of call_rcu() call sites and decide if > > adding arbitrary delays cou hurt . > > That work has already been done as much as possible, please read the > links I sent. Also just to add, this test is a bit weird / corner case, as in anyone expecting a quick response from call_rcu() is broken by design. However, for these callbacks, it does not matter much which API they use as they are quite infrequent for power savings. Thanks.