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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 4C5C3C43331 for ; Sat, 28 Mar 2020 02:56:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D50C206F6 for ; Sat, 28 Mar 2020 02:56:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bHKcHdAF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726956AbgC1C4o (ORCPT ); Fri, 27 Mar 2020 22:56:44 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42955 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbgC1C4o (ORCPT ); Fri, 27 Mar 2020 22:56:44 -0400 Received: by mail-pl1-f193.google.com with SMTP id e1so4199435plt.9; Fri, 27 Mar 2020 19:56:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iUSk+O+3xLOGBYVi56+XGOta7PA5/KelmCfAVNEpcRw=; b=bHKcHdAFecqc01EzHuwPWgnHIOs6tcaOpLdsOqW652MeZv9eL4KR838N1tbDV1DJR6 gWrcMgg589hEP8p+j5XfAG9mk8+iw9L/qVTktVGXM/G3c+i9r6T2QlEax65A2UadMIAV vNa+14Wt99dMHxF3pZWlvRMSfLsYMgo6B667908AkuMX4Xn6n6R9Z/SViGB5K++dOvQL MRH038IrFX+t6WtOeSWzvKsAOZJ74YD0Z2YdcarElvS0wkD+LIhxTEFecaSUYHBgdw6F UHFomT8vEZPLgl1RI7kA/7lIkMw9GIWkmJmVj7VmvGtEYS3NYWV73W1ThRqTndzLdJ6a oWFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iUSk+O+3xLOGBYVi56+XGOta7PA5/KelmCfAVNEpcRw=; b=lo0sRfvBVIVNIWP7alhi7UXkrNv09IrYThbP4X/X4R3f/53L/9YKEYS/PF8hbUyRtl ECuCOyz21cuYF2wASCnnLROAp3dN1UHshMn4kmqcpXIdpLP1uemthHfHJ6zetNcpDM7D m0+yR7uwOdy1qlh0oussYxeKPD7Z/yYUSBxFBF2NGIu6wrZzBia7N6el9QD8fpl0ucOh JHLyFJQzCmBQtrj3qxwPT0TJjP2yFjhxbYXAulqn2O/KycOi88KpOsk3GW3TRmMmMBIT xX+CwUWBH9ew3/WoOjbIz6ruA0MVRmogyh1FkL3VonD2skJDxlVNvyofeqoavYeoVEz3 LT5g== X-Gm-Message-State: ANhLgQ2bQenVLlrw99D1WfcDPtpzp+/E0IngJbtfEhXT1ylSjZ3fXmRr j3QLxTW4Dun2x4s7dC5f1nU= X-Google-Smtp-Source: ADFU+vsg3etIEBb3nOqBZ5a2MI4ugNFHTrXU1YuTFwkZzbKN3x49OOgNgK1KZ168ng+b9AsfbBm8XA== X-Received: by 2002:a17:902:b113:: with SMTP id q19mr1998073plr.202.1585364203070; Fri, 27 Mar 2020 19:56:43 -0700 (PDT) Received: from ast-mbp ([2620:10d:c090:400::5:f1d9]) by smtp.gmail.com with ESMTPSA id x11sm4837121pgq.48.2020.03.27.19.56.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 19:56:42 -0700 (PDT) Date: Fri, 27 Mar 2020 19:56:39 -0700 From: Alexei Starovoitov To: Daniel Borkmann Cc: m@lambda.lt, joe@wand.net.nz, bpf@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH bpf-next 3/7] bpf: add netns cookie and enable it for bpf cgroup hooks Message-ID: <20200328025639.2vbbyh3gksyytyhp@ast-mbp> References: <20200328014844.xz5s67j2cyvnf7lp@ast-mbp> <99b27ef9-d8c5-c00b-2562-1b385ac205d0@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <99b27ef9-d8c5-c00b-2562-1b385ac205d0@iogearbox.net> Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Archived-At: List-Archive: List-Post: On Sat, Mar 28, 2020 at 03:16:06AM +0100, Daniel Borkmann wrote: > On 3/28/20 2:48 AM, Alexei Starovoitov wrote: > > On Fri, Mar 27, 2020 at 04:58:52PM +0100, Daniel Borkmann wrote: > > > + * > > > + * u64 bpf_get_netns_cookie(void *ctx) > > > + * Description > > > + * Retrieve the cookie (generated by the kernel) of the network > > > + * namespace the input *ctx* is associated with. The network > > > + * namespace cookie remains stable for its lifetime and provides > > > + * a global identifier that can be assumed unique. If *ctx* is > > > + * NULL, then the helper returns the cookie for the initial > > > + * network namespace. The cookie itself is very similar to that > > > + * of bpf_get_socket_cookie() helper, but for network namespaces > > > + * instead of sockets. > > > > All new helpers in this patch and few others are missing 'flags' argument. > > Yes. It's kinda hard right now to come up with a use case for the flags, > > since all helpers look kinda trivial, simple, and single purpose. > > But the same thing happened with bpf_send_signal(). It felt that there is no > > way to extend it. Yet later we had to add bpf_send_signal_thread() which could > > have been handled with flags if they were there. So please add flags to all new > > helpers though it might seem redundant. > > We have very similar helpers for almost 2yrs now, that is, bpf_get_socket_cookie() > and bpf_skb_ancestor_cgroup_id(). Both no extra 'unused flags' arg and they are > simple enough to do exactly what we expect them to do, I also haven't seen any > reason to extend them further so far (otherwise we have have new ones by now). The > two added here are very much analogue to this, so breaking this consistency is > super ugly just to add empty flags now. :/ Given the timeframe we have these by now > and given they do one simple thing, what is the harm to add a new helper in future > iff really needed rather than uglifying with flags now (I would understand it for > complex helpers though where we use this practice)? Just recently we added bpf_jiffies64() > (5576b991e9c1 ("bpf: Add BPF_FUNC_jiffies64")); no flag either and it has similar > simplicity. Fair enough, but I reserve the right to say "I told you so" later ;) The series applied. Thanks.