Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8690920rwp; Wed, 19 Jul 2023 13:52:39 -0700 (PDT) X-Google-Smtp-Source: APBJJlEOAFDY352TcFvc0K76K8Qpd68+0k64YSUK9ado81PWgQrEhNoIk2L6vWKGeyb6fNVQsdzA X-Received: by 2002:a05:6a20:7283:b0:12f:405d:c4d0 with SMTP id o3-20020a056a20728300b0012f405dc4d0mr607441pzk.54.1689799959458; Wed, 19 Jul 2023 13:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689799959; cv=none; d=google.com; s=arc-20160816; b=ehZ4UNV7ivPOR9pywxIktXxnsTzABykc7Lxszm+jbhu4Q95WOBnHk2KyzPt0AlKnfM SuaoXf78EUJFGMritd9cy03B8ffbZqCUunHwpsZONEbEu5lebdm70LvN43MopZ8E92cm 5ToRpQGYyey6TEMUt6jrSIQUWG8QoznBAJG8h9D5AMjU83XXNAGuqhtmFaX83XyfFWeH WB602D3TPtXuz8dg0iBcn9w6oSJZ0V9fibguEuXsD0mekOUAmCPya7f0wCQUGuPntq7D AErvBgBmoB3fsO0W5J43u2rzYtc4y9zP47f1Kdnymn3r/JJqW8s4/ycvvjM+hvV5PBOv IB/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=cbmE+8UYEdH1bZFkDZX5jlVOBBv85gvMUSKHOgiTxfI=; fh=BqPUCr8uVcVktNMcW63VSDjc3HPHB4+Dm3oPaGK0FuI=; b=AVzt3pereKkJhtdoUf1OcxPC+SeuFrUfdjxJQeESmyKk8TzcmK0Fa39zsNKP6LZvkN Z9+UrBTK6p2pVziR4+FasfeGw1X4NFcojNSRfuuhWgCzb2yZhe3tyCG8UQaOVyG8KV/n 3Au1GG031nEqwO7JxwaQgKcmSaBtam0CAojfbQeq8CdSzHzYnCxwqU2Ou1x8qOrlu9gJ eRxz8PLmOyUFOphvxy1d4n1TcUEUJa1xApGao7yc+eqRBVkidcr6EnbjED/ziqAna//x a134hSdm/CKWY0kjHjYr3HCmbwgMFCd9m3VW0/uz9+unmbAeYdK7iDJl6LfmlKWxeo1P 4Yeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BuvyrT06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n7-20020a6543c7000000b0053592069d66si3976105pgp.467.2023.07.19.13.52.27; Wed, 19 Jul 2023 13:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BuvyrT06; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbjGSUhN (ORCPT + 99 others); Wed, 19 Jul 2023 16:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231148AbjGSUhL (ORCPT ); Wed, 19 Jul 2023 16:37:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99554171E; Wed, 19 Jul 2023 13:37:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2E1A261807; Wed, 19 Jul 2023 20:37:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2BE5C433C8; Wed, 19 Jul 2023 20:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689799021; bh=SL7k8eZ8nRbX0vwXOdVgFN2hRtqQGVAaTbvJqY57BEU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BuvyrT061YUMSD8cNtGfuZUYzuxPpFcZw8zFsExRkWlWUhjNMtWkE7mxb2izkRBZ9 O1WBwZ6bb8drf/uwk8Wa0VszOc7EqWwXPbEuhOssWsbLQP48hw/F10jMiOTwcXPOgD EpO9kWXvGYiD9ZFJolRqG+ZSTPWbFE4Ak23jeb1eBfxk7yZCM9F9dl45vayuudNpRz 3lka10SYYniiqESB1Tx8VVwqa/QrJX4KG7lGdFRY2SN14mLkl0k9oEYjJU+zvtG0Cw 2AS37/gepyGO5pHewv4AQ8sUuKpeu8scpNrKlFO90A8Nl2c2rIgIuO1PaB2FBj01XT CMknK6m3ulovw== Date: Wed, 19 Jul 2023 13:36:59 -0700 From: Jakub Kicinski To: Mina Almasry Cc: David Ahern , Jason Gunthorpe , Andy Lutomirski , linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, netdev@vger.kernel.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, Sumit Semwal , Christian =?UTF-8?B?S8O2bmln?= , "David S. Miller" , Eric Dumazet , Paolo Abeni , Jesper Dangaard Brouer , Ilias Apalodimas , Arnd Bergmann , Willem de Bruijn , Shuah Khan Subject: Re: [RFC PATCH 00/10] Device Memory TCP Message-ID: <20230719133659.5529729e@kernel.org> In-Reply-To: References: <20230710223304.1174642-1-almasrymina@google.com> <12393cd2-4b09-4956-fff0-93ef3929ee37@kernel.org> <20230718111508.6f0b9a83@kernel.org> <35f3ec37-11fe-19c8-9d6f-ae5a789843cb@kernel.org> <20230718112940.2c126677@kernel.org> <20230718154503.0421b4cd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 19 Jul 2023 08:10:58 -0700 Mina Almasry wrote: > From Jakub and David's comments it sounds (if I understood correctly), > you'd like to tie the dma-buf bind/unbind functions to the lifetime of > a netlink socket, rather than a struct file like I was thinking. That > does sound cleaner, but I'm not sure how. Can you link me to any > existing code examples? Or rough pointers to any existing code? I don't have a strong preference whether the lifetime is bound to the socket or not. My main point was that if we're binding lifetimes to processes, it should be done via netlink sockets, not special- -purpose FDs. Inevitably more commands and info will be needed and we'll start reinventing the uAPI wheel which is Netlink. Currently adding state to netlink sockets is a bit raw. You can create an Xarray which stores the per socket state using socket's portid (genl_info->snd_portid) and use netlink_register_notifier() to get notifications when sockets are closed.