Skip to contentSkip to conversation

drm/msm/dp: Only create debugfs for PRIMARY minor

PATCH In review Bjorn Andersson 3 participants 4 messages Dec 17, 2021 – Dec 21, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/msm/dp: Only create debugfs for PRIMARY minor

dpu_kms_debugfs_init() is invoked for each minor being registered. Most of the files created are unrelated to the minor, so there's no reason to present them per minor.
The exception to this is the DisplayPort code, which ends up invoking dp_debug_get() for each minor, each time associate the allocated object with dp->debug.

As such dp_debug will create debugfs files in both the PRIMARY and the RENDER minor's debugfs directory, but only the last reference will be remembered.

The only use of this reference today is in the cleanup path in dp_display_deinit_sub_modules() and the dp_debug_private object does outlive the debugfs entries in either case, so there doesn't seem to be any adverse effects of this, but per the code the current behavior is unexpected, so change it to only create debugfs files for the PRIMARY minor.

---

Changes since v1:
- Moved the check up from msm_dp_debugfs_init() to dpu_kms_debugfs_init()

 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +4 -0
index 2ee70072a1b4..a54f7d373f14 100644
@@ -193,6 +193,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
 	if (!p)
 		return -EINVAL;
 
+	/* Only create one set of debugfs per DP instance */
+	if (minor->type != DRM_MINOR_PRIMARY)
+		return 0;
+
 	dev = dpu_kms->dev;
 	priv = dev->dev_private;
 
Signature · 1 line
2.33.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 32 lines · Bjorn Andersson

dpu_kms_debugfs_init() is invoked for each minor being registered. Most of the files created are unrelated to the minor, so there's no reason to present them per minor.
The exception to this is the DisplayPort code, which ends up invoking dp_debug_get() for each minor, each time associate the allocated object with dp->debug.

As such dp_debug will create debugfs files in both the PRIMARY and the RENDER minor's debugfs directory, but only the last reference will be remembered.

The only use of this reference today is in the cleanup path in dp_display_deinit_sub_modules() and the dp_debug_private object does outlive the debugfs entries in either case, so there doesn't seem to be any adverse effects of this, but per the code the current behavior is unexpected, so change it to only create debugfs files for the PRIMARY minor.

---

Changes since v1:
- Moved the check up from msm_dp_debugfs_init() to dpu_kms_debugfs_init()

  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
index 2ee70072a1b4..a54f7d373f14 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) · line 196

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
@@ -193,6 +193,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
  	if (!p)
  		return -EINVAL;
 
+	/* Only create one set of debugfs per DP instance */

I would change this to DPU now instead of DP, but apart from that,

Quoted 6 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -0
+	if (minor->type != DRM_MINOR_PRIMARY)
+		return 0;
+
  	dev = dpu_kms->dev;
  	priv = dev->dev_private;
 
#2 lore raw
In reply to Bjorn Andersson
Quoted 33 lines · Bjorn Andersson

dpu_kms_debugfs_init() is invoked for each minor being registered. Most of the files created are unrelated to the minor, so there's no reason to present them per minor.
The exception to this is the DisplayPort code, which ends up invoking dp_debug_get() for each minor, each time associate the allocated object with dp->debug.

As such dp_debug will create debugfs files in both the PRIMARY and the RENDER minor's debugfs directory, but only the last reference will be remembered.

The only use of this reference today is in the cleanup path in dp_display_deinit_sub_modules() and the dp_debug_private object does outlive the debugfs entries in either case, so there doesn't seem to be any adverse effects of this, but per the code the current behavior is unexpected, so change it to only create debugfs files for the PRIMARY minor.

---

Changes since v1:
- Moved the check up from msm_dp_debugfs_init() to dpu_kms_debugfs_init()

 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
index 2ee70072a1b4..a54f7d373f14 100644

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) · line 196

Quoted 4 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
@@ -193,6 +193,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
        if (!p)
                return -EINVAL;
 
+       /* Only create one set of debugfs per DP instance */

The comment is misleading. Could you please fix it?

Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -1
+       if (minor->type != DRM_MINOR_PRIMARY)
+               return 0;
+
        dev = dpu_kms->dev;
        priv = dev->dev_private;
 
--

2.33.1

Signature · 2 lines
With best wishes
Dmitry
#3 lore raw
Quoted 38 lines · Dmitry Baryshkov
Quoted 36 lines · Bjorn Andersson

dpu_kms_debugfs_init() is invoked for each minor being registered. Most of the files created are unrelated to the minor, so there's no reason to present them per minor.
The exception to this is the DisplayPort code, which ends up invoking dp_debug_get() for each minor, each time associate the allocated object with dp->debug.

As such dp_debug will create debugfs files in both the PRIMARY and the RENDER minor's debugfs directory, but only the last reference will be remembered.

The only use of this reference today is in the cleanup path in dp_display_deinit_sub_modules() and the dp_debug_private object does outlive the debugfs entries in either case, so there doesn't seem to be any adverse effects of this, but per the code the current behavior is unexpected, so change it to only create debugfs files for the PRIMARY minor.

---

Changes since v1:
- Moved the check up from msm_dp_debugfs_init() to dpu_kms_debugfs_init()

 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +0 -0
index 2ee70072a1b4..a54f7d373f14 100644
@@ -193,6 +193,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor)
        if (!p)
                return -EINVAL;
 
Quoted 4 lines

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) · line 196

Quoted 1 line
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +1 -0
+       /* Only create one set of debugfs per DP instance */

The comment is misleading. Could you please fix it?

I agree, and as Abhinav pointed out I didn't update $subject fully either.

Will resubmit.

Regards,
Bjorn

Quoted 14 lines
Quoted 9 lines
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -1
+       if (minor->type != DRM_MINOR_PRIMARY)
+               return 0;
+
        dev = dpu_kms->dev;
        priv = dev->dev_private;
 
--

2.33.1

Signature · 2 lines
With best wishes
Dmitry