From patchwork Thu Feb 9 08:18:36 2023 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: 13134189 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CEBCBC636D4 for ; Thu, 9 Feb 2023 08:18:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D8FD210E942; Thu, 9 Feb 2023 08:18:47 +0000 (UTC) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0099A10E92F for ; Thu, 9 Feb 2023 08:18:43 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id bk16so902580wrb.11 for ; Thu, 09 Feb 2023 00:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gZxl+t+GTO8erzy1SnGbQeiKRaPLeiNEZAK8jbC2oDY=; b=p0m5VUuFOYW1GeDVwWT7/yUA+YGUkazNSY6vYiT/Yx/NZ4IxsTRYSdK9OsaVArAhMR h8G0DBKZsaNiBKNKW4cfviop77DmWEKjiSGw/2BssWA0/qbKuZ17qhDS39d+o8/ddzB5 Fk29BJXHvbSAfOgmpj2qZJvSm2VZZY80eIaJP2t4DvZSNz9jqv93pFg/iP2I1g+VCrdM JlvgMMxiRWYbIRMEURxOgfp+myipIq5py/dUl4jhvo2Q0vXycAeU4eMjqzYrS2ZUqJ2b FgExk5CpVx/gyNcd7riXcGpeUhjV1FIfHEHAKGEhnmbaBqx7cHv6xClA8WP+hukCCl6m Rc6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gZxl+t+GTO8erzy1SnGbQeiKRaPLeiNEZAK8jbC2oDY=; b=1otG0JkfO4kcR6Xcx+ynOwHVuIAWMCwWddt0YgmjnSP/xFVXGlGKwLqDNWuQkgPyXe G0tNPv0oG7Nb1uYoY8ZKXQwANHWI6H0VlXVK03fDsFBMzpIANJ2vQ4aciKSqRrPixZNT ljug/UdNWS1jFu663HvTJD93Wgv5ym33BcCYT2Q1rlc0mGhHtrnYLvzRHdmGqUOqiAfX snC2ORHKGAtMgD9NZtx1ZSPaO2kjdZGgte0F84EUHqpj86EZHrfjY6YL4piDgCr7DUdI rjOHE7dugI5nhF5evWpc1maljTT2Lv08HjC3XK/f0PzU6d4OxPCChl89tYlfSs7665z/ Jozw== X-Gm-Message-State: AO0yUKVyrxR1Ccw5hUCLRSYlPb9k4fORjnX6weUi6lzp7bBJ2Px5tWkf zBMQUnKhk5QyJY6Od02I0R0= X-Google-Smtp-Source: AK7set8KFbL6ismRgGbcDgDtVJylaeD2M7SpuV/B19dnsjPKoIOW0BUN7/NcpSs2Oxjt4p4DsJsPSQ== X-Received: by 2002:a05:6000:18b:b0:2c3:ede8:acff with SMTP id p11-20020a056000018b00b002c3ede8acffmr11323376wrx.28.1675930722627; Thu, 09 Feb 2023 00:18:42 -0800 (PST) Received: from able.fritz.box (p5b0ea2e7.dip0.t-ipconnect.de. [91.14.162.231]) by smtp.gmail.com with ESMTPSA id n10-20020adffe0a000000b002c3ec35f360sm602056wrr.56.2023.02.09.00.18.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 00:18:42 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: daniel.vetter@ffwll.ch, wambui.karugax@gmail.com, mcanal@igalia.com, maxime@cerno.tech, mwen@igalia.com, mairacanal@riseup.net Subject: [PATCH 1/3] drm/debugfs: separate debugfs creation into init and register Date: Thu, 9 Feb 2023 09:18:36 +0100 Message-Id: <20230209081838.45273-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209081838.45273-1-christian.koenig@amd.com> References: <20230209081838.45273-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This way we can create debugfs files directly, even between init and register. Signed-off-by: Christian König --- drivers/gpu/drm/drm_debugfs.c | 12 ++++++++---- drivers/gpu/drm/drm_drv.c | 15 +++++++-------- drivers/gpu/drm/drm_internal.h | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 4f643a490dc3..2724cac03509 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -221,8 +221,6 @@ EXPORT_SYMBOL(drm_debugfs_create_files); int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root) { - struct drm_device *dev = minor->dev; - struct drm_debugfs_entry *entry, *tmp; char name[64]; INIT_LIST_HEAD(&minor->debugfs_list); @@ -230,6 +228,14 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, sprintf(name, "%d", minor_id); minor->debugfs_root = debugfs_create_dir(name, root); + return 0; +} + +void drm_debugfs_register(struct drm_minor *minor) +{ + struct drm_device *dev = minor->dev; + struct drm_debugfs_entry *entry, *tmp; + drm_debugfs_add_files(minor->dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); if (drm_drv_uses_atomic_modeset(dev)) { @@ -250,8 +256,6 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, minor->debugfs_root, entry, &drm_debugfs_entry_fops); list_del(&entry->list); } - - return 0; } void drm_debugfs_late_register(struct drm_device *dev) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index c6eb8972451a..88ce22c04672 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -156,6 +156,10 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) if (IS_ERR(minor->kdev)) return PTR_ERR(minor->kdev); + r = drm_debugfs_init(minor, minor->index, drm_debugfs_root); + if (r) + return r; + *drm_minor_get_slot(dev, type) = minor; return 0; } @@ -172,15 +176,10 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) if (!minor) return 0; - if (minor->type == DRM_MINOR_ACCEL) { + if (minor->type == DRM_MINOR_ACCEL) accel_debugfs_init(minor, minor->index); - } else { - ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root); - if (ret) { - DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n"); - goto err_debugfs; - } - } + else + drm_debugfs_register(minor); ret = device_add(minor->kdev); if (ret) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index ed2103ee272c..332fb65a935a 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -185,6 +185,7 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, #if defined(CONFIG_DEBUG_FS) int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); +void drm_debugfs_register(struct drm_minor *minor); void drm_debugfs_cleanup(struct drm_minor *minor); void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); From patchwork Thu Feb 9 08:18:37 2023 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: 13134188 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB92BC61DA4 for ; Thu, 9 Feb 2023 08:18:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD0FF10E936; Thu, 9 Feb 2023 08:18:47 +0000 (UTC) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4268F10E92F for ; Thu, 9 Feb 2023 08:18:45 +0000 (UTC) Received: by mail-wr1-x42f.google.com with SMTP id ba1so931306wrb.5 for ; Thu, 09 Feb 2023 00:18:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zEBaHco3UdEFBOFDlUksoEPN89IiXwklvut5n7PqlrM=; b=PEiQwBekEuZ3rc6ijTrijux3wu34YRhgR8SEhaC6O8PWgxXo8EacNeTFMmjpULQSpX GkmKwsZp1SaFCHRnG8NPM72LL3Z9zG9T18n7BMfxEWZxqtvoORc6Wa1kb7aEalemEkCX J6ky4iVarMhMeSics5eczusVbOIj9tiEAndGNhJDM/ZSHQV/Bk8+fwrQhlJsUHmvWCdC oFlHC/fVkDTb2fq90xiTACZHsHvXz+N0Xzs34UyMsWtRA65IUzFYD2OMdBhDX3rAqjrt 3FbBMmH66R8SGMIov71JX3oYekAlCbHCUwoWilkIkh+nKUvBByfSVbtPStC6x8qXmj4g G12w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zEBaHco3UdEFBOFDlUksoEPN89IiXwklvut5n7PqlrM=; b=hXW3aIu7WyE/w70ROzjiuggTkB7tYElxcslUyfitITYY55fegm+ttgZdw5UBYasRab wJh3Vst28K4xy9egGwHWUP3FPBYqa0phwDMV8MEnsGkjllaRVpPEpNzzsZPz2SHjPicK WEAzdPJg25qszXRlQhaEWrNxQdeNR1t+6M4pEFLC+pfoPaG1Sjhiw7ksvdSiMyX0d46H ABQFRYt1AxErqtljaESUjxW1upUklu8zrXLiurVqvHfoalwKhdjlOL93fG3/mewU/TKN Zv6DtRk/XpkZ+8ZNnNwJNLzDqubHxNzDjrG4Y11t7Qwkacw9ja+nem1BXrf2C+KSA6A5 BqPw== X-Gm-Message-State: AO0yUKVklsciJX4Uxt8QVVZXISXVcJq1gjTwAf4tTNFpWR+o8pQIQi/o +oLvEy4srnpZ6p0oGz42/BY= X-Google-Smtp-Source: AK7set8QKTMyL1BvVrVMsqUGVx7B5zZUh0Sjgv+ZI7mfOgyVCzGV2H92R92DWfiXadq4aDSiELOs5g== X-Received: by 2002:a5d:58c3:0:b0:2c4:1ea:4b94 with SMTP id o3-20020a5d58c3000000b002c401ea4b94mr5151705wrf.69.1675930723630; Thu, 09 Feb 2023 00:18:43 -0800 (PST) Received: from able.fritz.box (p5b0ea2e7.dip0.t-ipconnect.de. [91.14.162.231]) by smtp.gmail.com with ESMTPSA id n10-20020adffe0a000000b002c3ec35f360sm602056wrr.56.2023.02.09.00.18.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 00:18:43 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: daniel.vetter@ffwll.ch, wambui.karugax@gmail.com, mcanal@igalia.com, maxime@cerno.tech, mwen@igalia.com, mairacanal@riseup.net Subject: [PATCH 2/3] drm/debugfs: split registration into dev and minor Date: Thu, 9 Feb 2023 09:18:37 +0100 Message-Id: <20230209081838.45273-3-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209081838.45273-1-christian.koenig@amd.com> References: <20230209081838.45273-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The different subsystems should probably only register their debugfs files once. This temporary removes the common files from the render node directory. Signed-off-by: Christian König --- drivers/gpu/drm/drm_atomic.c | 4 ++-- drivers/gpu/drm/drm_client.c | 4 ++-- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_debugfs.c | 24 ++++++++++++------------ drivers/gpu/drm/drm_drv.c | 4 +++- drivers/gpu/drm/drm_framebuffer.c | 4 ++-- drivers/gpu/drm/drm_internal.h | 5 +++-- include/drm/drm_client.h | 2 +- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 5457c02ca1ab..ae6ec1dd162a 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1770,9 +1770,9 @@ static const struct drm_debugfs_info drm_atomic_debugfs_list[] = { {"state", drm_state_info, 0}, }; -void drm_atomic_debugfs_init(struct drm_minor *minor) +void drm_atomic_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_atomic_debugfs_list, + drm_debugfs_add_files(dev, drm_atomic_debugfs_list, ARRAY_SIZE(drm_atomic_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index 009e7b10455c..847acf0ef570 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -507,9 +507,9 @@ static const struct drm_debugfs_info drm_client_debugfs_list[] = { { "internal_clients", drm_client_debugfs_internal_clients, 0 }, }; -void drm_client_debugfs_init(struct drm_minor *minor) +void drm_client_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_client_debugfs_list, + drm_debugfs_add_files(dev, drm_client_debugfs_list, ARRAY_SIZE(drm_client_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 501a10edd0e1..8556c3b3ff88 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -232,7 +232,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, /* drm_atomic.c */ #ifdef CONFIG_DEBUG_FS struct drm_minor; -void drm_atomic_debugfs_init(struct drm_minor *minor); +void drm_atomic_debugfs_init(struct drm_device *dev); #endif int __drm_atomic_helper_disable_plane(struct drm_plane *plane, diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2724cac03509..558e3a7271a5 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -231,22 +231,22 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, return 0; } -void drm_debugfs_register(struct drm_minor *minor) +void drm_debugfs_dev_register(struct drm_device *dev) { - struct drm_device *dev = minor->dev; - struct drm_debugfs_entry *entry, *tmp; - - drm_debugfs_add_files(minor->dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); - - if (drm_drv_uses_atomic_modeset(dev)) { - drm_atomic_debugfs_init(minor); - } + drm_debugfs_add_files(dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); if (drm_core_check_feature(dev, DRIVER_MODESET)) { - drm_framebuffer_debugfs_init(minor); - - drm_client_debugfs_init(minor); + drm_framebuffer_debugfs_init(dev); + drm_client_debugfs_init(dev); } + if (drm_drv_uses_atomic_modeset(dev)) + drm_atomic_debugfs_init(dev); +} + +void drm_debugfs_minor_register(struct drm_minor *minor) +{ + struct drm_device *dev = minor->dev; + struct drm_debugfs_entry *entry, *tmp; if (dev->driver->debugfs_init) dev->driver->debugfs_init(minor); diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 88ce22c04672..2cbe028e548c 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -179,7 +179,7 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) if (minor->type == DRM_MINOR_ACCEL) accel_debugfs_init(minor, minor->index); else - drm_debugfs_register(minor); + drm_debugfs_minor_register(minor); ret = device_add(minor->kdev); if (ret) @@ -913,6 +913,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags) if (drm_dev_needs_global_mutex(dev)) mutex_lock(&drm_global_mutex); + drm_debugfs_dev_register(dev); + ret = drm_minor_register(dev, DRM_MINOR_RENDER); if (ret) goto err_minors; diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index aff3746dedfb..ba51deb6d042 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -1222,9 +1222,9 @@ static const struct drm_debugfs_info drm_framebuffer_debugfs_list[] = { { "framebuffer", drm_framebuffer_info, 0 }, }; -void drm_framebuffer_debugfs_init(struct drm_minor *minor) +void drm_framebuffer_debugfs_init(struct drm_device *dev) { - drm_debugfs_add_files(minor->dev, drm_framebuffer_debugfs_list, + drm_debugfs_add_files(dev, drm_framebuffer_debugfs_list, ARRAY_SIZE(drm_framebuffer_debugfs_list)); } #endif diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 332fb65a935a..5ff7bf88f162 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -185,7 +185,8 @@ int drm_gem_dumb_destroy(struct drm_file *file, struct drm_device *dev, #if defined(CONFIG_DEBUG_FS) int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root); -void drm_debugfs_register(struct drm_minor *minor); +void drm_debugfs_dev_register(struct drm_device *dev); +void drm_debugfs_minor_register(struct drm_minor *minor); void drm_debugfs_cleanup(struct drm_minor *minor); void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); @@ -261,4 +262,4 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data, /* drm_framebuffer.c */ void drm_framebuffer_print_info(struct drm_printer *p, unsigned int indent, const struct drm_framebuffer *fb); -void drm_framebuffer_debugfs_init(struct drm_minor *minor); +void drm_framebuffer_debugfs_init(struct drm_device *dev); diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h index 39482527a775..507d132cf494 100644 --- a/include/drm/drm_client.h +++ b/include/drm/drm_client.h @@ -200,6 +200,6 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode); drm_for_each_connector_iter(connector, iter) \ if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK) -void drm_client_debugfs_init(struct drm_minor *minor); +void drm_client_debugfs_init(struct drm_device *dev); #endif From patchwork Thu Feb 9 08:18:38 2023 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: 13134190 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 267B6C61DA4 for ; Thu, 9 Feb 2023 08:18:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A55B10E944; Thu, 9 Feb 2023 08:18:48 +0000 (UTC) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E68D10E936 for ; Thu, 9 Feb 2023 08:18:46 +0000 (UTC) Received: by mail-wr1-x435.google.com with SMTP id h16so898896wrz.12 for ; Thu, 09 Feb 2023 00:18:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NOtI2HKpzbpdAoapug+id9Mkg3MTgOUSvAB/EfkYBu0=; b=fMmptcW869FvfzMe6N0eDnUbrd0+XS6pttxsYOqiUKxq3jFWH3Wn3n0fFE2Fma18dY fOCUppFoxUrBxhL1nGt24pv2YAFOkCrPhw+2+VNHICQ5aahSCD3WavBBqG6XbfeqB+cF Upcn0g+uqCEzbRkUkpYczaUdIp8/iYsBJDxtEmrSiEHS+IwT1gKGDAejmpdcnKz8xmip JwEEB84IVQ59a0olStZ1wkSdYtnCZ+temym2JD1xN6Dur1v5C3GsgWNLAWaGehutWzLk IAbG2D+h6tZrGVovzW/RimQTet6z8UjX8x7IPmSF7Mhf9Cx8l/KaLAHz57SZ0HxaBzjJ KuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NOtI2HKpzbpdAoapug+id9Mkg3MTgOUSvAB/EfkYBu0=; b=MehZXj74DE0B1p1diQUkF0IwuSggoR8Vzq2hxQovtCp7PBgRNvN1KsC2/PbKBHslOL CevS/aJd68qJfrnRwxalyJyLeGDlnpl0QpRzxYt6LUzNnnpHZKcxeMlvmFFkZng/vOMP 5DJ+PXl9wAGMVE14jLYNr2LKHQyjkJkY2YlmyrEAnoUPGoc9CkORnNr56KNoXaBl95AV cNHIIuAAO4unlQ01WuBTLG++aRQlKUP45OGUp2313L3z9roxEW/rk9Y8oQspWfRb9SZa p2rF+Cvflvzf8ykmGKEj3HHpZoSdGuM8hkwS4Ncrit1M3ADizeWeungnAAIfAln+j8MT sQmQ== X-Gm-Message-State: AO0yUKUqi5iJQZwD0MkQfOctX8IRaMXe0iiZU0vz67fi6oE7oS33GK4n Yk+8PjTgg159gzN24CFVpyw= X-Google-Smtp-Source: AK7set9i/bATXxvmvfUGHD9M3iFxXBF7JER/x76vBMqIpFwBb8k/dGBo7Fb/uX2YZb0fnERgvpHv4A== X-Received: by 2002:adf:f212:0:b0:2c3:f250:f217 with SMTP id p18-20020adff212000000b002c3f250f217mr10365657wro.1.1675930724846; Thu, 09 Feb 2023 00:18:44 -0800 (PST) Received: from able.fritz.box (p5b0ea2e7.dip0.t-ipconnect.de. [91.14.162.231]) by smtp.gmail.com with ESMTPSA id n10-20020adffe0a000000b002c3ec35f360sm602056wrr.56.2023.02.09.00.18.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 00:18:44 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: daniel.vetter@ffwll.ch, wambui.karugax@gmail.com, mcanal@igalia.com, maxime@cerno.tech, mwen@igalia.com, mairacanal@riseup.net Subject: [PATCH 3/3] drm/debugfs: remove dev->debugfs_list and debugfs_mutex Date: Thu, 9 Feb 2023 09:18:38 +0100 Message-Id: <20230209081838.45273-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230209081838.45273-1-christian.koenig@amd.com> References: <20230209081838.45273-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The mutex was completely pointless in the first place since any parallel adding of files to this list would result in random behavior since the list is filled and consumed multiple times. Completely drop that approach and just create the files directly. This also re-adds the debugfs files to the render node directory and removes drm_debugfs_late_register(). Signed-off-by: Christian König Signed-off-by: Stanislaw Gruszka --- drivers/gpu/drm/drm_debugfs.c | 32 +++++++------------------------ drivers/gpu/drm/drm_drv.c | 3 --- drivers/gpu/drm/drm_internal.h | 5 ----- drivers/gpu/drm/drm_mode_config.c | 2 -- include/drm/drm_device.h | 15 --------------- 5 files changed, 7 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 558e3a7271a5..a40288e67264 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -246,31 +246,9 @@ void drm_debugfs_dev_register(struct drm_device *dev) void drm_debugfs_minor_register(struct drm_minor *minor) { struct drm_device *dev = minor->dev; - struct drm_debugfs_entry *entry, *tmp; if (dev->driver->debugfs_init) dev->driver->debugfs_init(minor); - - list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { - debugfs_create_file(entry->file.name, 0444, - minor->debugfs_root, entry, &drm_debugfs_entry_fops); - list_del(&entry->list); - } -} - -void drm_debugfs_late_register(struct drm_device *dev) -{ - struct drm_minor *minor = dev->primary; - struct drm_debugfs_entry *entry, *tmp; - - if (!minor) - return; - - list_for_each_entry_safe(entry, tmp, &dev->debugfs_list, list) { - debugfs_create_file(entry->file.name, 0444, - minor->debugfs_root, entry, &drm_debugfs_entry_fops); - list_del(&entry->list); - } } int drm_debugfs_remove_files(const struct drm_info_list *files, int count, @@ -343,9 +321,13 @@ void drm_debugfs_add_file(struct drm_device *dev, const char *name, entry->file.data = data; entry->dev = dev; - mutex_lock(&dev->debugfs_mutex); - list_add(&entry->list, &dev->debugfs_list); - mutex_unlock(&dev->debugfs_mutex); + debugfs_create_file(name, 0444, dev->primary->debugfs_root, entry, + &drm_debugfs_entry_fops); + + /* TODO: This should probably only be a symlink */ + if (dev->render) + debugfs_create_file(name, 0444, dev->render->debugfs_root, + entry, &drm_debugfs_entry_fops); } EXPORT_SYMBOL(drm_debugfs_add_file); diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 2cbe028e548c..e7b88b65866c 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -597,7 +597,6 @@ static void drm_dev_init_release(struct drm_device *dev, void *res) mutex_destroy(&dev->clientlist_mutex); mutex_destroy(&dev->filelist_mutex); mutex_destroy(&dev->struct_mutex); - mutex_destroy(&dev->debugfs_mutex); drm_legacy_destroy_members(dev); } @@ -638,14 +637,12 @@ static int drm_dev_init(struct drm_device *dev, INIT_LIST_HEAD(&dev->filelist_internal); INIT_LIST_HEAD(&dev->clientlist); INIT_LIST_HEAD(&dev->vblank_event_list); - INIT_LIST_HEAD(&dev->debugfs_list); spin_lock_init(&dev->event_lock); mutex_init(&dev->struct_mutex); mutex_init(&dev->filelist_mutex); mutex_init(&dev->clientlist_mutex); mutex_init(&dev->master_mutex); - mutex_init(&dev->debugfs_mutex); ret = drmm_add_action_or_reset(dev, drm_dev_init_release, NULL); if (ret) diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 5ff7bf88f162..e215d00ba65c 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -188,7 +188,6 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, void drm_debugfs_dev_register(struct drm_device *dev); void drm_debugfs_minor_register(struct drm_minor *minor); void drm_debugfs_cleanup(struct drm_minor *minor); -void drm_debugfs_late_register(struct drm_device *dev); void drm_debugfs_connector_add(struct drm_connector *connector); void drm_debugfs_connector_remove(struct drm_connector *connector); void drm_debugfs_crtc_add(struct drm_crtc *crtc); @@ -205,10 +204,6 @@ static inline void drm_debugfs_cleanup(struct drm_minor *minor) { } -static inline void drm_debugfs_late_register(struct drm_device *dev) -{ -} - static inline void drm_debugfs_connector_add(struct drm_connector *connector) { } diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 87eb591fe9b5..8525ef851540 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -54,8 +54,6 @@ int drm_modeset_register_all(struct drm_device *dev) if (ret) goto err_connector; - drm_debugfs_late_register(dev); - return 0; err_connector: diff --git a/include/drm/drm_device.h b/include/drm/drm_device.h index 7cf4afae2e79..900ad7478dd8 100644 --- a/include/drm/drm_device.h +++ b/include/drm/drm_device.h @@ -311,21 +311,6 @@ struct drm_device { */ struct drm_fb_helper *fb_helper; - /** - * @debugfs_mutex: - * - * Protects &debugfs_list access. - */ - struct mutex debugfs_mutex; - - /** - * @debugfs_list: - * - * List of debugfs files to be created by the DRM device. The files - * must be added during drm_dev_register(). - */ - struct list_head debugfs_list; - /* Everything below here is for legacy driver, never use! */ /* private: */ #if IS_ENABLED(CONFIG_DRM_LEGACY)