Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1613639pxb; Thu, 4 Feb 2021 18:37:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj32lmI7G1Oc+U2O3zE82sbOhYB1DtxbRubqQXGJ0WOBQxb7NG9JT0xRvIe18m6JqLXzuY X-Received: by 2002:a17:906:4694:: with SMTP id a20mr1846782ejr.201.1612492657841; Thu, 04 Feb 2021 18:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612492657; cv=none; d=google.com; s=arc-20160816; b=OS052ZG1hiqYI/5Jr/VTLZRl0HF2/UpAcR5HuKXoups8huBecPchaQp37g6NLiBptM QzuJCh2WGOgj8jXISvOMmGGK70U/tfBLJkYRUCnz+5+dSnFUR/tAmgMDr+EQxvVl7WJZ 5FBm8HZG7WlDkcFObG+/4pC208jiURNnVegn3YKEDVzwN38sR1XlwoRQHnP0sLrVH25c s/dvbkCm4pZc0px75tzty1MvMD0xkUjJVddNGfUPhSZLhJOqqOA8wSJJElMw9SBKPACo UxUclFS8wPmnjc8wZ0pDRy4qhuZRACGOeE/p3bpHudMOZ0zOcJX6RMHnbJZS3YX8p0v/ y6PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:cc:from:subject:references:mime-version :message-id:in-reply-to:date:sender:dkim-signature; bh=6d9ABw+2MMja8w+m/Ge5BEthUdZ4QJrI2VfEHE0lgZM=; b=Mtu3C1yUtiumTz7+Iz6Rd7nMDkxOhoXPVSqo5wAUmgg4s9+a9DDzRnvD4hk6JN4/W5 gEsyQDlg7CD0OvvsQlNdqMxxSRQkgGrdlo5mu+GSfAFTOzToKxsAkvoCns+8JwY04Vv7 sIz2zZFeFoVlGBa4+JOefqC7ZfGTpXhSbxUaPBlHRSddyxTSRZpTD+PmSA3satxzF2RU yO/LnePCBF7/uDfyp7YSeQiu6RCBhSUSZ/IHNjF1D5Ip6KWU/qn0Mko57TL7qB5Djv1/ kvEV/Y6zyATLTTVgou2gNgkWJvqiUjnWAAs9Vl/okkfbq3RSmGpAPuY1QuiYR+anQ4nT Jm4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Wc16uuiB; 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 n20si4380148ejj.318.2021.02.04.18.37.13; Thu, 04 Feb 2021 18:37:37 -0800 (PST) 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=Wc16uuiB; 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 S229808AbhBECZC (ORCPT + 99 others); Thu, 4 Feb 2021 21:25:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbhBECY6 (ORCPT ); Thu, 4 Feb 2021 21:24:58 -0500 Received: from mail-qv1-xf49.google.com (mail-qv1-xf49.google.com [IPv6:2607:f8b0:4864:20::f49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47311C061793 for ; Thu, 4 Feb 2021 18:24:18 -0800 (PST) Received: by mail-qv1-xf49.google.com with SMTP id k18so3781327qvj.15 for ; Thu, 04 Feb 2021 18:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:cc; bh=6d9ABw+2MMja8w+m/Ge5BEthUdZ4QJrI2VfEHE0lgZM=; b=Wc16uuiBzr8uRjh+FFc3aIVuYhA4o0xASF2SZxYJnSmlvoMBSrBe3o+TwZR3i71wu/ fqI4C+NddGfKrN79A8uKvB/q6omI/GP9hEtW/sg69RyL3/2WcO4gxwzosiUilwevKO40 W9GedpIGi4x2wd5wgj4dMTWcXsvW6I8ncM32cwEbWi8ZNJnCsROyGUBiIZhNqKZXGMjO /EVsU2QqlGJReEo8F1Rg79kqGShzlt0flDZIvLOZWrIW0e54pnTDADWfK6X72sHXMBFE PzRiVNGkqfISNW+tz/s/6UL65wp2v17Qg95lrHV9rWpeAfNgdamhTwR58a+JTd0plkzx Racg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:cc; bh=6d9ABw+2MMja8w+m/Ge5BEthUdZ4QJrI2VfEHE0lgZM=; b=Y0XPpbDPtafS83Pid6ldimvhzyKLV22Nre0gMKFR3EQJi89+WhvwNORcNPAv/bDBBm LhebheyFVao9OjwDnBs4MsSC3nKWHSS657D38VZfGTWAzZ9ebJpaYWZwdrMIvnS6r21E 7pZIPf5vZ6PQ/rOCHvVQ8gAu8HOGFV7W2+NDwJLZC25Jl3Y7E9GfKaZWnbjQ4pOpMpp3 IJi1Wb3jWVEC+kYc6F4ayjNRej6xghbG0vCSvAgFAxKX+8XZg/4sJX1BxoxW9zIOwlRW 1c17XA0RmvYnSVESJygvqYjU9ZWiXgdWkI7k7p8+vxv5ocqnxDCNxP+5zVJmkBU18Jri 47AQ== X-Gm-Message-State: AOAM531AQPg5SK4R+uF2qd2bCW4xgmTOUm95DIAVefegDu2yrin9Auu0 VKx5yShRVvtQDZBewOfo83otujjgYp5Br0PbYg== Sender: "kaleshsingh via sendgmr" X-Received: from kaleshsingh.c.googlers.com ([fda3:e722:ac3:10:14:4d90:c0a8:2145]) (user=kaleshsingh job=sendgmr) by 2002:ad4:5606:: with SMTP id ca6mr2501087qvb.1.1612491857373; Thu, 04 Feb 2021 18:24:17 -0800 (PST) Date: Fri, 5 Feb 2021 02:23:20 +0000 In-Reply-To: <20210205022328.481524-1-kaleshsingh@google.com> Message-Id: <20210205022328.481524-2-kaleshsingh@google.com> Mime-Version: 1.0 References: <20210205022328.481524-1-kaleshsingh@google.com> X-Mailer: git-send-email 2.30.0.365.g02bc693789-goog Subject: [PATCH v3 2/2] dmabuf: Add dmabuf inode number to /proc/*/fdinfo From: Kalesh Singh Cc: jannh@google.com, jeffv@google.com, keescook@chromium.org, surenb@google.com, minchan@kernel.org, hridya@google.com, kernel-team@android.com, Kalesh Singh , Alexey Dobriyan , Jonathan Corbet , Sumit Semwal , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , Andrew Morton , Mauro Carvalho Chehab , Michal Hocko , Alexey Gladkov , Anand K Mistry , NeilBrown , "Eric W. Biederman" , Michel Lespinasse , Bernd Edlinger , Andrei Vagin , Yafang Shao , Christian Brauner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org Content-Type: text/plain; charset="UTF-8" To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If a FD refers to a DMA buffer add the DMA buffer inode number to /proc//fdinfo/ and /proc//task//fdindo/. The dmabuf inode number allows userspace to uniquely identify the buffer and avoids a dependency on /proc//fd/* when accounting per-process DMA buffer sizes. Signed-off-by: Kalesh Singh --- Changes in v3: - Add documentation in proc.rst Changes in v2: - Update patch description Documentation/filesystems/proc.rst | 17 +++++++++++++++++ drivers/dma-buf/dma-buf.c | 1 + 2 files changed, 18 insertions(+) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems/proc.rst index 2fa69f710e2a..fdd38676f57f 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -2031,6 +2031,23 @@ details]. 'it_value' is remaining time until the timer expiration. with TIMER_ABSTIME option which will be shown in 'settime flags', but 'it_value' still exhibits timer's remaining time. +DMA Buffer files +~~~~~~~~~~~~~~~~ + +:: + + pos: 0 + flags: 04002 + mnt_id: 9 + dmabuf_inode_no: 63107 + size: 32768 + count: 2 + exp_name: system-heap + +where 'dmabuf_inode_no' is the unique inode number of the DMA buffer file. +'size' is the size of the DMA buffer in bytes. 'count' is the file count of +the DMA buffer file. 'exp_name' is the name of the DMA buffer exporter. + 3.9 /proc//map_files - Information about memory mapped files --------------------------------------------------------------------- This directory contains symbolic links which represent memory mapped files diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 9ad6397aaa97..d869099ede83 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -414,6 +414,7 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file) { struct dma_buf *dmabuf = file->private_data; + seq_printf(m, "dmabuf_inode_no:\t%lu\n", file_inode(file)->i_ino); seq_printf(m, "size:\t%zu\n", dmabuf->size); /* Don't count the temporary reference taken inside procfs seq_show */ seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1); -- 2.30.0.478.g8a0d178c01-goog