Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4584514imm; Mon, 30 Jul 2018 18:16:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeI0zpBsfvWQXbhixHm3Y8BCyH5moGxDEQGwmfPNnYdqUQYuOYsfPlgyMo//ICzhIe8CepO X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr18010397plb.55.1532999802498; Mon, 30 Jul 2018 18:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532999802; cv=none; d=google.com; s=arc-20160816; b=WoamvJM9j+UACkIJzRSvhapsK30nB+RWAiTDRmgU3bJS/vyGyVinz6ICrzXVOLmlto T99bUO/ilFgF5ObWvVUNEa2vJu0elknEoa706iZSAuFjDjdx8KoM3XsbN22KTsW7YqmK Gz+uas6w/PXJbr2+KT7artLbujsCvbZHHuL6FTUkMc/nV72Bq8l10FCbY6Wz9JUwzPdh CHqF7i7AMS6s2ZiDzqA1hhtZFfRCwWlOGL/QEm9PlrhSDbraEV4SfpevZHXpNhvv3IM2 WSY6fMBVPM90WlCAP3QSCEOHK23ZKTycvuJiYirHFxPdkVoxTb0WfYu6DoByyoLfKVEv zkpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=Rdov3LZJn/RsGXQnTVSFmr+gE/xBPk1a7HArormB/i8=; b=m3UFBwVjmKL+OAcHJd8p8z0k3soZ9A3uIR36ZkG+ndBzOZRNFIi0hMVRP90nFFK5Mt LsX1JLis+tcTQKEF+YVBNtMOszq2+yVSTMFBKfT2A/TV8gyc7wJWxxJzINx8yw6Qd/SZ xTkjZlE+WykJZuXRG9EBOhoN27EKdGo7p/se4984zTCMZfiyepSSK/x4grV+GPxHXkCw Xfi/ctj1lgO984tzKrD/ztaxgSoW10en6jdcSE4UAE0abegjTYwLoImHT1L1QL345Jg7 pCeAwb5oUR3AMvnFr+QEWBIDY/WP7uARJhzo50XtzD6H4kVLoxtp4FolSYsL7EjzMP+Q QruQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=d7KaCVw5; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z2-v6si11086935pgp.681.2018.07.30.18.16.28; Mon, 30 Jul 2018 18:16:42 -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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=d7KaCVw5; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731288AbeGaCwh (ORCPT + 99 others); Mon, 30 Jul 2018 22:52:37 -0400 Received: from mail-qk0-f172.google.com ([209.85.220.172]:45669 "EHLO mail-qk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731699AbeGaCwh (ORCPT ); Mon, 30 Jul 2018 22:52:37 -0400 Received: by mail-qk0-f172.google.com with SMTP id c192-v6so9186041qkg.12 for ; Mon, 30 Jul 2018 18:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=Rdov3LZJn/RsGXQnTVSFmr+gE/xBPk1a7HArormB/i8=; b=d7KaCVw5eVw3/8TU5bRukoGVxu9o030hD8zFqiSGSPmXihvShtBR/xTxyXvv8tkc2R 2W+WbNwYolZtcqFw6LemIvKR5j5tU7FopWqRgihy2RLazWatwD8z2Adf54YMxwbinfIR xhGpzUFVSpK8hdBVli7GjJBwEr88GeG2zZwY1aTtlDHow+oVag+K43ppkiHLixm88he9 ICOjFORoXpdcUshB9oF6rDA+BGUVDrlapyfOMU04x2DUgqbv4LB4WbID4Hvr8pGyRw9g Z+tfeuhZF25Svwk/qvCFscK7H9l00VX786TLesnCv9i6HaGQp3z4+OOjurv7S/nDu0MR PaWg== 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:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Rdov3LZJn/RsGXQnTVSFmr+gE/xBPk1a7HArormB/i8=; b=UrjEWgGtSanrRPFcA+rTigQJ7Xi7uz92Hg2VBqFFzM+7QXlTvISEPmYlJZ2F24gnyP regWTk+TLwEelpIuyhAjZiMrxe5l0+ZLUJe6aypR6hvoiYttFebFwtwRqDiad/EMfrYW cr0BrbXu42raizAOdz96L/ePXYerO8+YJrg/4S2l8GAnVFL5f+y5W/XanqhvF3mHgRSe XT/3/5HoIVokxLzGngCUH3wiNUpVJ2AkYazpnox022pcft+JR6qQf75ZVfhCUqDwY/BL 2MNPOQtS/SoGUfn9BRzkuQSloYloD/Qi+rinZ7z36Noq/LGhkp0N4Bt2OP8s1HN6gnl6 bzAQ== X-Gm-Message-State: AOUpUlGLudJ6Ixk7ZNWpzgO1ypwDFJLkzhxSTeo79gMxQYT6Jxt9uUyx w1p+P0xzkYHJh8g5XFkIpLZ4Lw== X-Received: by 2002:a37:209:: with SMTP id 9-v6mr18005223qkc.267.1532999695453; Mon, 30 Jul 2018 18:14:55 -0700 (PDT) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id h51-v6sm10801969qte.17.2018.07.30.18.14.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 18:14:55 -0700 (PDT) Date: Mon, 30 Jul 2018 18:14:50 -0700 From: Jakub Kicinski To: Daniel Colascione Cc: Daniel Borkmann , Joel Fernandes , linux-kernel , Tim Murray , netdev , Alexei Starovoitov , Lorenzo Colitti , Chenbo Feng , Mathieu Desnoyers , Alexei Starovoitov Subject: Re: [PATCH v3] Add BPF_SYNCHRONIZE_MAP_TO_MAP_REFERENCES bpf(2) command Message-ID: <20180730181450.4e0e1df8@cakuba.netronome.com> In-Reply-To: References: <20180729205835.34850-1-dancol@google.com> <20180730172641.7d516231@cakuba.netronome.com> <20180730174532.20010e0d@cakuba.netronome.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Jul 2018 17:50:15 -0700, Daniel Colascione wrote: > > 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. I don't think so. The ref count goes to 0, work gets scheduled to call free, work runs, free gets called, device memory gets freed. Now the memory can be reused. As long as there are any refs we can't free memory, unless we want to make the semantics really ugly. But as I said, only superficially related to this patch. Perhaps solution will naturally fall out of an API to query the device capabilities and resources, if we ever get there.