Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3035356imm; Sun, 29 Jul 2018 08:53:29 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfhXwJf/Y8S82JrSODni1iQiOCgUbbGN/dWfpgwLBdiLRp6rDyS+v5ESZVW9OvAsZAnWs7R X-Received: by 2002:a17:902:14e:: with SMTP id 72-v6mr13145711plb.299.1532879609021; Sun, 29 Jul 2018 08:53:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532879608; cv=none; d=google.com; s=arc-20160816; b=xTr+odcYYmcJMplWwr8mee45CDij7niFrbGouusUR1xERs2OhsMBy3sp3wOtBWS+A1 sLGSF5gRpQRq/9wASvFHI1sso67GXSyrCmNSkekWR4VjQYwUcPJbDGQXX2rPaOQ7l3be dUpNI55gpRjzZ1ph1Ur6aK87ebyLzldtW+mQQynQ+MhZ0OhwemoqJc9PPyWwY60gHSYa XF9AeQVW9xnHZzGpxBkarGJW906E2Ec6Z4OTjFHUzcN/XyFDxuwvaPVWAiibAkOfb2LY l0P5dQ4PVluSqv9qHJ4Tnucwhwk8U8Wp9p5/0ODjlCPNsGVw+JFLwhobGKs2UA/1YwsG 86+w== 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 :mime-version:dkim-signature:arc-authentication-results; bh=39UvLTHY8O5qMau5EMfE3lquIZ1lFjBikAlQG2vgaeY=; b=PXYBJYCOUG+EfJnlJHk2E7WDCYNp8YGh/bBVrFC/M3gIvsfukO22t0ZHtNPO1bHQzl +pLBNHM74ZksFkhPPMgPrRZM2RIz0Jg5b6J4BUpVyaLgrcbyeaYhAjnmXgjIAeE+6rLb rYAO+HtJNGtOj8dvXyE3NUwS2yiirk3qwkasghW3zCjkvpL41Q25dKt/8ytP0WINDhV6 hZA45nQbMDRdyasS50Q7WDhAZgFoswhS7Bso07R1h8N1x5f+jwL9NQTQWcYl9VYqADQh ZBseHBVuanzyLdhGhuGNG6bnIsxVceFpImKESPhg9s0VOut3QjjUTKdLZgR+nlXnhnix 0P1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kx4qeOf7; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7-v6si8181075pll.369.2018.07.29.08.53.01; Sun, 29 Jul 2018 08:53:28 -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=@gmail.com header.s=20161025 header.b=kx4qeOf7; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726493AbeG2RWc (ORCPT + 99 others); Sun, 29 Jul 2018 13:22:32 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33269 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726388AbeG2RWc (ORCPT ); Sun, 29 Jul 2018 13:22:32 -0400 Received: by mail-wm0-f68.google.com with SMTP id r24-v6so6275178wmh.0; Sun, 29 Jul 2018 08:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=39UvLTHY8O5qMau5EMfE3lquIZ1lFjBikAlQG2vgaeY=; b=kx4qeOf7ZDdlwTT1UJrmJ5xc4Y2OX0l6aEH/UW/gx3sl1gfOVa9htuilKSVsrsh+E/ lTExzwbmqtNespAsI8YWY17NZP85xdH1/yJ+tlhapWMwtw5JRLK6uQgM1yZojV0b+YWN 03gbYVYaNwv7QPGxk1RMgBcrhDwOAImNbhRL6FwTmw2aq9l579cBB6trYvBuUlpAkdrg AWswivnvocTgi8iv063O+fy8ukB8yjWzlYZnAToeMn6sqqkldwqvLu6VSOBKiCCtyZ3/ t42Idr6lI+7ES2VT0lVuPEOhRP+ZVRvrlgVcXPjadt1mXam123YHnLTqo21pmI9kVU2f iVBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=39UvLTHY8O5qMau5EMfE3lquIZ1lFjBikAlQG2vgaeY=; b=BTfx8SQpvbeC6HQT1qrD6mk+nRLgPxvJYP9SIRnsGWCnjEiwfxWuQW/RHps27dFwx6 Q9SuT84csTeDHYdxrnuv5z7aZNU3B16dj4JVSSGz5+6CvOsIjHg+pyt7OtkuK5xWTcUi ERpAefurc2Q/JyhgmRQq+23iptK9Ap0Ucq1bGTYDzCqqcsD9RPwSLD1RlYoFWHAGVp4k P/1qRviL209Fw5N8uLUXpbvs9syuDXOYV7QjK6ig0L5ZGQs8RRXLsZOppwstU9ftlxt0 JcNpv8/krCaOrPtRqxh30twK4qLFWAvgILu+D88gWQ+vmAWxxBaHREY0X9KJgVIzc+lW C7Bg== X-Gm-Message-State: AOUpUlH81KX4bh8JZ2+UrS8A3Xc9F6OQGXtYKH2UFjk3+pXs1TbQBL+F tDklLfemCdvZeu21hG7iaaua9qeDrn9T9Ni7vZY= X-Received: by 2002:a1c:8291:: with SMTP id e139-v6mr12756161wmd.39.1532879498603; Sun, 29 Jul 2018 08:51:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:e64f:0:0:0:0:0 with HTTP; Sun, 29 Jul 2018 08:51:18 -0700 (PDT) From: Alexei Starovoitov Date: Sun, 29 Jul 2018 18:51:18 +0300 Message-ID: Subject: Re: [PATCH v2] Add BPF_SYNCHRONIZE_MAPS bpf(2) command To: Daniel Colascione Cc: Joel Fernandes , LKML , Tim Murray , Network Development , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Alexei Starovoitov , Daniel Borkmann Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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). > + * 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. btw i don't have reliable internet access at the moment, so pls excuse the delays.