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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C931AC433F5 for ; Mon, 24 Jan 2022 18:25:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245239AbiAXSZ0 (ORCPT ); Mon, 24 Jan 2022 13:25:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245233AbiAXSZT (ORCPT ); Mon, 24 Jan 2022 13:25:19 -0500 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 857EAC061744 for ; Mon, 24 Jan 2022 10:25:19 -0800 (PST) Received: by mail-qk1-x732.google.com with SMTP id h2so21292962qkp.10 for ; Mon, 24 Jan 2022 10:25:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=K6etE/ly2g0VeXSdeIkDpJwMBD9Oa8SeCLG1zWSfgrU=; b=Pcs1V+CdhZCKff3WNADfaPdxie2c9AoWyjHN3xGrBOrslo+5Ry9Su4Wg81Yg58YjO+ e5PtYQEs05Ne337BKKtfad0inw/4ziYXpp3kIwYQVfkfLnKx3wJNjIuaMh/X2QszO+Zl 9kyxYlWKd3aiMhUU7Ow7VTonasdUwHVTJPUcv/aYE1uyGc9M2WJtUVTM5Y2vLsYjTIeJ z0087J0F1jlYYFkzLgeejHJCAqKyDFadvc5knPzsPD7nHcSIQl27ffC4veEliT7/PpD5 JjP/3wJ0hs7WCnfe1pNTb+rX5iQcEstoRA3wi8llqhD4Sp0J/82l7yfrEcGUOn3IaMTv ozQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=K6etE/ly2g0VeXSdeIkDpJwMBD9Oa8SeCLG1zWSfgrU=; b=q9+CUQRchxRE1Zwa5lMklgQ96tIinUt/wRYk0d4opm/BxARL5aR1SFLbLNNhzlOCmh hoZqUkKkpQKh4NAoDuMy+mZ49zEgG4nLigDaUS4Jgg/VBuaxbHaalJgtpNQ9zCRYWqP/ 7JGxUafAFmy5DuXhclv1Roxo07K+XkTUb3HEPEZ9LDuXYdtbH2M2TX1/AEPNdNXW67qH lQQ0g7dgpLoK73h93nlOkG5AdfNh/5c5m48gMwTtnl4lyLzGkr2jamLJgfsIU/lHCopS H3OwUDFvvom/R6mI2ABK9OIRkYFvYoNTdoqddIMNPDmQfv+uFo7zWKmYxBTOtL8rUA/p dfxw== X-Gm-Message-State: AOAM530+hv0TvilkcjM/PRK00LKImHwAvAx7uciYci/ZrKDNXUqVqg0X ynzV8V8i33sO7yV/vqRnCq3stbtuNxce0AT4x0PuvQ== X-Google-Smtp-Source: ABdhPJwVmpBJh+L3pkv2NUpvbujhb1GpxAtUDey9JzaQf/umiNBIUxrPnv3lzPWtoX0EddYiSt5MEAJmYzwoi9JSu7w= X-Received: by 2002:a05:620a:4689:: with SMTP id bq9mr12401158qkb.496.1643048718462; Mon, 24 Jan 2022 10:25:18 -0800 (PST) MIME-Version: 1.0 References: <634c2c87-84c9-0254-3f12-7d993037495c@gmail.com> <92f69969-42dc-204a-4138-16fdaaebb78d@gmail.com> <7ca623df-73ed-9191-bec7-a4728f2f95e6@gmail.com> <20211216181449.p2izqxgzmfpknbsw@kafai-mbp.dhcp.thefacebook.com> <9b8632f9-6d7a-738f-78dc-0287d441d1cc@gmail.com> In-Reply-To: <9b8632f9-6d7a-738f-78dc-0287d441d1cc@gmail.com> From: Stanislav Fomichev Date: Mon, 24 Jan 2022 10:25:07 -0800 Message-ID: Subject: Re: [PATCH v3] cgroup/bpf: fast path skb BPF filtering To: Pavel Begunkov Cc: Martin KaFai Lau , netdev@vger.kernel.org, bpf@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Song Liu , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 7:49 AM Pavel Begunkov wrote: > > On 12/16/21 18:24, Stanislav Fomichev wrote: > > On Thu, Dec 16, 2021 at 10:14 AM Martin KaFai Lau wrote: > >> On Thu, Dec 16, 2021 at 01:21:26PM +0000, Pavel Begunkov wrote: > >>> On 12/15/21 22:07, Stanislav Fomichev wrote: > >>>>> I'm skeptical I'll be able to measure inlining one function, > >>>>> variability between boots/runs is usually greater and would hide it. > >>>> > >>>> Right, that's why I suggested to mirror what we do in set/getsockopt > >>>> instead of the new extra CGROUP_BPF_TYPE_ENABLED. But I'll leave it up > >>>> to you, Martin and the rest. > >> I also suggested to try to stay with one way for fullsock context in v2 > >> but it is for code readability reason. > >> > >> How about calling CGROUP_BPF_TYPE_ENABLED() just next to cgroup_bpf_enabled() > >> in BPF_CGROUP_RUN_PROG_*SOCKOPT_*() instead ? > > > > SG! > > > >> It is because both cgroup_bpf_enabled() and CGROUP_BPF_TYPE_ENABLED() > >> want to check if there is bpf to run before proceeding everything else > >> and then I don't need to jump to the non-inline function itself to see > >> if there is other prog array empty check. > >> > >> Stan, do you have concern on an extra inlined sock_cgroup_ptr() > >> when there is bpf prog to run for set/getsockopt()? I think > >> it should be mostly noise from looking at > >> __cgroup_bpf_run_filter_*sockopt()? > > > > Yeah, my concern is also mostly about readability/consistency. Either > > __cgroup_bpf_prog_array_is_empty everywhere or this new > > CGROUP_BPF_TYPE_ENABLED everywhere. I'm slightly leaning towards > > __cgroup_bpf_prog_array_is_empty because I don't believe direct > > function calls add any visible overhead and macros are ugly :-) But > > either way is fine as long as it looks consistent. > > Martin, Stanislav, do you think it's good to go? Any other concerns? > It feels it might end with bikeshedding and would be great to finally > get it done, especially since I find the issue to be pretty simple. I'll leave it up to the bpf maintainers/reviewers. Personally, I'd still prefer a respin with a consistent __cgroup_bpf_prog_array_is_empty or CGROUP_BPF_TYPE_ENABLED everywhere (shouldn't be a lot of effort?)