Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2522425pxa; Mon, 3 Aug 2020 19:11:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywo1ari/br+8sbe3sHvx48xoLA6EZpz4HGwa5h6+t6jIHlL0+4oH5QQLJcOlmytlrWvmsg X-Received: by 2002:a17:906:3816:: with SMTP id v22mr1508905ejc.105.1596507118744; Mon, 03 Aug 2020 19:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596507118; cv=none; d=google.com; s=arc-20160816; b=Jj6BkBbS8ewSysRAJrJqtFCNG3Rd12qFm3urSiwvLNLg2VwCS255sGzq1MLtlP7T1c Afl29B128mBUwPQYWy6/2vAzbsUsTRD1AeR5GNIwjQjbLLQHTpatxzzyV4lq4g0XxjmU bEGUQEgGBhR62/ZdyIF/kA5TqaaeIDl7nxsyUK2Qkhv7j0SAMAn6lsg9JwZ+RJbbXK+Z CMvsyKEVeqyEdTo/HocP+qiqW48id0pLOYwZ4wBSEIwUo/FtSM4YWq/KG1/TgLH/Y1WU GxZGOumNj7vFgon3t3eVXKfRiN00zLVF7pKRPwxabsbMRSm83Qr5BkJqi6rueFc2NBLA RkMQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=k9EPoA/TZ6oFdobQPbI92mloUpSocVCmYhmgQ9XTICk=; b=ofOFIPluxxWNx3E1ra8RYsGanpWL4tzTe+Oj1k13Aps4VCWDr8ZKlOj2uChPddLsmY h46hOKTbx7Mi4V63/HeN8rb5/yF4otk/h96/1ejQSq69lObTRxpc+Q81D5pjsa7IDTCw /BskOycih2sGQ1hEQJo9LzsnPDifT81rqFKfbJMs/qzYEgPZH1Oo46uuRnK4V8ieiTnS eMwPb/ETPlqYrIqMdXUo8g1Uyf34WpRiraaVzEQOOjqdhY0JyV2pc9zi+rWBxkZchr/M WYL7q/jhYU1NqeZn0TAN6OBEg1lWnyy+o09342r2LRmtBFGY4SjSefwrmYR9/N9XTbql xK1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QADiLWYD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r5si10587180edx.458.2020.08.03.19.11.36; Mon, 03 Aug 2020 19:11:58 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=QADiLWYD; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727064AbgHDCLM (ORCPT + 99 others); Mon, 3 Aug 2020 22:11:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgHDCLL (ORCPT ); Mon, 3 Aug 2020 22:11:11 -0400 Received: from mail-ua1-x943.google.com (mail-ua1-x943.google.com [IPv6:2607:f8b0:4864:20::943]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AFB3C06179E for ; Mon, 3 Aug 2020 19:11:11 -0700 (PDT) Received: by mail-ua1-x943.google.com with SMTP id u15so1773939uau.10 for ; Mon, 03 Aug 2020 19:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k9EPoA/TZ6oFdobQPbI92mloUpSocVCmYhmgQ9XTICk=; b=QADiLWYDVY5sDxEYuLEuvcCNAPfU3goGeGw7YEgVuEfcRmX+WQZUvyrbIKtcB7k7iQ YxtIg+05jbwODdVdONyVxvmTrVZkmGIM0V8YH0Opo5g6s04ssZ+E7raI4lMc6wipoLsR mtgY7uBETHz6kZN968nSb549MAS66ZiRjzYJIBh4V2KqbBYjvi0sk8NkJGObyROZ26Rz wr0T342klm0lF2dZp+0E7GYYrZV1oLV7ImOHoLhAfA2b6vuOhpxgD4QGTMNTY6xao7VS tnWQeeqa1y9yCWAdCkdmUq6sTQ5PXziy0Z7S8lVg41R2Av1E7muXD5VKHWwh+4EHg+RB Rqbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k9EPoA/TZ6oFdobQPbI92mloUpSocVCmYhmgQ9XTICk=; b=S6RCuonpjSnp3yVwOXdpRqErPCW4SiJyQgjOkYDkgA5Za6Pq8M4Ztkg5hFn4VjWI5u U7SA+8tUV/5ZYQtc2OZxQrzPJX13tuVU1NjgY+u9D52gFMHTzucGwcJGFzMZfewh+qPf ckYpb4u9tlnigZzXh7Me1yGzv8XfurqbG7LuCwYk9YqZV8jP2UsSiegmbNO0ceNcA7kj 3QSLAPDIbwjhcj4glts4BigNcmAHvDRwWAGvmEOFmplX5Mqk8jZ6Lx5QpBDldZ1QXi/T d8RqJckXZ0QHh3k3OJH9NmHOuKVVnJRmuhMAGI0ZYlDT+qg05KXGdBF9rZQ2wTEhNPyr CM5Q== X-Gm-Message-State: AOAM532jmemxCXmcDLqVAyoxdIBhZQSqc+V+QSPf48DUR6aZz6lnnF/y OlOiCS8GgJ5OB1nGidqjfITktgGJ2sT/iCxvHCDHnw== X-Received: by 2002:ab0:5eaa:: with SMTP id y42mr13300969uag.118.1596507070267; Mon, 03 Aug 2020 19:11:10 -0700 (PDT) MIME-Version: 1.0 References: <20200803144719.3184138-1-kaleshsingh@google.com> <20200803144719.3184138-3-kaleshsingh@google.com> <20200803154125.GA23808@casper.infradead.org> <20200803161230.GB23808@casper.infradead.org> <20200803222831.GI1236603@ZenIV.linux.org.uk> <20200804010913.GA2096725@ZenIV.linux.org.uk> In-Reply-To: <20200804010913.GA2096725@ZenIV.linux.org.uk> From: Suren Baghdasaryan Date: Mon, 3 Aug 2020 19:10:59 -0700 Message-ID: Subject: Re: [PATCH 2/2] dmabuf/tracing: Add dma-buf trace events To: Al Viro 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 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, Aug 3, 2020 at 6:09 PM Al Viro wrote: > > On Mon, Aug 03, 2020 at 11:28:31PM +0100, Al Viro wrote: > > > 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. Thanks for your feedback, Al. I see your points and sorry for not realizing these shortcomings. > > > > You are looking at the drastically wrong abstraction level. Please, describe what > > it is that you are trying to achieve. > > _IF_ it's "who keeps a particularly long-lived sucker pinned", I would suggest > fuser(1) run when you detect that kind of long-lived dmabuf. With events generated > by their constructors and destructors, and detection of longevity done based on > that. That is the intention here. IIUC fuser(1) would require root access to collect this information from a process other than the caller. Ideally what we would like to have is a non-root process with specific capabilities (in our case a process that can access BPF maps) to be able to obtain the information on dma-buf users. However, it might make more sense to track dma-buf usage from dma_buf_getfile, dma_buf_get and dma_buf_put since these calls are the ones that affect file refcount. Will dig some more into this. Thanks for your time and sorry for not thinking it through beforehand. > > But that's only a semi-blind guess at the things you are trying to achieve; please, > describe what it really is.