From patchwork Wed Nov 3 08:12:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12600321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D9FC433FE for ; Wed, 3 Nov 2021 08:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C39E6113B for ; Wed, 3 Nov 2021 08:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231278AbhKCIPP (ORCPT ); Wed, 3 Nov 2021 04:15:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231259AbhKCIPO (ORCPT ); Wed, 3 Nov 2021 04:15:14 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F326BC061714; Wed, 3 Nov 2021 01:12:36 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id d13so2201836wrf.11; Wed, 03 Nov 2021 01:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6PkQ3oa1hrBIqSDtBCmc6g6vqm5e94FteFPaTzIHs+w=; b=dWxWDB/8hZjRDwFH55CGQDjWRInNWUTrjuXsNpn+6pbhiqoBhwwMigWZl6VsOYVYWZ aCW05F4gQbuuKWGtMtN+ddEvE83NsxQ0JTzBMudf2nbnrVrBND4RMqoYOKD0GdRKor2q pLYo/in+LnzMmMdcMp9/HjhrbZDHRRlPN/GEaunL38Gb4ZsJyZ26I1cxF8MwznPUq5XF hmeann7cnf/nB/mh5i5m28AHGYxB3gis2/vPHUHCgcoH4mcFL5VE9avnIjoccNHJllk6 D/ksxdqAT9lPYr4tUNyAW2U8GSYTHDE4G7WpTM0PjRC7yrTBzWbXhdlo1pN4c8iB1sPt 0KVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6PkQ3oa1hrBIqSDtBCmc6g6vqm5e94FteFPaTzIHs+w=; b=rPxq6dYImZA5EJmF2c77pRGV4m+q4RWzz3EQ23T1/ZTufA2xB4koocyup/BfKHJaQv ysHgYNPtLMjmG3zD9NE/Ug8F3z0LegpzNIDw2UFFWk+PIb9VQIe/oKoSyHC566JrpQtU wHuoiJ91u4Am5vNgnv31qtv9xvs87RWOy8sVep+bIvRm2FY0lA0So4qUd+xq/ZBBUk0M UOx9nxEYYCnKW6BtffIAobXKfCBnKJ4bKE3z5XCykXU0D6T4agq6wID2I6vqFGsMTa9i 51K9ZDhY3K1iAkSU/Mvb7oOlmAovlr3idV5kBX+GwO5hcR2bSPPJgTx83TnFFnpG6vnD KsCg== X-Gm-Message-State: AOAM532HtUpAu/27P+/+jJXoKFLc6eibPDiAGmk/kRbDCdsQfdhh2dq3 Kk+XtzayNwQ13+P1fmW9sx+6yEAJnwU= X-Google-Smtp-Source: ABdhPJygSaNIkxB6dcQmxoYV0rxENHtn4TJzZeO3ZXaNhGUPxjyjmtmjD0mED986omYbswxSqqp4kg== X-Received: by 2002:adf:fe8b:: with SMTP id l11mr51604325wrr.228.1635927155632; Wed, 03 Nov 2021 01:12:35 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l7sm1450088wry.86.2021.11.03.01.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 01:12:35 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org Cc: sumit.semwal@linaro.org, l.stach@pengutronix.de, daniel@ffwll.ch Subject: [PATCH 1/4] dma-buf: add dma_fence_describe and dma_resv_describe v2 Date: Wed, 3 Nov 2021 09:12:28 +0100 Message-Id: <20211103081231.18578-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103081231.18578-1-christian.koenig@amd.com> References: <20211103081231.18578-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add functions to dump dma_fence and dma_resv objects into a seq_file and use them for printing the debugfs information. v2: fix missing include reported by test robot. Signed-off-by: Christian König Reviewed-by: Rob Clark --- drivers/dma-buf/dma-buf.c | 11 +---------- drivers/dma-buf/dma-fence.c | 17 +++++++++++++++++ drivers/dma-buf/dma-resv.c | 23 +++++++++++++++++++++++ include/linux/dma-fence.h | 1 + include/linux/dma-resv.h | 1 + 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 3f63d58bf68a..385cd037325e 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -1321,8 +1321,6 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) { struct dma_buf *buf_obj; struct dma_buf_attachment *attach_obj; - struct dma_resv_iter cursor; - struct dma_fence *fence; int count = 0, attach_count; size_t size = 0; int ret; @@ -1350,14 +1348,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused) file_inode(buf_obj->file)->i_ino, buf_obj->name ?: ""); - dma_resv_for_each_fence(&cursor, buf_obj->resv, true, fence) { - seq_printf(s, "\t%s fence: %s %s %ssignalled\n", - dma_resv_iter_is_exclusive(&cursor) ? - "Exclusive" : "Shared", - fence->ops->get_driver_name(fence), - fence->ops->get_timeline_name(fence), - dma_fence_is_signaled(fence) ? "" : "un"); - } + dma_resv_describe(buf_obj->resv, s); seq_puts(s, "\tAttached Devices:\n"); attach_count = 0; diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 1e82ecd443fa..066400ed8841 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -15,6 +15,7 @@ #include #include #include +#include #define CREATE_TRACE_POINTS #include @@ -907,6 +908,22 @@ dma_fence_wait_any_timeout(struct dma_fence **fences, uint32_t count, } EXPORT_SYMBOL(dma_fence_wait_any_timeout); +/** + * dma_fence_describe - Dump fence describtion into seq_file + * @fence: the 6fence to describe + * @seq: the seq_file to put the textual description into + * + * Dump a textual description of the fence and it's state into the seq_file. + */ +void dma_fence_describe(struct dma_fence *fence, struct seq_file *seq) +{ + seq_printf(seq, "%s %s seq %llu %ssignalled\n", + fence->ops->get_driver_name(fence), + fence->ops->get_timeline_name(fence), fence->seqno, + dma_fence_is_signaled(fence) ? "" : "un"); +} +EXPORT_SYMBOL(dma_fence_describe); + /** * dma_fence_init - Initialize a custom fence. * @fence: the fence to initialize diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c index 9eb2baa387d4..ff3c0558b3b8 100644 --- a/drivers/dma-buf/dma-resv.c +++ b/drivers/dma-buf/dma-resv.c @@ -38,6 +38,7 @@ #include #include #include +#include /** * DOC: Reservation Object Overview @@ -666,6 +667,28 @@ bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all) } EXPORT_SYMBOL_GPL(dma_resv_test_signaled); +/** + * dma_resv_describe - Dump description of the resv object into seq_file + * @obj: the reservation object + * @seq: the seq_file to dump the description into + * + * Dump a textual description of the fences inside an dma_resv object into the + * seq_file. + */ +void dma_resv_describe(struct dma_resv *obj, struct seq_file *seq) +{ + struct dma_resv_iter cursor; + struct dma_fence *fence; + + dma_resv_for_each_fence(&cursor, obj, true, fence) { + seq_printf(seq, "\t%s fence:", + dma_resv_iter_is_exclusive(&cursor) ? + "Exclusive" : "Shared"); + dma_fence_describe(fence, seq); + } +} +EXPORT_SYMBOL_GPL(dma_resv_describe); + #if IS_ENABLED(CONFIG_LOCKDEP) static int __init dma_resv_lockdep(void) { diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index a706b7bf51d7..1ea691753bd3 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -264,6 +264,7 @@ void dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, void dma_fence_release(struct kref *kref); void dma_fence_free(struct dma_fence *fence); +void dma_fence_describe(struct dma_fence *fence, struct seq_file *seq); /** * dma_fence_put - decreases refcount of the fence diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index dbd235ab447f..09c6063b199a 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -490,5 +490,6 @@ int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src); long dma_resv_wait_timeout(struct dma_resv *obj, bool wait_all, bool intr, unsigned long timeout); bool dma_resv_test_signaled(struct dma_resv *obj, bool test_all); +void dma_resv_describe(struct dma_resv *obj, struct seq_file *seq); #endif /* _LINUX_RESERVATION_H */ From patchwork Wed Nov 3 08:12:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12600323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9A89C4321E for ; Wed, 3 Nov 2021 08:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A35AB61175 for ; Wed, 3 Nov 2021 08:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbhKCIPQ (ORCPT ); Wed, 3 Nov 2021 04:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbhKCIPO (ORCPT ); Wed, 3 Nov 2021 04:15:14 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDD5C061203; Wed, 3 Nov 2021 01:12:37 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id b12so2254361wrh.4; Wed, 03 Nov 2021 01:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HJ3FVZIBonOhulw4j97XZ+WDT4N0aGjKYTEFgdMl2bY=; b=JXOifM4MNm9L+pvuMPCtYiZuBmZxpoW+xBg9RV/lvq0vyOIrhLBU90/mOdrfeSUONJ 7oJiN5DqUEPt/WZUSZrMEMk+u6gaZPniYJUK2Jn8Mog/pUaRgkGcVa2d4azMjZu6ge8V 2tRhElbBP5TnzfgEFaFCCbq+ZCv503uEfWo063bHwjqdW1+lIRR8cQ017Xhb5Lxev8vf MzKFGpB7hjfY0/bSldFn6nMBqnpLeZXejg6iMgrLKz9QstuA7ymU8B9MqkqTUA6Mx0J7 RDMtBegu9+f9FTuDvCyXICw1ac39wji75n9NXrc1PWh8c/06rLLwAnVBC6hsK9QkqcDd oAtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HJ3FVZIBonOhulw4j97XZ+WDT4N0aGjKYTEFgdMl2bY=; b=aBAZPpBOfxupJ4dCL2iaAwWz44iKIIoQ9wLRsnDmIND4KyA2qllVXCW5ScLCmboKj0 s8t6a/JAM4RghrsovY74Tqyzze4OCYtQVSjUKcNFvnEeRt1AAJCHiGZHamB5DODWTmNL /16b9JSs6UXITI/l6K6EwvFFCWXpX1IKw2I7CvEJSj96Jl65QBTAYIyhuDo+BBVa1KdO lH87ASNc/uKuXegeQS/AjI0gwvzIWi1qHjBPnDhQs0HNCkSI3/qCWTUu7Le0itLSqVIP 6511wtEoA6Kr5I5dxNHIvZtE7PFYZJ3twee07lLS3JgrNbWO8myfBXltIkwF/SFxFfhG xBiA== X-Gm-Message-State: AOAM533D3rhuPvIebRIB3jF98RI6Z46igLNo6BqS6CU8NMmt0tL7O5nw ap/Pl/YojsbSBW0tgY/wfBE5lHnF+lw= X-Google-Smtp-Source: ABdhPJzp5J2ZSTw5FkIantmdIMrJRVk6kmOjpd1Snb9Ua//19DlbcOGakawpnJrzusJ9UjVTMxcMiA== X-Received: by 2002:a5d:460d:: with SMTP id t13mr50612704wrq.44.1635927156535; Wed, 03 Nov 2021 01:12:36 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l7sm1450088wry.86.2021.11.03.01.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 01:12:36 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org Cc: sumit.semwal@linaro.org, l.stach@pengutronix.de, daniel@ffwll.ch Subject: [PATCH 2/4] drm/msm: use the new dma_resv_describe Date: Wed, 3 Nov 2021 09:12:29 +0100 Message-Id: <20211103081231.18578-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103081231.18578-1-christian.koenig@amd.com> References: <20211103081231.18578-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of hand rolling pretty much the same code. Signed-off-by: Christian König Reviewed-by: Rob Clark --- drivers/gpu/drm/msm/msm_gem.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 5bd511f07c07..3878b8dc2d59 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -865,23 +865,11 @@ int msm_gem_cpu_fini(struct drm_gem_object *obj) } #ifdef CONFIG_DEBUG_FS -static void describe_fence(struct dma_fence *fence, const char *type, - struct seq_file *m) -{ - if (!dma_fence_is_signaled(fence)) - seq_printf(m, "\t%9s: %s %s seq %llu\n", type, - fence->ops->get_driver_name(fence), - fence->ops->get_timeline_name(fence), - fence->seqno); -} - void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, struct msm_gem_stats *stats) { struct msm_gem_object *msm_obj = to_msm_bo(obj); struct dma_resv *robj = obj->resv; - struct dma_resv_iter cursor; - struct dma_fence *fence; struct msm_gem_vma *vma; uint64_t off = drm_vma_node_start(&obj->vma_node); const char *madv; @@ -955,13 +943,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m, seq_puts(m, "\n"); } - dma_resv_for_each_fence(&cursor, robj, true, fence) { - if (dma_resv_iter_is_exclusive(&cursor)) - describe_fence(fence, "Exclusive", m); - else - describe_fence(fence, "Shared", m); - } - + dma_resv_describe(robj, m); msm_gem_unlock(obj); } From patchwork Wed Nov 3 08:12:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12600325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83538C4167D for ; Wed, 3 Nov 2021 08:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68D6A61186 for ; Wed, 3 Nov 2021 08:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbhKCIPR (ORCPT ); Wed, 3 Nov 2021 04:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231361AbhKCIPP (ORCPT ); Wed, 3 Nov 2021 04:15:15 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1B51C061205; Wed, 3 Nov 2021 01:12:38 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id d5so2269267wrc.1; Wed, 03 Nov 2021 01:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6i0TILSChMzKedgIRlQxmjqUOkHsjq/nCVlt/Lvwgi8=; b=fbXMem3BZAeM4zx05udJs8RU83SnUnDknEVTLjOG268mHwt7lNy1OMfi09Yg0VAf7c apmaEJKTNSrVORqXHNyi6g/doqrxSzp+7ySTipnL3XhT66vYc+E81thxqEytTakRYAf8 RlGc560K9HAGEOHIp/yGkTL0dRACqUXUqW3ySNR2u3aunQnWrTbRwgSIrFVdwz+WpJWf jIAGnLBOIwjKT3ealUaEHayAVXGH8V4K2Z1TBrNa+OfOFAApjM3Q9avwjytVIYGQ040b IQtRfxRxrepXd6NWzILfCQON2YWqLSxAJZ3nH74a3ww3qhM2LDbVlmHE6Qwq2uajjmf6 ZkvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6i0TILSChMzKedgIRlQxmjqUOkHsjq/nCVlt/Lvwgi8=; b=702ZxoSilcyWHKCptPETRrVv0UxN17qTQemy+5G8Vb99o/Vudw7DkMY+U6Qcg0nSAa wtSp5VZr6+H+/7BcSPp5TT6wNeKJdth6ipIIdhYezFVMWCYouP36T1mdzil8Yj3w3mQ4 VGr56SQY2UTXHoTu0PRkcUcRLdiY+rDjPbCXaLj3EhuV0P1ReNmxSqsSh+heN3tpwDKl cyYDV7TzU57chLpDDFFScZ2FMvd5CsuHK9kWDLB7zzeMY35XhpSV6nOBMvHdi9hFQFRk WR74wBC39+z2tbspSgXU0BPvLklKNu/75xru9r+wFiLva/8DojZMy002uoMyfNpjPIuH rMrw== X-Gm-Message-State: AOAM533HEvH1KU7Uj8uBPPa5qLmvNrOqnSJxBtSJWGnzBhYGvD0KzMVw zoYGCw9STPLenFqSUWcwgASfIDJDqt8= X-Google-Smtp-Source: ABdhPJyW3RmT8hjvHLXqmp+ylp5ci7lZJCiF7FrEggbZd+lRPfI+n6ryKMqhriDVaUPELcJAYDGeWg== X-Received: by 2002:a5d:5888:: with SMTP id n8mr10318438wrf.234.1635927157429; Wed, 03 Nov 2021 01:12:37 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l7sm1450088wry.86.2021.11.03.01.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 01:12:37 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org Cc: sumit.semwal@linaro.org, l.stach@pengutronix.de, daniel@ffwll.ch Subject: [PATCH 3/4] drm/etnaviv: use dma_resv_describe Date: Wed, 3 Nov 2021 09:12:30 +0100 Message-Id: <20211103081231.18578-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103081231.18578-1-christian.koenig@amd.com> References: <20211103081231.18578-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of dumping the fence info manually. Signed-off-by: Christian König Reviewed-by: Rob Clark --- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c index b018693e3877..d5314aa28ff7 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c @@ -424,36 +424,24 @@ int etnaviv_gem_wait_bo(struct etnaviv_gpu *gpu, struct drm_gem_object *obj, } #ifdef CONFIG_DEBUG_FS -static void etnaviv_gem_describe_fence(struct dma_fence *fence, - const char *type, struct seq_file *m) -{ - seq_printf(m, "\t%9s: %s %s seq %llu\n", type, - fence->ops->get_driver_name(fence), - fence->ops->get_timeline_name(fence), - fence->seqno); -} - static void etnaviv_gem_describe(struct drm_gem_object *obj, struct seq_file *m) { struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); struct dma_resv *robj = obj->resv; - struct dma_resv_iter cursor; - struct dma_fence *fence; unsigned long off = drm_vma_node_start(&obj->vma_node); + int r; seq_printf(m, "%08x: %c %2d (%2d) %08lx %p %zd\n", etnaviv_obj->flags, is_active(etnaviv_obj) ? 'A' : 'I', obj->name, kref_read(&obj->refcount), off, etnaviv_obj->vaddr, obj->size); - dma_resv_iter_begin(&cursor, robj, true); - dma_resv_for_each_fence_unlocked(&cursor, fence) { - if (dma_resv_iter_is_exclusive(&cursor)) - etnaviv_gem_describe_fence(fence, "Exclusive", m); - else - etnaviv_gem_describe_fence(fence, "Shared", m); - } - dma_resv_iter_end(&cursor); + r = dma_resv_lock(robj, NULL); + if (r) + return; + + dma_resv_describe(robj, m); + dma_resv_unlock(robj); } void etnaviv_gem_describe_objects(struct etnaviv_drm_private *priv, From patchwork Wed Nov 3 08:12:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 12600327 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18157C4167E for ; Wed, 3 Nov 2021 08:12:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2BC361175 for ; Wed, 3 Nov 2021 08:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231435AbhKCIPR (ORCPT ); Wed, 3 Nov 2021 04:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231322AbhKCIPP (ORCPT ); Wed, 3 Nov 2021 04:15:15 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7A5AC061714; Wed, 3 Nov 2021 01:12:39 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id d5so2269341wrc.1; Wed, 03 Nov 2021 01:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4CDt1ISjRTMYLH7FxvvLqp3He8TQZQtgj+2GfXtaN90=; b=g9U1aSa+6bfag8lo3nJKStn7BnOsmwJb6j1n4QC0Lkp1bDff6m9nVVeAoToH3yAudW 4jTbxb8/cz27CKva48/O/RblrmnLlJa141hwjr/7zvWE1IjnsP9KKu7Zbc4G7kGQ+bjy TRMIQFhu0WKSRP/jVfYGghycdSFltphYSAwVFMpZt91dTudt5/B1Bw7LABU4HXO3tbv8 q9Q62IJ8avbKVgS4KTNxIMKbWGcXUxKEB+i3t+0ZCrlwNWFLXmBmD/GZCpKLiZFgIp3z 8zW847hVRQ1jOayX9XCwct3J+rN0aZqVN6CWHmMOhJF6kywpn1Xl6nxJGDznecM+bw+q 2k2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4CDt1ISjRTMYLH7FxvvLqp3He8TQZQtgj+2GfXtaN90=; b=Nt1r0SdMZ/hOD5nOIftdZQ0/6Q4702jHt/GqDXEpOAs1/+SI4QTIzefXMksUPbflub FtlBqvTGBIQntUvxNtY1pNmxNWPZcAcTjXY53eCul9i9lFg2Y/kwiQR4HoSjuj6L4BEO sjviNlux380Lzv58LU2gd74ma4ZerHlKRp2ORSZ12nDvI09MzaMV4DRGyuk/UrwHDvCs ewCkBb5S7vXLioQJZAJrz4JuWCZkKqeD+rXT+7C9v7pnSdxsDhRZu8Ypczh6avNSDyxU u0PfLe9H8FetiS/LEbXcmsRFcgU9N/g6R/WPuFJC5jvoLnx15Q7HHPsOCY2K+R/QYC7u Ivbw== X-Gm-Message-State: AOAM530VkUBtqYOvHkSIgJzM5AX0lFPQoVvA4GeZWG5MV8V0BqGxCS+M C847hGGei3tRsCpT6+pb0D0z6DdT4fo= X-Google-Smtp-Source: ABdhPJxlY/OJLgc774nRzsIwvqJo4XvP/pZEzGcq0XIZGbOcmmVvVYVPx0RKwrS16P8UJv2gUPvNvA== X-Received: by 2002:a5d:6dae:: with SMTP id u14mr53757436wrs.46.1635927158385; Wed, 03 Nov 2021 01:12:38 -0700 (PDT) Received: from abel.fritz.box (p5b0ea1b5.dip0.t-ipconnect.de. [91.14.161.181]) by smtp.gmail.com with ESMTPSA id l7sm1450088wry.86.2021.11.03.01.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Nov 2021 01:12:38 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: linux-media@vger.kernel.org, etnaviv@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux-foundation.org, spice-devel@lists.freedesktop.org Cc: sumit.semwal@linaro.org, l.stach@pengutronix.de, daniel@ffwll.ch Subject: [PATCH 4/4] drm/qxl: use iterator instead of dma_resv_shared_list Date: Wed, 3 Nov 2021 09:12:31 +0100 Message-Id: <20211103081231.18578-5-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211103081231.18578-1-christian.koenig@amd.com> References: <20211103081231.18578-1-christian.koenig@amd.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org I'm not sure why it is useful to know the number of fences in the reservation object, but we try to avoid exposing the dma_resv_shared_list() function. So use the iterator instead. If more information is desired we could use dma_resv_describe() as well. Signed-off-by: Christian König --- drivers/gpu/drm/qxl/qxl_debugfs.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c index 1f9a59601bb1..6a36b0fd845c 100644 --- a/drivers/gpu/drm/qxl/qxl_debugfs.c +++ b/drivers/gpu/drm/qxl/qxl_debugfs.c @@ -57,13 +57,16 @@ qxl_debugfs_buffers_info(struct seq_file *m, void *data) struct qxl_bo *bo; list_for_each_entry(bo, &qdev->gem.objects, list) { - struct dma_resv_list *fobj; - int rel; - - rcu_read_lock(); - fobj = dma_resv_shared_list(bo->tbo.base.resv); - rel = fobj ? fobj->shared_count : 0; - rcu_read_unlock(); + struct dma_resv_iter cursor; + struct dma_fence *fence; + int rel = 0; + + dma_resv_iter_begin(&cursor, bo->tbo.base.resv, true); + dma_resv_for_each_fence_unlocked(&cursor, fence) { + if (dma_resv_iter_is_restarted(&cursor)) + rel = 0; + ++rel; + } seq_printf(m, "size %ld, pc %d, num releases %d\n", (unsigned long)bo->tbo.base.size,