From patchwork Thu Jun 11 11:28:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyesoo Yu X-Patchwork-Id: 209530 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=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 47C38C433E0 for ; Thu, 11 Jun 2020 11:11:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D7792063A for ; Thu, 11 Jun 2020 11:11:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="i7mTdp8X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727907AbgFKLLN (ORCPT ); Thu, 11 Jun 2020 07:11:13 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:11664 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727884AbgFKLLM (ORCPT ); Thu, 11 Jun 2020 07:11:12 -0400 Received: from epcas2p3.samsung.com (unknown [182.195.41.55]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20200611111107epoutp029fd567f052389792a7828d8290bae9cb~XeNlJuh-00409804098epoutp02E for ; Thu, 11 Jun 2020 11:11:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20200611111107epoutp029fd567f052389792a7828d8290bae9cb~XeNlJuh-00409804098epoutp02E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1591873867; bh=m5J+ghZMJqGOXBmy3eWSpEpm7qa5DnNLLLRwQ72pHow=; h=From:To:Cc:Subject:Date:References:From; b=i7mTdp8Xns87CfUNeM83Z8EvUm5EgoaBTkT9Ud0y0YcrlLFau0FRP6AqqNN9oRdQK OANkSFxh3G5dMYq+2Ct/0cBDM0CvcIIGRpnjIpzTFzEUTuWVzcuC5osX5GySwpyFCW x66UWBzRyrdVym/n46IE/xiHAf3OybfD379c4GGA= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20200611111107epcas2p4bb292c4c64c2ecc2819859a3055a7032~XeNkvu3B11259312593epcas2p4s; Thu, 11 Jun 2020 11:11:07 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.40.188]) by epsnrtp1.localdomain (Postfix) with ESMTP id 49jLkx5FfKzMqYlx; Thu, 11 Jun 2020 11:11:05 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 67.7F.27013.74112EE5; Thu, 11 Jun 2020 20:11:03 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p3.samsung.com (KnoxPortal) with ESMTPA id 20200611111103epcas2p3b454a6086d4eab9c03a6eb58635d2357~XeNgtmFIh0129101291epcas2p3L; Thu, 11 Jun 2020 11:11:03 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200611111103epsmtrp15da611433d670aa1d1c5fcb42fb26550~XeNgs5vPW2149021490epsmtrp1I; Thu, 11 Jun 2020 11:11:03 +0000 (GMT) X-AuditID: b6c32a48-d35ff70000006985-38-5ee21147b134 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 50.B4.08382.74112EE5; Thu, 11 Jun 2020 20:11:03 +0900 (KST) Received: from Dabang.dsn.sec.samsung.com (unknown [12.36.155.59]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200611111102epsmtip10637ec99eba10fe6a80a9890ad26a72b~XeNgiaJRZ1633816338epsmtip1u; Thu, 11 Jun 2020 11:11:02 +0000 (GMT) From: Hyesoo Yu Cc: Hyesoo Yu , Sumit Semwal , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH] dma-buf: support to walk the list of dmabuf for debug Date: Thu, 11 Jun 2020 20:28:41 +0900 Message-Id: <20200611112842.23636-1-hyesoo.yu@samsung.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJKsWRmVeSWpSXmKPExsWy7bCmma674KM4gyXd6hZXvr5ns/jbeYHV 4suVh0wWl3fNYbPo2bCV1eLU3c/sDmwed67tYfO4332cyeP2v8fMHn1bVjF6fN4kF8AalWOT kZqYklqkkJqXnJ+SmZduq+QdHO8cb2pmYKhraGlhrqSQl5ibaqvk4hOg65aZA3SBkkJZYk4p UCggsbhYSd/Opii/tCRVISO/uMRWKbUgJafA0LBArzgxt7g0L10vOT/XytDAwMgUqDIhJ2PD lJ2MBS8EK+bMzWpgfMTXxcjJISFgIjHt5R5mEFtIYAejxMld7l2MXED2J0aJu18WskM43xgl Fn5+wQLTsfh4LzNEYi+jxKlfu6GqvjNKHGn8wAhSxSagLnFiyzIwW0SARWLl9+8sIEXMAucZ Jd5dnQWU4OAQFnCTWNVqBlLDIqAqMXfKSrANvAJWEr8+7WSD2CYvMXH2XUaIuKDEyZlPwGqY geLNW2eDXSEhcIxdov3fNEaIBheJuwfesULYwhKvjm9hh7ClJF72t0HZ5RJnWx6xQjS3MEpc nHYVapuxxKxn7WDHMQto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HJhamjsYt6/6 oHeIkYmD8RCjBAezkgivoPjDOCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8NwoXxgkJpCeWpGan phakFsFkmTg4pRqYPJUuhFp/N7+1bS7P9b6PTquPXIhZYzkl/9xplZuO+frHPsimFf444v9k X8qSFt8f7YyTCjazGV0T5QmNEzU/cvm/sOGXzTt1HHtYHnsVr+Hct0LsSe5ixwvXUmIjfD0W TXV9ckIvVPo/d4i79hqFzVOf1yx4GJHc0yuk+Vd9gU7x+xfrF2j5XSx403Nu8WnBtfqNMjPM Q3Qamf//ezcrwifz++7FKWUBihdFxJZJiTIGZ1m/WNv7eu2FX/E/rnBG2X+OYL3NVeI1eyv3 KxE/mV135aw8Gx9qb/7G8TCk0HCe7XsZp8csiR2RtV1axlJTH19ekvIt2XqZxYmKsBsfOMyS 5D78yJzs0F47jWmhEktxRqKhFnNRcSIA8Kcrt7sCAAA= X-CMS-MailID: 20200611111103epcas2p3b454a6086d4eab9c03a6eb58635d2357 X-Msg-Generator: CA X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200611111103epcas2p3b454a6086d4eab9c03a6eb58635d2357 References: To: unlisted-recipients:; (no To-header on input) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Let's support debugging function to show exporter detail information. The exporter don't need to manage the lists for debugging because all dmabuf list are managed on dmabuf framework. That supports to walk the dmabuf list and show the detailed information for exporter by passed function implemented from exporter. That helps to show exporter detail information. For example, ION may show the buffer flag, heap name, or the name of process to request allocation. Change-Id: I670f04dda4a0870081e1b0fd96b9185b48b9dd15 Signed-off-by: Hyesoo Yu --- drivers/dma-buf/dma-buf.c | 30 ++++++++++++++++++++++++++++++ include/linux/dma-buf.h | 2 ++ 2 files changed, 32 insertions(+) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 01ce125f8e8d..002bd3ac636e 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1254,6 +1254,36 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) } EXPORT_SYMBOL_GPL(dma_buf_vunmap); +int dma_buf_exp_show(struct seq_file *s, + int (*it)(struct seq_file *s, struct dma_buf *dmabuf)) +{ + int ret; + struct dma_buf *buf_obj; + + ret = mutex_lock_interruptible(&db_list.lock); + if (ret) + return ret; + + list_for_each_entry(buf_obj, &db_list.head, list_node) { + ret = mutex_lock_interruptible(&buf_obj->lock); + if (ret) { + seq_puts(s, + "\tERROR locking buffer object: skipping\n"); + continue; + } + + ret = it(s, buf_obj); + mutex_unlock(&buf_obj->lock); + if (ret) + break; + } + mutex_unlock(&db_list.lock); + + return 0; + +} +EXPORT_SYMBOL_GPL(dma_buf_exp_show); + #ifdef CONFIG_DEBUG_FS static int dma_buf_debug_show(struct seq_file *s, void *unused) { diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index ab0c156abee6..b5c0a10b4eb3 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h @@ -502,4 +502,6 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct *, unsigned long); void *dma_buf_vmap(struct dma_buf *); void dma_buf_vunmap(struct dma_buf *, void *vaddr); +int dma_buf_exp_show(struct seq_file *s, + int (*it)(struct seq_file *s, struct dma_buf *dmabuf)); #endif /* __DMA_BUF_H__ */