Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4566933imm; Mon, 30 Jul 2018 17:51:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYu/pgHSDdmvtDnLOZ3wJlPnpS7u5JlojHcuOdjVfk0xqU6rKLfkeTKqLEA11v9/vBeuVS X-Received: by 2002:a65:5c03:: with SMTP id u3-v6mr17504411pgr.402.1532998283559; Mon, 30 Jul 2018 17:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532998283; cv=none; d=google.com; s=arc-20160816; b=eqHlmQ/QoEWWpiuItxve+B0VTWoUbsXldR4nYeppi+4ISkHMBRklF9/OKIWJC5vDE3 YLzwSY49m68h+Avk0kwK4eG58QE8BJUCbdBQ8XRfLy0K/BRMwuahcpMdgMhjEFmdALo2 f8QWlN0NDDPJQEW47YTiDFqv8RHknx+Mfio2dK69z7x3hkARGDaPd2sWZo0ai1bFSW+n LGenRwDWB6gYKqXkkVBU48bdHFq1QVDQsG8UC/rwWStOAAomWo4L/2TShlxn2qT3ajiy pxafWamzQgwDXrer4bUZOh7M75T6Ucu6UhBdqoFYSPFVW197wE6jq5KGcTA8BL1xYcRv 9NHg== 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=0CmbeHPYoCcGZWcpL4uM2rf63WD+QD+DjX49fVdIIgc=; b=vUAgSpwqsjwtQfIjOFzXASiAHDHmxl8TKAC1CA9Fuu9SUxkw+/tP/lnxuDrn9+f3fi 7Xtz36YHVEHFkGsSIxA18ydcfUTbm6Cj78yQUUOmo4Ng+OsLA3NCX353W4zLby3NQ0qH 8E6ES4MAzw5mFGWBZ5pD/40Nxad79YiSqrk9kTPpTsm7mCNxQoXM4g+FiWNSdXBFW8aj kiiYN/8uYEazSdaBGRAsh00iQhIjckK8dqQpWFcH4rv8cF4rAc4cM0okTAxOrUamQWc8 zCYmBuJLWZZnUUTqvSf7oBC7ygLiJ0ufmBLF2sf8KKnrFfYK6IRElyuL+jWRXHVX9k8d w0CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TA5Xdqok; 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 t24-v6si10796942plr.240.2018.07.30.17.51.09; Mon, 30 Jul 2018 17:51:23 -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=TA5Xdqok; 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 S1731861AbeGaC1y (ORCPT + 99 others); Mon, 30 Jul 2018 22:27:54 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:50472 "EHLO mail-it0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbeGaC1x (ORCPT ); Mon, 30 Jul 2018 22:27:53 -0400 Received: by mail-it0-f50.google.com with SMTP id g191-v6so1985013ita.0 for ; Mon, 30 Jul 2018 17:50:17 -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=0CmbeHPYoCcGZWcpL4uM2rf63WD+QD+DjX49fVdIIgc=; b=TA5XdqokL5L4hXZMX97GBW+lFWjLg2Vw0VQGvN3WjbT1tff1s7I17xfavM5hbSuFoq NAqDJ5IfMENTsZ+PlYkwM97TigWEkj7C3AZgEKsgl6iDpzQPwwXio9rQJjrveuh1mTd4 a+yUDy9MJBQKulRFot/hlizPJIn7HiOvxZZUg1K/Le45s09xMMXOy2M78w1wGQ5Az0sl p86fIl9ngaT2JyRxnnF2jmeIbdNYBjUwDDbKo+Ba+dBE1POlk1pXyLK8FgwJc3tKCE8d hy2RBWWb+KLqQKajEkFecHBm5tsorS6Ay+PiAVE+vbO6KDgDxVS0HA4J2gBSfVpVq72B uOUA== 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=0CmbeHPYoCcGZWcpL4uM2rf63WD+QD+DjX49fVdIIgc=; b=AoTxIuJ3Ee3zuZO26dY0PoIhHPt+L0zOJ+G0wRcD9OUvjzPTl3XcmtupQw8X7aQGbv ks8n+YgU47Fxot0xBTqTvOWqQ3hUy+/bytbnnWiw43npIs1/E20nJzOI+goWnbtVkpBO AnhhNahZ7zV1JSCzegHEAh6+WzsQdVROv7d9sSxhspj6roUFYSMDx365KAQGDTiFnTSY rTD3Xp/D34k1A5czf1WAPEXdF8R4WX910HYTETLzksOmc99B1XuFdmNxoh9s+o0Ua4tj AOWRinbP3euBOGFPDWw/EGIuL9aze0FzLoYDcZuxxWorp8wRCCAmu3bLbktQ344Sb4QJ oByg== X-Gm-Message-State: AOUpUlFF1tB6PLSgPkE2EgxN2D3ljT2R56/07ailcIqjrbTh+bH/9o2K YVeqmZw256f+4iC6rBEeqEsBy7/ZhX6OOIieAelbpQ== X-Received: by 2002:a24:94f:: with SMTP id 76-v6mr1247645itm.113.1532998216637; Mon, 30 Jul 2018 17:50:16 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4f:ba01:0:0:0:0:0 with HTTP; Mon, 30 Jul 2018 17:50:15 -0700 (PDT) In-Reply-To: <20180730174532.20010e0d@cakuba.netronome.com> References: <20180729205835.34850-1-dancol@google.com> <20180730172641.7d516231@cakuba.netronome.com> <20180730174532.20010e0d@cakuba.netronome.com> From: Daniel Colascione Date: Mon, 30 Jul 2018 17:50:15 -0700 Message-ID: Subject: Re: [PATCH v3] Add BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES bpf(2) command To: Jakub Kicinski Cc: Daniel Borkmann , Joel Fernandes , linux-kernel , Tim Murray , netdev , Alexei Starovoitov , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Alexei Starovoitov 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 Mon, Jul 30, 2018 at 5:45 PM, Jakub Kicinski wrote: > On Mon, 30 Jul 2018 17:33:39 -0700, Daniel Colascione wrote: >> On Mon, Jul 30, 2018 at 5:26 PM, Jakub Kicinski wrote: >> > On Mon, 30 Jul 2018 03:25:43 -0700, Daniel Colascione wrote: >> > > On Mon, Jul 30, 2018 at 3:04 AM, Daniel Borkmann wrote: >> > > > Hmm, I don't think such UAPI as above is future-proof. In case we would want >> > > > a similar mechanism in future for other maps, we would need a whole new bpf >> > > > command or reuse BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES as a workaround though >> > > > the underlying map may not even be a map-to-map. Additionally, we don't have >> > > > any map object at hand in the above, so we couldn't make any finer grained >> > > > decisions either. Something like below would be more suitable and leaves room >> > > > for extending this further in future. >> > > >> > > YAGNI. Your proposed mechanism doesn't add anything under the current >> > > implementation. >> > >> > FWIW in case of HW offload targeting a particular map may allow users >> > to avoid a potentially slow sync with all the devices on the system. >> >> Sure. But such a thing doesn't exist right now (right?), and we can >> add that more-efficient-in-that-one-case BPF interface when it lands. >> I'd rather keep things simple for now. > > You mean map-in-map offload doesn't exist today? True, but it's on the > roadmap for Netronome. Sounds cool. I'd still wait until map-in-map offload lands until adding the map-specific API though. > Tangentially it would be really useful for us to have a "the map has > actually been freed" notification/barrier. We have complaints of users > creating huge maps and then trying to free and recreate them quickly, > and the creation part failing with -ENOMEM, because the free from a > workqueue didn't run, yet :( It'd probably require a different API to > solve than what's discussed here, but since we're talking about syncing > things I thought I'd put it out there... Yeah. What you're talking about is what I meant upthread when I briefly mentioned a "refcount draining approach" --- you'd block until all references except your own to a map disappeared.