Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2402235pxa; Mon, 3 Aug 2020 15:31:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8micpeBCw/EUQfx/bMUaZpu8buoYEY1zCgCIxHocVfLgXsRF1uWMBNY9e/csOkpss+Gez X-Received: by 2002:a17:906:24d0:: with SMTP id f16mr18236997ejb.325.1596493885788; Mon, 03 Aug 2020 15:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596493885; cv=none; d=google.com; s=arc-20160816; b=D13MJXhGNMwW3wJMiivjaQj7UdlZon44ehuKqFS088jhTSMArsgToxH68iGLEU9Hdh iuk4pVSVaj6FdzjNSqv/Uz5e5OpmYMfcuUpRqmx8W4MlqFDhfepDNjNeHo6PxEFrRcLr 7bXZ4kRmh3n901TTUh0BN1VL3CmMTbhAqvhddyasPyU/PL8gdbnybf4eZVX+HIy3tcS/ M3O6cTJUsgMu/s0WfqcItHcQr6kFTy/O6Jp+ssQN4Kp1kS5cMGtSx1eGjXYYSvtrU+EI t9gbUZOYIsn2ZuwF6aYpee4D5p7dAz90VRLqxP6W2FUgMa4j7KBaJQXdSpn8zGbqNUxP KeTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=qLjrRfa+ZIjUfSvlDNhrcGscmI2cy5a3HB6/Mujgbm4=; b=D9DhXypgmx+PpZqfb0nn+8Mkw1MHNNbeM4K2YjFL2LziMMso+SxyPZKVE1rkjduBAZ El8j1OXebJvRqAM8w1S71jp58yjCb+3z2BJQXO5wUDodXjIbXqmBvFEkYdWMl2l64EvM C+LrcFc9gILCPdQ+Eibrv+EEeK5QijP7PeHR3OCRoqQJBbmR3njoKXaqkPHn5UpUHG2X 3VWyfwHbaZ2e1foyBO/CEyPTCtWLplkwt+RLO6X3RJfFHprGfz+lR73oBNwCygH+K7VL sLrCuG+gCk3UhcviyBkM6UyUe8Pie8WpZRpJ1QIYhjffSU3OFr6HtUDf1BltpN8hRUQU glEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i20si4283150edx.426.2020.08.03.15.31.03; Mon, 03 Aug 2020 15:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727885AbgHCW2p (ORCPT + 99 others); Mon, 3 Aug 2020 18:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgHCW2o (ORCPT ); Mon, 3 Aug 2020 18:28:44 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98278C06174A; Mon, 3 Aug 2020 15:28:44 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1k2iwZ-008hXp-IY; Mon, 03 Aug 2020 22:28:31 +0000 Date: Mon, 3 Aug 2020 23:28:31 +0100 From: Al Viro To: Suren Baghdasaryan Cc: Matthew Wilcox , Kalesh Singh , Jonathan Corbet , Sumit Semwal , Steven Rostedt , Ingo Molnar , linux-doc@vger.kernel.org, LKML , linux-media@vger.kernel.org, DRI mailing list , linaro-mm-sig@lists.linaro.org, linux-fsdevel@vger.kernel.org, Hridya Valsaraju , Ioannis Ilkos , John Stultz , kernel-team Subject: Re: [PATCH 2/2] dmabuf/tracing: Add dma-buf trace events Message-ID: <20200803222831.GI1236603@ZenIV.linux.org.uk> References: <20200803144719.3184138-1-kaleshsingh@google.com> <20200803144719.3184138-3-kaleshsingh@google.com> <20200803154125.GA23808@casper.infradead.org> <20200803161230.GB23808@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 03, 2020 at 09:22:53AM -0700, Suren Baghdasaryan wrote: > On Mon, Aug 3, 2020 at 9:12 AM Matthew Wilcox wrote: > > > > On Mon, Aug 03, 2020 at 09:00:00AM -0700, Suren Baghdasaryan wrote: > > > On Mon, Aug 3, 2020 at 8:41 AM Matthew Wilcox wrote: > > > > > > > > On Mon, Aug 03, 2020 at 02:47:19PM +0000, Kalesh Singh wrote: > > > > > +static void dma_buf_fd_install(int fd, struct file *filp) > > > > > +{ > > > > > + trace_dma_buf_fd_ref_inc(current, filp); > > > > > +} > > > > > > > > You're adding a new file_operation in order to just add a new tracepoint? > > > > NACK. > > > > > > Hi Matthew, > > > The plan is to attach a BPF to this tracepoint in order to track > > > dma-buf users. If you feel this is an overkill, what would you suggest > > > as an alternative? > > > > I'm sure BPF can attach to fd_install and filter on file->f_ops belonging > > to dma_buf, for example. > > Sounds like a workable solution. Will explore that direction. Thanks Matthew! No, it is not a solution at all. What kind of locking would you use? With _any_ of those approaches. How would you use the information that is hopelessly out of date/incoherent/whatnot at the very moment you obtain it? IOW, what the hell is that horror for? You do realize, for example, that there's such thing as dup(), right? And dup2() as well. And while we are at it, how do you keep track of removals, considering the fact that you can stick a file reference into SCM_RIGHTS datagram sent to yourself, close descriptors and an hour later pick that datagram, suddenly getting descriptor back? Besides, "I have no descriptors left" != "I can't be currently sitting in the middle of syscall on that sucker"; close() does *NOT* terminate ongoing operations. You are looking at the drastically wrong abstraction level. Please, describe what it is that you are trying to achieve.