Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3245582imm; Sun, 29 Jul 2018 13:54:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcHI/6+mMhenmDiDS60OaM8gf9Xa+fD5qeGjYlGyI3AvtKXb5g9som9dvb9kIcJoxbu7t5M X-Received: by 2002:a17:902:b902:: with SMTP id bf2-v6mr13631026plb.160.1532897652772; Sun, 29 Jul 2018 13:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532897652; cv=none; d=google.com; s=arc-20160816; b=MHgpshO5WRS+vleNS6ZIrVESkI8ogOJnkS87moK/Uhr5FrsmfIwhS0yZ+OxAgEI3Os p5wLDwqpVwML1/zbajAFMxN7dOBw7d1RSYO4XmZG0C93oz6FabTR/HNnGGPuFNkVMhKN j3I8t4jyE6NoW4LciQ8Yfc6OOwhZK76ccNqkXinWVqJH6FgLzVHyFxj5Q7KNeeTu6CLA b++zcLqk1HlXFOuD9zO+oWKDD14pjOquUPLI72JrleNlsFGq9FuzG0JonW4qtyOsjcdu j+oodzgrF+hAeSd38S/pPV6RTIbG3cHptYrFZTbpIYZLn0o1AVtMH1ppYwahb8Mfylku OPxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=baTSzoPQEFFdDtkK4Dm0tBS4ZcnibF0jxuzygMq4VAU=; b=UPpb2g1wrVNOnKo/gzoN1FGHaUWmQySg1A7y/T0/bINiDwLRr5k2DIJoCU7EF4CA3l txD9gtpdUbhkKBM6SEYC7iYvmt6iVWWsA/18HVbYuro5rf/BuVVmnVwB5ahBay6VLzlP Lay9LX1VNwIEKlI1CYBZnhDrUgOUvSW910tK3BenWb3hig2lkP0yKIJkf56zuQKiRsVw 9ZZIu8ssSAQYKEXUU8IFuDQOAJXBvr4rV9fgMrUZw3cbIN9hEAoSkNHhTuQPVrs97wyi y/aOwN5ZY846idUR4BA+X+KJbuK6eoS1V4ymR5BOMvcX7cOQLaBiJh5QY+hFV/MpF3GB v81w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Q+g66cEz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11-v6si7670045pll.234.2018.07.29.13.53.47; Sun, 29 Jul 2018 13:54:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Q+g66cEz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730217AbeG2WSd (ORCPT + 99 others); Sun, 29 Jul 2018 18:18:33 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:33484 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726835AbeG2WSc (ORCPT ); Sun, 29 Jul 2018 18:18:32 -0400 Received: by mail-it0-f67.google.com with SMTP id d16-v6so7495946itj.0 for ; Sun, 29 Jul 2018 13:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=baTSzoPQEFFdDtkK4Dm0tBS4ZcnibF0jxuzygMq4VAU=; b=Q+g66cEzoyt/3W3WmTtYnZwcZrcPNzPrF7O63GhBrqe/dc2WDI0ISHqLZWDfxaa9gm ZRcZS7g+ixd39SDmD434WUz8ZxEzza4zmEwC0daf2hmlbaceVWQoNzSqpVXyFddDBOum 4SZYEuHkQVo6XOuNoi8CqcQeibKnuq0AcL79iaXHmFcDlmOeLtxsdUmwO8plWtzx0mh/ HkSpLUNXBuVfVzzNfzuMJxzj1Xa4E1a43vgA0ggEe9tOObrNLGuMvR9aZxyHv/EPDyVY VN592t/D1mAb4+QVDcijw2/tkv8zABstA2fpEtoQlmA8yx2nFpu31iwA4Wd3YxO/pAfW mVDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=baTSzoPQEFFdDtkK4Dm0tBS4ZcnibF0jxuzygMq4VAU=; b=UK5UiAarW0BQAP7BEF8+/Tqd07bcJkmXZZcNXEH7KVif1gk1J24M4CKNzm0FgRUMXV zyOJ8hDPy8jfWC/dc6DX7EdorbrWkhcYoqOjEh0WZHl7t2ANG0/9ybqL7hAsx/kiAjAP Ez6zCqbodn4X0BNFjnPQ7W1k+6jBlG8s8lyQNic3DYDvbe84gNVL9vr3I0KVM597tymq pPg5GqWHDMB/bNiD0YY5fc9Fi55/Nm0hY8rUdgkdW1l9Xc7QZZQUXmjvYSA3Z07ezMju GrzFffsLczq2BGY8/rW9PfGTolsgz2f9uUWJsX0NgWBCkm4k4z1mYeXVDSe/z7X8wZG7 fEfg== X-Gm-Message-State: AOUpUlGMA8JMxhDq9Tjlhlz+vDqo7mglDsu8pxHF0zjnGuJxNsBAJ0sB 2jRe4/KyCR3foKt2v3Xl+IXFZCnaTbe6htLPf1L2DuSVNp8= X-Received: by 2002:a02:15c6:: with SMTP id 67-v6mr5286645jaq.129.1532897205126; Sun, 29 Jul 2018 13:46:45 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:ba01:0:0:0:0:0 with HTTP; Sun, 29 Jul 2018 13:46:44 -0700 (PDT) In-Reply-To: References: From: Daniel Colascione Date: Sun, 29 Jul 2018 13:46:44 -0700 Message-ID: Subject: Re: [PATCH v2] Add BPF_SYNCHRONIZE_MAPS bpf(2) command To: Alexei Starovoitov Cc: Joel Fernandes , LKML , Tim Murray , Network Development , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Alexei Starovoitov , Daniel Borkmann Content-Type: multipart/alternative; boundary="00000000000064016905722971f3" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000064016905722971f3 Content-Type: text/plain; charset="UTF-8" On Sun, Jul 29, 2018 at 8:51 AM, Alexei Starovoitov < alexei.starovoitov@gmail.com> wrote: > On Thu, Jul 26, 2018 at 7:51 PM, Daniel Colascione > wrote: > > BPF_SYNCHRONIZE_MAPS waits for the release of any references to a BPF > > map made by a BPF program that is running at the time the > > BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this command is > > to provide a means for userspace to replace a BPF map with another, > > newer version, then ensure that no component is still using the "old" > > map before manipulating the "old" map in some way. > > > > Signed-off-by: Daniel Colascione > > --- > > include/uapi/linux/bpf.h | 9 +++++++++ > > kernel/bpf/syscall.c | 13 +++++++++++++ > > 2 files changed, 22 insertions(+) > > > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > > index b7db3261c62d..5b27e9117d3e 100644 > > --- a/include/uapi/linux/bpf.h > > +++ b/include/uapi/linux/bpf.h > > @@ -75,6 +75,14 @@ struct bpf_lpm_trie_key { > > __u8 data[0]; /* Arbitrary size */ > > }; > > > > +/* BPF_SYNCHRONIZE_MAPS waits for the release of any references to a > > + * BPF map made by a BPF program that is running at the time the > > + * BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this command > > that doesn't sound right to me. > such command won't wait for the release of the references. > in case of map-in-map the program does not hold > the references to inner map (only to outer map). > Well, today that's the guarantee it provides. :-) I figured it'd be simpler to explain the guarantee this way. How about "waits for the release of any reference to a map obtained from another map"? > > > + * is to provide a means for userspace to replace a BPF map with > > + * another, newer version, then ensure that no component is still > > + * using the "old" map before manipulating the "old" map in some way. > > + */ > > that's correct, but the whole paragraph still reads too > 'generic' which will lead to confusion, > whereas the use case is map-in-map only. > I think bpf_sync_inner_map or > bpf_sync_map_in_map would be better > choices for the name. I worry that a name like that would be too specific. --00000000000064016905722971f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On S= un, Jul 29, 2018 at 8:51 AM, Alexei Starovoitov <alexei.starovo= itov@gmail.com> wrote:
On Thu, Jul 26, 2018 at 7:51 PM, Daniel Colascione <dancol@google.com> wrote:
> BPF_SYNCHRONIZE_MAPS waits for the release of any references to a BPF<= br> > map made by a BPF program that is running at the time the
> BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this command is=
> to provide a means for userspace to replace a BPF map with another, > newer version, then ensure that no component is still using the "= old"
> map before manipulating the "old" map in some way.
>
> Signed-off-by: Daniel Colascione <dancol@google.com>
> ---
>=C2=A0 include/uapi/linux/bpf.h |=C2=A0 9 +++++++++
>=C2=A0 kernel/bpf/syscall.c=C2=A0 =C2=A0 =C2=A0| 13 +++++++++++++
>=C2=A0 2 files changed, 22 insertions(+)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index b7db3261c62d..5b27e9117d3e 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -75,6 +75,14 @@ struct bpf_lpm_trie_key {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__u8=C2=A0 =C2=A0 data[0];=C2=A0 =C2= =A0 =C2=A0 =C2=A0 /* Arbitrary size */
>=C2=A0 };
>
> +/* BPF_SYNCHRONIZE_MAPS waits for the release of any references to a<= br> > + * BPF map made by a BPF program that is running at the time the
> + * BPF_SYNCHRONIZE_MAPS command is issued. The purpose of this comman= d

that doesn't sound right to me.
such command won't wait for the release of the references.
in case of map-in-map the program does not hold
the references to inner map (only to outer map).

<= /div>
Well, today that's the guarantee it provides. :-) I figured i= t'd be simpler to explain the guarantee this way.

<= div>How about "waits for the release of any reference to a map obtaine= d from another map"?
=C2=A0

> + * is to provide a means for userspace to replace a BPF map with
> + * another, newer version, then ensure that no component is still
> + * using the "old" map before manipulating the "old&qu= ot; map in some way.
> + */

that's correct, but the whole paragraph still reads too
'generic' which will lead to confusion,
whereas the use case is map-in-map only.
I think bpf_sync_inner_map or
bpf_sync_map_in_map would be better
choices for the name.

I worry that a name l= ike that would be too specific.
--00000000000064016905722971f3--