Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2066753pxb; Fri, 5 Feb 2021 08:14:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJy87oOt4Hmov8T3SNXr0IjMkfMe4EuQVx4PscsDmfpuFOCgW4AEEbo+Qj27kQJaCDhJ+qin X-Received: by 2002:a17:906:1956:: with SMTP id b22mr4913889eje.114.1612541671265; Fri, 05 Feb 2021 08:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612541671; cv=none; d=google.com; s=arc-20160816; b=yhoPLEcV3LjrWT+8VOaunAuRDsFj04oWp9lcSYpfWJcUpAooY70QadeeYeYdQGVtoV tThMvkF2nbNRufNyY1gvPbDwvwl5IEuXvhKgkCwU5XrLKOq6fwMMJw6jWndem8XnyuiP dv4TrQJX8i1MxqhsFi0Jqvir2fZ2++fpAn0mrGaCUhiIBr/PcpayEtz0H5HGdCLtePZn x7eJEQ9h9GEyIpWtXvvh06GM9uUEP3zDqbPRTTdjJy2/ua4d9RbWybOGuLc4oHqYypSJ BGF7V1iLboFWGxr/d+fVdPf4lqERA0Brqe9pf2l/D8l7vEn8O47E2OXqHST2h9hxLZks P+LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uaau4sgQ9hT4TilyNvussNtYWDpCQq4C5pX2PL2MkbA=; b=tG9fdw/Hz0liGMzYO2gKanVRj8qsJcM4P/pKRh5kKXJPgBdoL8nPTxhFGbaf+Q8Srj ajeh4I1oCWURaZmRmqhvKUBuhRejfZasfh53i4moPDgGYkyUujwsAcTpDjPXo5+dK7Jt i4ZBIEYDFHjXgjjltb+H40lfdNirxFEq4FHDb/luKVLRWWBj3iUzwLTQWF9+4iCKPmO1 eXQkTKYCFTaAPNSymEcq6ZCS48+XMOHFZawrv8ekkOLXNjTy+0CRSejw33SqXvm3vHby rvDoUXHQON8HSPeMFG5Iz6WTuoXtGDWHNoJ1frCNybGsmexR895fJc1/wj+Gpx0duHVO Ujfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=RQiutqdV; 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 r20si5106900eji.632.2021.02.05.08.14.03; Fri, 05 Feb 2021 08:14:31 -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=RQiutqdV; 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 S232448AbhBEObP (ORCPT + 99 others); Fri, 5 Feb 2021 09:31:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231810AbhBEOTR (ORCPT ); Fri, 5 Feb 2021 09:19:17 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0DD8C0617AA for ; Fri, 5 Feb 2021 07:46:41 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id s24so7538892iob.6 for ; Fri, 05 Feb 2021 07:46:41 -0800 (PST) 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:content-transfer-encoding; bh=uaau4sgQ9hT4TilyNvussNtYWDpCQq4C5pX2PL2MkbA=; b=RQiutqdV9uKt5WpY7LmQnqOyik8QlV/xIC11t47Cxy6iPhsjdv7Kgt4t0vvK0ioHfm evdTtgL4mXNsmg2lYfDsBg0vDtJuclK/YKze5J5lernt3k/bnB7sosOWua7eWz5n3xFd Y9T09TOUDCpONnIP8oi8aST0SHKdlM7bsgcVwdzBVRwXa4+ypaC8v7qimmBPM/XVG0AH 6eeSMwZmJAYY73o5aDxUKihBsBtIdgCDSRiH35nqLpdz9zwJ34Pztdz4ltqVTgpzQEMI Tqna40GWas6ybMNlVQ9D1coNYLz0CBr+9t8ic2Siyy66vvOie3xSqZPi5Kq7wjUtOV6h tcjQ== 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:content-transfer-encoding; bh=uaau4sgQ9hT4TilyNvussNtYWDpCQq4C5pX2PL2MkbA=; b=hpO0w/K7ij8evQtnLa+gnuv+SCr4r/2NF8uF23duIL5AUmhj21dWluuW6onBJlhN9p tg/QPxSEmzKs3urdSlDFyY7cfarNhbvqLsEsWXphvPTgTxbK3wys+52TgPg3qUEuTk9V HN6h4QRo4Bj2f0OpdxcOeUtaollStXbAHYoH3+QO1PAlKyL3DRXRpIT/PH9DM3dgrtip e8YmW2l7ZQoLk3oX3V+6h7haIsNjk6vlLFvTRzmr6IbuzA++wgmGYqStA/8+ToQ7/7Uc 35uRTOqBC5MAeyVptDJd9tlj6L6AYMQquFdx8VgPOmcshcjT/qQmipt7p30Zne8a7ksc W56g== X-Gm-Message-State: AOAM531/s2qr+63yKw0wUvo/+u46Y+s+BrKPWGYhHfMX2N0Vdrb91qKr W4Ei1DLZI6VSM9qVEV1vkKoPo2n76E8BSuwkPfZIh5sYz7tbKQ== X-Received: by 2002:a63:5309:: with SMTP id h9mr4691610pgb.19.1612538034909; Fri, 05 Feb 2021 07:13:54 -0800 (PST) MIME-Version: 1.0 References: <20210205022328.481524-1-kaleshsingh@google.com> <20210205022328.481524-2-kaleshsingh@google.com> In-Reply-To: From: Kalesh Singh Date: Fri, 5 Feb 2021 10:13:43 -0500 Message-ID: Subject: Re: [PATCH v3 2/2] dmabuf: Add dmabuf inode number to /proc/*/fdinfo To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Jann Horn , Jeffrey Vander Stoep , Kees Cook , Suren Baghdasaryan , Minchan Kim , Hridya Valsaraju , "Cc: Android Kernel" , Alexey Dobriyan , Jonathan Corbet , Sumit Semwal , 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 , LKML , linux-fsdevel , "open list:DOCUMENTATION" , Linux Media Mailing List , DRI mailing list , "moderated list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 5, 2021 at 2:56 AM Christian K=C3=B6nig wrote: > > Am 05.02.21 um 03:23 schrieb Kalesh Singh: > > 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 buffe= r > > and avoids a dependency on /proc//fd/* when accounting per-process > > DMA buffer sizes. > > BTW: Why do we make this DMA-buf specific? Couldn't we always print the > inode number for all fds? Good point. We can make this a common field instead of DMA buf specific. I will update in the next version. Thanks, Kalesh > > Regards, > Christian. > > > > > 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/filesys= tems/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 f= ile. > > +'size' is the size of the DMA buffer in bytes. 'count' is the file cou= nt 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 =3D 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_sh= ow */ > > seq_printf(m, "count:\t%ld\n", file_count(dmabuf->file) - 1); >