Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp4038839ioo; Wed, 25 May 2022 13:28:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ8/sq1uNt4hQRNx3srHvVnoHPpTTkgJJfECCtwSkzF3ZmXpwJdb4uHqE/kl8My6JLVFeB X-Received: by 2002:a62:ce09:0:b0:518:4932:a71b with SMTP id y9-20020a62ce09000000b005184932a71bmr31923411pfg.16.1653510507213; Wed, 25 May 2022 13:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653510507; cv=none; d=google.com; s=arc-20160816; b=iLwbiY9eelh+w4K67BmpG+zhKmxmSybQEGQXIKT1UeTgpITd/UP0DEeMrPGkftS9En z9qrg+Ht+zAfkCCT5r+RMsdTXb3N+RZFLVNxG0TEqC5QLIH71DL3b8KdpKUxRTVTTJje osO6K5g4KTLBET+n3uPajM3YycpkCChtMAh8wesXadK/8b0w9H1O6na+NAUlGqd/zBE9 wOgGwC1k3+/c7RV2kEoIDlbavEpI77BA4NfYbhHX3VOJSlqVr28yGIg+HOWNQ7bEDozS u2L3DScUOHuYXYHZdB/TvoL6BOl7QsbBh/EPvCrhbagNQKr8CyX5WWii6DHferL6HBH8 l+3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=KtU04oFIh5Z0YSsR5FQRVyG/XaU2MIHApujJFCWuZlw=; b=mkOuMVonGhYAoB3pJggVW3V2h2uyq49W+U4WDG3mIxgHZU7YPMVvJ6tZNldM+vWIwF JLgtgTVu99zqVrb8l1jG9fdFnY2UbEGdmuQ19lrNclpGBfSmTfU0vD3AeiRwKp5592/4 zW+M84Omt2gkg/TLAa2/GFrHv3EDYQflmF0+LXpesUa+bz5FyGjwqDLs7DtBQwbshPuR M7G1KaD+3JlZOp0UUIRzJF3r+UPo3cF3XeuNAjNsnr5ZoxI+vbrQgyd5Kt3YS3zq8NxD R1OlVSQ/OpqXGuzbL+bjzD2jAbE0aggE36xfNwH/RsnWxIf+bZdu6528oQBdBxQbgo9d /cXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=QqGYFn4A; 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 x8-20020a63fe48000000b003f618867515si18866948pgj.675.2022.05.25.13.27.52; Wed, 25 May 2022 13:28:27 -0700 (PDT) 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=@blackwall-org.20210112.gappssmtp.com header.s=20210112 header.b=QqGYFn4A; 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 S229819AbiEYIir (ORCPT + 99 others); Wed, 25 May 2022 04:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234710AbiEYIio (ORCPT ); Wed, 25 May 2022 04:38:44 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD9C21E13 for ; Wed, 25 May 2022 01:38:41 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id o9so4352359wmd.0 for ; Wed, 25 May 2022 01:38:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=blackwall-org.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=KtU04oFIh5Z0YSsR5FQRVyG/XaU2MIHApujJFCWuZlw=; b=QqGYFn4Ab/DfOssUeWALroVEeCh9UhII4ToDkKRqMH2XJaQXYENX3C07V7wDmMpuPs JB3nZ4QAR/l9TljZY57Uuupxe1QmncQMTZ5I50aguJnVGNj9v5id7qb2+BG1fcInEp2L b9z2+5kDCMMMCrsXu7n7v40qvPya+hxNYfNUtz0O9ntgyGKdkE02ugcZO98fspQhi80T u/uE2lleR4T3dIgB7EKLlUELP3N/KLVAA7/6/EEP16i87GjgEC6aZW5yNb/sGrVc69iw gxuZU+B3cTUODouyMdi1eNJJ5xxLm0G9V7ka82qlV5C9zfWaWc31Q5mm4ez/nueuTqH5 AQfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=KtU04oFIh5Z0YSsR5FQRVyG/XaU2MIHApujJFCWuZlw=; b=uJ9WSLm/WxyRlWLkebrjkwOeDt54aS7SHTCN2xkJCUEqlfKFwPG02ZaX2ehx9xoR0D v22IZ0h885eZt8JOZCQaMazhJATPvyr3QRxwwUuK63Pow5gs60/7qCmPnVQdU7MN95N/ mK1UvfRJyNY2NN9GiVrPDZcKWb2CbLK+7Z57Ka1AKzqxJ+1HRoUdSW7BgPYTr5f2c6+i CCFSyNXHWpLq6yKqHU9r8lIRXqyWZdyCLper9TYOATER1sQ0RBxrzL19Xn+GlNWMHo+t YWKbcJO2s19zY+ZNdBibkt4Lta0+BaNtxPHz1Ee0Q1bB8JUKHSejX/U3uJdGipVb4JUZ 46cw== X-Gm-Message-State: AOAM530TA83dCQG1ys+p5ZArjQExLgp6gY1IifmpVQzQ+587VJ7fMRem m2LmVTMcGiEK7Kv/Mt3s1dw1/g== X-Received: by 2002:a7b:cf11:0:b0:397:33e3:87b2 with SMTP id l17-20020a7bcf11000000b0039733e387b2mr7086443wmg.152.1653467920448; Wed, 25 May 2022 01:38:40 -0700 (PDT) Received: from [192.168.0.111] (87-243-81-1.ip.btc-net.bg. [87.243.81.1]) by smtp.gmail.com with ESMTPSA id n11-20020a5d598b000000b0020c61af5e1fsm1620689wri.51.2022.05.25.01.38.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 May 2022 01:38:39 -0700 (PDT) Message-ID: <040a1551-2a9f-18d0-9987-f196bb429c1b@blackwall.org> Date: Wed, 25 May 2022 11:38:37 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH V3 net-next 1/4] net: bridge: add fdb flag to extent locked port feature Content-Language: en-US To: Hans Schultz , davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Eric Dumazet , Paolo Abeni , Jiri Pirko , Ivan Vecera , Roopa Prabhu , Shuah Khan , Daniel Borkmann , Ido Schimmel , linux-kernel@vger.kernel.org, bridge@lists.linux-foundation.org, linux-kselftest@vger.kernel.org References: <20220524152144.40527-1-schultz.hans+netdev@gmail.com> <20220524152144.40527-2-schultz.hans+netdev@gmail.com> <01e6e35c-f5c9-9776-1263-058f84014ed9@blackwall.org> <86zgj6oqa9.fsf@gmail.com> <86fskyggdo.fsf@gmail.com> From: Nikolay Aleksandrov In-Reply-To: <86fskyggdo.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 25/05/2022 11:34, Hans Schultz wrote: > On ons, maj 25, 2022 at 11:06, Nikolay Aleksandrov wrote: >> On 24/05/2022 19:21, Hans Schultz wrote: >>>> >>>> Hi Hans, >>>> So this approach has a fundamental problem, f->dst is changed without any synchronization >>>> you cannot rely on it and thus you cannot account for these entries properly. We must be very >>>> careful if we try to add any new synchronization not to affect performance as well. >>>> More below... >>>> >>>>> @@ -319,6 +326,9 @@ static void fdb_delete(struct net_bridge *br, struct net_bridge_fdb_entry *f, >>>>> if (test_bit(BR_FDB_STATIC, &f->flags)) >>>>> fdb_del_hw_addr(br, f->key.addr.addr); >>>>> >>>>> + if (test_bit(BR_FDB_ENTRY_LOCKED, &f->flags) && !test_bit(BR_FDB_OFFLOADED, &f->flags)) >>>>> + atomic_dec(&f->dst->locked_entry_cnt); >>>> >>>> Sorry but you cannot do this for multiple reasons: >>>> - f->dst can be NULL >>>> - f->dst changes without any synchronization >>>> - there is no synchronization between fdb's flags and its ->dst >>>> >>>> Cheers, >>>> Nik >>> >>> Hi Nik, >>> >>> if a port is decoupled from the bridge, the locked entries would of >>> course be invalid, so maybe if adding and removing a port is accounted >>> for wrt locked entries and the count of locked entries, would that not >>> work? >>> >>> Best, >>> Hans >> >> Hi Hans, >> Unfortunately you need the correct amount of locked entries per-port if you want >> to limit their number per-port, instead of globally. So you need a >> consistent > > Hi Nik, > the used dst is a port structure, so it is per-port and not globally. > > Best, > Hans > Yeah, I know. :) That's why I wrote it, if the limit is not a feature requirement I'd suggest dropping it altogether, it can be enforced externally (e.g. from user-space) if needed. By the way just fyi net-next is closed right now due to merge window. And one more thing please include a short log of changes between versions when you send a new one. I had to go look for v2 to find out what changed. >> fdb view with all its attributes when changing its dst in this case, which would >> require new locking because you have multiple dependent struct fields and it will >> kill roaming/learning scalability. I don't think this use case is worth the complexity it >> will bring, so I'd suggest an alternative - you can monitor the number of locked entries >> per-port from a user-space agent and disable port learning or some similar solution that >> doesn't require any complex kernel changes. Is the limit a requirement to add the feature? >> >> I have an idea how to do it and to minimize the performance hit if it really is needed >> but it'll add a lot of complexity which I'd like to avoid if possible. >> >> Cheers, >> Nik