Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3595245pxf; Mon, 22 Mar 2021 10:03:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6OhJ+5wO5hvC39O6JVU6M7BeHNupS35aJ+Ju2WJopspBJDzYa3e1U0+b/vqw4KWFMP3+L X-Received: by 2002:a05:6402:3487:: with SMTP id v7mr591484edc.302.1616432625465; Mon, 22 Mar 2021 10:03:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1616432625; cv=pass; d=google.com; s=arc-20160816; b=Mam4XHo+tkkGwpHkpET2FwdE4RtU4cNwXMBqLq3u0PMF2Z+WRpnxiYsCP1mzNSNJ2N YtJaeAZQvWRxnColEl5YlRpVjbkTDRVRpxYcdSNXKRoZlYl/s8GJG5rIueja+Enf3umv g54s99ukkMfrYdQxNWkiKwoBKl8llkZGpnIe9cf2UGYcSutf/Zcfx0k70qLyoqR+MdmN +4NyzJsEPlAdbyJ0Nid1mtj9TI0wanOZQxGonxa5q46vqzf28Ac5H1OPwbXsl8AKvL7k oQPJYDpf/DY6NHYHxUSeP5xjL2HY5m1Ynr2j8joKnIUq2CK2Kzh8HlfdL5pM1YKUdT0q +dJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=6yttl/v7SIrQ50NWcYDrFElj+fIQz43CaeputDRrK8A=; b=Sfr37+S3kTgyOfrEeo+VBTEok8hicWCeVZ/15HWzl9drKf5UZlqeEbNVVd+SLnmnl1 Mtwfn7xoftMONinE89kjSj/cIANzhhVQk1hmpp7ifUvBWYm3TGLEPuCSbHgnJEoVdSoO Ocn/IgziLjjm/B6KOI7Dm6Ju2ocPOO3XiwEqORsCDVATdXVKR6PAn5FSeLmi/bhssppx hmb8sfanh9nZM84+Twmn5bC31LMFuFCXe6qj6XwLs07OpzPqU2RVrOB2dLXixfJIOpNq jbu7BpzgojIKcIM7dA3ARxFxvnbX8V8M9zXeL4MHDOlsYDYzMsK4DBVXibR+GP2fwF8k V2dA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=FeVCq3CY; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si12623723eja.84.2021.03.22.10.03.22; Mon, 22 Mar 2021 10:03:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=FeVCq3CY; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbhCVRAp (ORCPT + 99 others); Mon, 22 Mar 2021 13:00:45 -0400 Received: from mail-mw2nam12on2080.outbound.protection.outlook.com ([40.107.244.80]:60768 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231542AbhCVRAQ (ORCPT ); Mon, 22 Mar 2021 13:00:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=THjwLxLYMP7xq5jeLyMpqls8pFLgsu53qrWyPMWbrPX2YqQnbxLE6uOx6I4gVEzQNBKelUMp6JEnAfz/ToFZxv8DVDHapfyAog+q6PuL+nA7EEG76APFB0Lbnh4wPUhhjjjXIVaRGLVOlbsU/5ZQrU9SYST0fwLh6mUaBBdZgmQV6mCovsJ+oa0Pq0oMd8iSN0dmwEBgewyH4AI+oivR81YUu5xL0fQDUnmWnF9GmE0jXSNH5Fp6eSADYFb8+8si1W0jmIrUu3QpzkOTvqdmPqehT9hPOz7tTFOIFrLVposJrAtjN/CFtOOaanlFMSPEJXpNeQZELWnI3IAUKS6JLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6yttl/v7SIrQ50NWcYDrFElj+fIQz43CaeputDRrK8A=; b=AjnMr8Rufg5N10ydsCFY6/ChNK0stvjMtTjY//42nLzdWQ41Rfb3g/jVGebo1eGD8QlOZEPo0e9+gTQG3Va7tohu8B5Mx4qWynaeXGPv/auJBCCS51SGO/366mq6EzR9yHIzPbESD5PqewTnMXRCovmZI5N3rA/CD+/hySXmKA/x+Ws9EZ0YZEwsuHfz5mrB1v4/Ecs5SSxOsAsZCi004jQyNpLLyxqOU8XnO7it53P/4ueu00IXyzaLapyqVH7QdMS6E81hAjLccZK7MrlvOp16roH1cc88f1MhnYeKB5+s0Eh6i14LRmd+OWINqpgiCOQ1C2YGS1kgBt/Yx+Qi3g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6yttl/v7SIrQ50NWcYDrFElj+fIQz43CaeputDRrK8A=; b=FeVCq3CYZAZccqrd4L6Ehh+Pa/tQ0FsSMO++bIZj4SoWGGu5Ov4hUoBAFZTubn0I6g0QXluBOQjK1xVTbu0adoyCE1evsBVSktG0vWV1EVvjWwaONv5kLlbGiGlx9vEuekt0aCenaM8Mtf/aPvEBoFgY6O3W8lLhbnqQajRN7ic3KOeJ53Qo2UcDHEhrpQ1ypU2l4+yCbp3fEjgiJGpIexIj82PawrvFOyPKD08bu/o5Hib4vbnblOsmFWluzZtYGNn8bP8Z8PlgdUfsLzB6A/qmZPMiIXlQ9YOlnvkq8s3brlaw+z7s8Vlx5rTiL3X210JuqWDh4SkGbbcc7CX8bA== Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nvidia.com; Received: from DM6PR12MB4403.namprd12.prod.outlook.com (2603:10b6:5:2ab::24) by DM6PR12MB3724.namprd12.prod.outlook.com (2603:10b6:5:1c9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18; Mon, 22 Mar 2021 17:00:13 +0000 Received: from DM6PR12MB4403.namprd12.prod.outlook.com ([fe80::5c42:cbe:fe28:3a9b]) by DM6PR12MB4403.namprd12.prod.outlook.com ([fe80::5c42:cbe:fe28:3a9b%5]) with mapi id 15.20.3955.027; Mon, 22 Mar 2021 17:00:13 +0000 Subject: Re: [PATCH v3 net-next 08/12] net: dsa: replay port and host-joined mdb entries when joining the bridge To: Vladimir Oltean Cc: Jakub Kicinski , "David S. Miller" , Andrew Lunn , Vivien Didelot , Florian Fainelli , Tobias Waldekranz , Claudiu Manoil , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roopa Prabhu , Jiri Pirko , Ido Schimmel , Alexandre Belloni , UNGLinuxDriver@microchip.com, Ivan Vecera , linux-omap@vger.kernel.org, Vladimir Oltean References: <20210320223448.2452869-1-olteanv@gmail.com> <20210320223448.2452869-9-olteanv@gmail.com> <7a89fd44-98d7-072f-6215-84960e27b0d9@nvidia.com> <20210322165614.56sgtdxpmnp2dkja@skbuf> From: Nikolay Aleksandrov Message-ID: <8ddd1fbf-69eb-3df3-0dd1-f39207c0369a@nvidia.com> Date: Mon, 22 Mar 2021 19:00:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 In-Reply-To: <20210322165614.56sgtdxpmnp2dkja@skbuf> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [213.179.129.39] X-ClientProxiedBy: ZR0P278CA0077.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::10) To DM6PR12MB4403.namprd12.prod.outlook.com (2603:10b6:5:2ab::24) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.21.240.38] (213.179.129.39) by ZR0P278CA0077.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:22::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Mon, 22 Mar 2021 17:00:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6d06ca8e-954e-4b62-dcb7-08d8ed53f5a0 X-MS-TrafficTypeDiagnostic: DM6PR12MB3724: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hMQANGz3cTjEshqIt2eMLbxfPsoEyxiTIBaHAaD4+PxsmKjW6L1q5WARMnqv1J2f+xfCCN3XowDapeC4kW1oYHHEbV8WoOwz4VYNP8LMM4txCvDVDO+J+1raO5olREyOfRN5nG4dFn/p+ETMrxa2bw/3ru9U7MqxoUyd0fPmmDeVySW+bprCgfy20yWvLzgFQp7vjJk+XxSWIJttEn+4K4wM/ixDwXL/j9AWQAeb2x6VTK3nVRSmJxtJOFOwyB7pq041OI4VsaVtFdcWULKrwhOxyURskGA0S1yizFykBDUoH23hCBHkFcbAUYF/3a1MF41dhn9nqLZTooOBevIDNyWJx/DQU4FymDqiBMeAYeZvB+7izzzrrWzQUhhgDAzFzurbq7ViHj3vYkox5+nuPAqZqgLgU0nPfgNc4BdqHTu2d1QO9eS2ls5axROX2h2dX2ejR7FTM4N3qA9ZsUVVg4x2aoDuguyiAqpg6dcUE7H5oQd09TMEApkK5LzkddY+so6yFboa8hUo0hZAchDTF9/t2GtKlZuuZSBH5kLaD+1YBpX4mmN01XnvSfdNXjosaDDuvmyTG2Fk++k04ScTLtz16GwyCi5vBNkn9K2jEAOrGg4S152G/YPE+ETk7D6cw7qlv0x89aSWPTA1H3s4qDJLL66C3Iy2SX8ahJmIZ4i0hhzy4nVaxglQkHvThBTVU9U3YKN9ZFBpNR1Kj4TUhIyLtj+0Mg9bMjt9tGNgX3THjTFTbLPhZxut9ePYWgy4jqw7GlGNbgoWdBOe1ffh2hRaJOj1n6kooMsOxnXd3Eg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR12MB4403.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(136003)(396003)(366004)(346002)(31686004)(8676002)(5660300002)(6486002)(4326008)(6916009)(8936002)(31696002)(38100700001)(6666004)(7416002)(2616005)(956004)(478600001)(66556008)(66476007)(66946007)(86362001)(966005)(26005)(2906002)(83380400001)(54906003)(316002)(53546011)(16576012)(36756003)(16526019)(186003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?Q0Z6dkRlZTlqVlNpVTVxcFZZeGF2clpOdGlibHYwRVRSZ2IyUmUwbURDdkx5?= =?utf-8?B?QzlCcWhXWHcvVHlpN0x0TUQzTHQyNmQvWk9aODV6TURCUC9WcXdpTk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namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Mar 2021 17:00:13.4313 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XKfloyiqRUsT5CCQmw02IiQUtRfQLFBvRjeOcsk2o4UJNKLPeMLoAncVjqZ0G779UH7l4Q6Qznq4ifwkrwB9Jw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3724 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/03/2021 18:56, Vladimir Oltean wrote: > On Mon, Mar 22, 2021 at 06:35:10PM +0200, Nikolay Aleksandrov wrote: >>> + hlist_for_each_entry(mp, &br->mdb_list, mdb_node) { >> >> You cannot walk over these lists without the multicast lock or RCU. RTNL is not >> enough because of various timers and leave messages that can alter both the mdb_list >> and the port group lists. I'd prefer RCU to avoid blocking the bridge mcast. > > The trouble is that I need to emulate the calling context that is > provided to SWITCHDEV_OBJ_ID_HOST_MDB and SWITCHDEV_OBJ_ID_PORT_MDB, and > that means blocking context. > > So if I hold rcu_read_lock(), I need to queue up the mdb entries, and > notify the driver only after I leave the RCU critical section. The > memory footprint may temporarily blow up. > > In fact this is what I did in v1: > https://patchwork.kernel.org/project/netdevbpf/patch/20210224114350.2791260-15-olteanv@gmail.com/ > > I just figured I could get away with rtnl_mutex protection, but it looks > like I can't. So I guess you prefer my v1? > Indeed, if you need a blocking context then you'd have to go with v1.