* [PATCH] drm: Continue after failure to setup debugfs
@ 2016-05-05 9:47 Chris Wilson
2016-05-05 10:27 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-05-05 11:53 ` [PATCH] " Daniel Vetter
0 siblings, 2 replies; 4+ messages in thread
From: Chris Wilson @ 2016-05-05 9:47 UTC (permalink / raw)
To: intel-gfx; +Cc: dri-devel
If we fail to setup the debugfs we lose debugging convenience, but we
should still endeavour to enable modesetting so that we can control the
outputs and enable use of the system to debug the issue. In all
likelihood if we can not create our debugfs files then there is a larger
underlying issue that will prevent the module loading, but this should
get us further towards resilience.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
---
drivers/gpu/drm/drm_debugfs.c | 13 +++++++++----
drivers/gpu/drm/drm_drv.c | 19 ++++++++-----------
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 3bcf8e6a85b3..8f36e014fbd2 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -160,10 +160,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
ret = drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
minor->debugfs_root, minor);
if (ret) {
- debugfs_remove(minor->debugfs_root);
- minor->debugfs_root = NULL;
DRM_ERROR("Failed to create core drm debugfs files\n");
- return ret;
+ goto err_root;
}
if (dev->driver->debugfs_init) {
@@ -171,10 +169,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
if (ret) {
DRM_ERROR("DRM: Driver failed to initialize "
"/sys/kernel/debug/dri.\n");
- return ret;
+ goto err_core;
}
}
return 0;
+
+err_core:
+ drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
+err_root:
+ debugfs_remove(minor->debugfs_root);
+ minor->debugfs_root = NULL;
+ return ret;
}
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index bff89226a344..18de82e4388a 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -307,11 +307,11 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
if (!minor)
return 0;
- ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
- if (ret) {
+ ret = -ENOENT;
+ if (drm_debugfs_root)
+ ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
+ if (ret)
DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
- return ret;
- }
ret = device_add(minor->kdev);
if (ret)
@@ -904,17 +904,13 @@ static int __init drm_core_init(void)
}
drm_debugfs_root = debugfs_create_dir("dri", NULL);
- if (!drm_debugfs_root) {
+ if (!drm_debugfs_root)
DRM_ERROR("Cannot create /sys/kernel/debug/dri\n");
- ret = -1;
- goto err_p3;
- }
DRM_INFO("Initialized %s %d.%d.%d %s\n",
CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
return 0;
-err_p3:
- drm_sysfs_destroy();
+
err_p2:
unregister_chrdev(DRM_MAJOR, "drm");
@@ -925,7 +921,8 @@ err_p1:
static void __exit drm_core_exit(void)
{
- debugfs_remove(drm_debugfs_root);
+ if (drm_debugfs_root)
+ debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
unregister_chrdev(DRM_MAJOR, "drm");
--
2.8.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* ✓ Fi.CI.BAT: success for drm: Continue after failure to setup debugfs
2016-05-05 9:47 [PATCH] drm: Continue after failure to setup debugfs Chris Wilson
@ 2016-05-05 10:27 ` Patchwork
2016-05-05 11:53 ` [PATCH] " Daniel Vetter
1 sibling, 0 replies; 4+ messages in thread
From: Patchwork @ 2016-05-05 10:27 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx
== Series Details ==
Series: drm: Continue after failure to setup debugfs
URL : https://patchwork.freedesktop.org/series/6770/
State : success
== Summary ==
Series 6770v1 drm: Continue after failure to setup debugfs
http://patchwork.freedesktop.org/api/1.0/series/6770/revisions/1/mbox/
Test drv_module_reload_basic:
dmesg-fail -> INCOMPLETE (bsw-nuc-2)
dmesg-fail -> INCOMPLETE (skl-nuci5)
dmesg-fail -> INCOMPLETE (bdw-nuci7-2)
dmesg-fail -> INCOMPLETE (ivb-t430s)
dmesg-fail -> INCOMPLETE (skl-i7k-2)
dmesg-fail -> INCOMPLETE (byt-nuc)
dmesg-fail -> INCOMPLETE (snb-x220t)
dmesg-fail -> INCOMPLETE (snb-dellxps)
dmesg-fail -> INCOMPLETE (hsw-brixbox)
bdw-nuci7-2 total:33 pass:26 dwarn:0 dfail:0 fail:0 skip:6
bsw-nuc-2 total:33 pass:22 dwarn:0 dfail:0 fail:0 skip:10
byt-nuc total:33 pass:20 dwarn:0 dfail:0 fail:0 skip:12
hsw-brixbox total:33 pass:22 dwarn:0 dfail:0 fail:0 skip:10
ivb-t430s total:33 pass:24 dwarn:0 dfail:0 fail:0 skip:8
skl-i7k-2 total:33 pass:22 dwarn:0 dfail:0 fail:0 skip:10
skl-nuci5 total:33 pass:26 dwarn:0 dfail:0 fail:0 skip:6
snb-dellxps total:33 pass:23 dwarn:0 dfail:0 fail:0 skip:9
snb-x220t total:33 pass:23 dwarn:0 dfail:0 fail:0 skip:9
Results at /archive/results/CI_IGT_test/Patchwork_2140/
e6160ef8b9b3ddfcb1fd382716887e57a2896710 drm-intel-nightly: 2016y-05m-05d-08h-06m-20s UTC integration manifest
31999bc6 drm: Continue after failure to setup debugfs
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: Continue after failure to setup debugfs
2016-05-05 9:47 [PATCH] drm: Continue after failure to setup debugfs Chris Wilson
2016-05-05 10:27 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2016-05-05 11:53 ` Daniel Vetter
2016-05-05 12:15 ` [Intel-gfx] " Chris Wilson
1 sibling, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2016-05-05 11:53 UTC (permalink / raw)
To: Chris Wilson; +Cc: intel-gfx, dri-devel
On Thu, May 05, 2016 at 10:47:10AM +0100, Chris Wilson wrote:
> If we fail to setup the debugfs we lose debugging convenience, but we
> should still endeavour to enable modesetting so that we can control the
> outputs and enable use of the system to debug the issue. In all
> likelihood if we can not create our debugfs files then there is a larger
> underlying issue that will prevent the module loading, but this should
> get us further towards resilience.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: dri-devel@lists.freedesktop.org
Usually the bug is that someone forgot to clean up debugfs files on module
unload, and there's gunk left behind, and that's causing the failure to
load. Since you can't ever recover from leaking debugfs files in this
fashion you need to reboot anyway to make sure your patches are fixed
properly. So I don't see the value of this all that much ...
-Daniel
> ---
> drivers/gpu/drm/drm_debugfs.c | 13 +++++++++----
> drivers/gpu/drm/drm_drv.c | 19 ++++++++-----------
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 3bcf8e6a85b3..8f36e014fbd2 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -160,10 +160,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
> ret = drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
> minor->debugfs_root, minor);
> if (ret) {
> - debugfs_remove(minor->debugfs_root);
> - minor->debugfs_root = NULL;
> DRM_ERROR("Failed to create core drm debugfs files\n");
> - return ret;
> + goto err_root;
> }
>
> if (dev->driver->debugfs_init) {
> @@ -171,10 +169,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
> if (ret) {
> DRM_ERROR("DRM: Driver failed to initialize "
> "/sys/kernel/debug/dri.\n");
> - return ret;
> + goto err_core;
> }
> }
> return 0;
> +
> +err_core:
> + drm_debugfs_remove_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES, minor);
> +err_root:
> + debugfs_remove(minor->debugfs_root);
> + minor->debugfs_root = NULL;
> + return ret;
> }
>
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index bff89226a344..18de82e4388a 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -307,11 +307,11 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type)
> if (!minor)
> return 0;
>
> - ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
> - if (ret) {
> + ret = -ENOENT;
> + if (drm_debugfs_root)
> + ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
> + if (ret)
> DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
> - return ret;
> - }
>
> ret = device_add(minor->kdev);
> if (ret)
> @@ -904,17 +904,13 @@ static int __init drm_core_init(void)
> }
>
> drm_debugfs_root = debugfs_create_dir("dri", NULL);
> - if (!drm_debugfs_root) {
> + if (!drm_debugfs_root)
> DRM_ERROR("Cannot create /sys/kernel/debug/dri\n");
> - ret = -1;
> - goto err_p3;
> - }
>
> DRM_INFO("Initialized %s %d.%d.%d %s\n",
> CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
> return 0;
> -err_p3:
> - drm_sysfs_destroy();
> +
> err_p2:
> unregister_chrdev(DRM_MAJOR, "drm");
>
> @@ -925,7 +921,8 @@ err_p1:
>
> static void __exit drm_core_exit(void)
> {
> - debugfs_remove(drm_debugfs_root);
> + if (drm_debugfs_root)
> + debugfs_remove(drm_debugfs_root);
> drm_sysfs_destroy();
>
> unregister_chrdev(DRM_MAJOR, "drm");
> --
> 2.8.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Intel-gfx] [PATCH] drm: Continue after failure to setup debugfs
2016-05-05 11:53 ` [PATCH] " Daniel Vetter
@ 2016-05-05 12:15 ` Chris Wilson
0 siblings, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2016-05-05 12:15 UTC (permalink / raw)
To: Daniel Vetter; +Cc: intel-gfx, dri-devel
On Thu, May 05, 2016 at 01:53:57PM +0200, Daniel Vetter wrote:
> On Thu, May 05, 2016 at 10:47:10AM +0100, Chris Wilson wrote:
> > If we fail to setup the debugfs we lose debugging convenience, but we
> > should still endeavour to enable modesetting so that we can control the
> > outputs and enable use of the system to debug the issue. In all
> > likelihood if we can not create our debugfs files then there is a larger
> > underlying issue that will prevent the module loading, but this should
> > get us further towards resilience.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: dri-devel@lists.freedesktop.org
>
> Usually the bug is that someone forgot to clean up debugfs files on module
> unload, and there's gunk left behind, and that's causing the failure to
> load. Since you can't ever recover from leaking debugfs files in this
> fashion you need to reboot anyway to make sure your patches are fixed
> properly. So I don't see the value of this all that much ...
The point is to get a console, even GUI, up and running to be able to
reboot. Everything that is not fatal to loading the driver should not
prevent the driver from loading.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-05-05 12:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-05 9:47 [PATCH] drm: Continue after failure to setup debugfs Chris Wilson
2016-05-05 10:27 ` ✓ Fi.CI.BAT: success for " Patchwork
2016-05-05 11:53 ` [PATCH] " Daniel Vetter
2016-05-05 12:15 ` [Intel-gfx] " Chris Wilson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox