From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2868C63777 for ; Mon, 30 Nov 2020 20:19:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 83D48207F7 for ; Mon, 30 Nov 2020 20:19:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TZkoDvuz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729676AbgK3USq (ORCPT ); Mon, 30 Nov 2020 15:18:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729128AbgK3USq (ORCPT ); Mon, 30 Nov 2020 15:18:46 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB179C0613CF for ; Mon, 30 Nov 2020 12:18:05 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id l1so17946561wrb.9 for ; Mon, 30 Nov 2020 12:18:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=pPaIndybLktFRyucz7TD3tkaUOea4d6ea7t52sd6HmM=; b=TZkoDvuzXHr/grbRlok0aTZKS+jNQwCO64JlYZl9jBXGPU8k8aBTw0oeraZh9JeK0f oxOIWG+z/GouE4MXp9uJyQcGL3OhFdceW35w4KtKyJ4VqTQGPWW23RgcpKjLAbEOb66w B1kpnUXsrxNS8W2dXWpUA30fJZ8WIH51rOzn+LHS62kSYaMuYTyhzLXvmWQIze5N8KAh FGaSmTjoZUB5gaYYM0U2k4DFWMJpkrRjYuk6Et+J2kjzU6h7ApvE2zIfU6IqyI5fATA8 MzUFffRZeL0iM7pK41V6iPrseD7YsxpGXXusUKHQTWejQKy/yF6Pc0AB6zkX6SHgIR5Y gEEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=pPaIndybLktFRyucz7TD3tkaUOea4d6ea7t52sd6HmM=; b=RPs3MiJyvFd5m6PgG6zeol0lWjCvgI/kr//z7s8xZ5o0P6AaulZXGWHTjP+OuCoJph tuwR+7h4ZO4EFEC+getXz2Ld0QayPA9Znv55Q2Q7BDvQbY9AMcYUanxsbZaBDLvh8fwb T1OWUO6Y44KqoyiLW6CqGSpZJ8DYMf1G8TcJmjTs2nLXm0YagoQ3dVrmYYM8B1gJr/Fv Xvq0snQOLXbtEaRKFSGo5XZdi++E2FFVsytv5R7WweGZtl3n4M0f4J7S7GfLlpJ9n18h NpWxpmPAuTKeuhjH1UA99eyEWNtnevQMkpIrDcST1H1wWgjRifXhdwezp9hsEJ00euYf luPQ== X-Gm-Message-State: AOAM530Cv+0i2O8X2PQsAnM4udvMZ2yLjDMknRXUsdGkS3wznaImznAa lhrh+sQniZDIy/p01Q6DWAk= X-Google-Smtp-Source: ABdhPJxCao2N2/t6kR5rJC6UOwZl6yFUt249LlDieMC7GfVoHl6VwB11I/pfTml9RQFPqtcUY3TjZw== X-Received: by 2002:adf:82cc:: with SMTP id 70mr30168295wrc.74.1606767484466; Mon, 30 Nov 2020 12:18:04 -0800 (PST) Received: from [192.168.8.116] ([37.172.189.71]) by smtp.gmail.com with ESMTPSA id w21sm476658wmi.29.2020.11.30.12.18.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 12:18:03 -0800 (PST) Subject: Re: Correct usage of dev_base_lock in 2020 To: Vladimir Oltean , Eric Dumazet Cc: Eric Dumazet , Jakub Kicinski , Stephen Hemminger , netdev , Paul Gortmaker , Jiri Benc , Or Gerlitz , Cong Wang , Jamal Hadi Salim , Andrew Lunn , Florian Fainelli References: <20201129182435.jgqfjbekqmmtaief@skbuf> <20201129205817.hti2l4hm2fbp2iwy@skbuf> <20201129211230.4d704931@hermes.local> <20201130101405.73901b17@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> <20201130184828.x56bwxxiwydsxt3k@skbuf> <20201130190348.ayg7yn5fieyr4ksy@skbuf> <20201130194617.kzfltaqccbbfq6jr@skbuf> From: Eric Dumazet Message-ID: Date: Mon, 30 Nov 2020 21:18:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201130194617.kzfltaqccbbfq6jr@skbuf> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 11/30/20 8:46 PM, Vladimir Oltean wrote: > On Mon, Nov 30, 2020 at 08:22:01PM +0100, Eric Dumazet wrote: >> And ? >> >> A bonding device can absolutely maintain a private list, ready for >> bonding ndo_get_stats() use, regardless >> of register/unregister logic. >> >> bond_for_each_slave() is simply a macro, you can replace it by something else. > > Also, coming to take the comment at face value. > Can it really? How? Freeing a net_device at unregister time happens > after an RCU grace period. Except that the device would have to be removed from the bonding list before the RCU grace period starts. This removal would acquire the bonding ->stats_mutex in order to change the list. So whatever the bonding driver does to keep a > private list of slave devices, those pointers need to be under RCU > protection. Not at all, if this new list is _only_ used from process context, and protected by a per-device mutex. I am not speaking of existing lists that _possibly_ are used from IRQ context, thus are using RCU. And that doesn't help with the sleepable context that we're > looking for. > Again, RCU would not be used at all, since you want ndo_get_stats64() being called in process context (sleepable context) And this should be solved without expanding RTNL usage. (We do not want to block RTNL for ~10ms just because a device driver has to sleep while a firmware request is processed)