From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00E2CC433DB for ; Fri, 5 Feb 2021 16:11:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A115364F47 for ; Fri, 5 Feb 2021 16:11:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232679AbhBEOcL (ORCPT ); Fri, 5 Feb 2021 09:32:11 -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-Google-Smtp-Source: ABdhPJw/KUgUzSu9HyWsw7w094KKGV8UazdOBjJhfXTEooNN4RSJLHuY9UsurqCqtD67VvrC4YI+d1km2qWrSXarE8o= 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); >