Skip to contentSkip to conversation

Fix DRM driver initialization failure in kernel v5.14

PATCH In review Dan Moulding 5 participants 9 messages Aug 10, 2021 – Aug 16, 2021

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

cover Fix DRM driver initialization failure in kernel v5.14

After trying out kernel v5.14-rc5 on my system, I no longer get any display output. Checking dmesg, I found it's because my DRM driver (nouveau) is failing at ttm_device_init. That is failing because of a behavior change in ttm_global_init with respect to debugfs. debugfs is disabled on my system, which causes ttm_global_init to fail. The following patch fixes the issue by ignoring the debugfs failure, which is expected, rather than allowing it to cause ttm_global_init to fail.

Dan Moulding (1):
drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

 drivers/gpu/drm/ttm/ttm_device.c | 2 --
 1 file changed, 2 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/1 drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

In 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()"), ttm_global_init was changed so that if creation of the debugfs global root directory fails, ttm_global_init will bail out early and return an error, leading to initialization failure of DRM drivers. However, not every system will be using debugfs. On such a system, debugfs directory creation can be expected to fail, but DRM drivers must still be usable. This changes it so that if creation of TTM's debugfs root directory fails, then no biggie: keep calm and carry on.

Fixes 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")
---
 drivers/gpu/drm/ttm/ttm_device.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +0 -2
index 74e3b460132b..2df59b3c2ea1 100644
@@ -78,9 +78,7 @@ static int ttm_global_init(void)
 
 	ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
 	if (IS_ERR(ttm_debugfs_root)) {
-		ret = PTR_ERR(ttm_debugfs_root);
 		ttm_debugfs_root = NULL;
-		goto out;
 	}
 
 	/* Limit the number of pages in the pool to about 50% of the total
Signature · 1 line
2.31.1
Tested-by on v1 1/1
#2 lore raw

Re: [PATCH 1/1] drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

Quoted 34 lines · Dan Moulding

In 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()"), ttm_global_init was changed so that if creation of the debugfs global root directory fails, ttm_global_init will bail out early and return an error, leading to initialization failure of DRM drivers. However, not every system will be using debugfs. On such a system, debugfs directory creation can be expected to fail, but DRM drivers must still be usable. This changes it so that if creation of TTM's debugfs root directory fails, then no biggie: keep calm and carry on.

Fixes 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")
---
 drivers/gpu/drm/ttm/ttm_device.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +0 -3
index 74e3b460132b..2df59b3c2ea1 100644
@@ -78,9 +78,7 @@ static int ttm_global_init(void)
 
        ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
        if (IS_ERR(ttm_debugfs_root)) {
-               ret = PTR_ERR(ttm_debugfs_root);
                ttm_debugfs_root = NULL;
-               goto out;
        }
 
        /* Limit the number of pages in the pool to about 50% of the total
--

2.31.1

Reviewed-by on v1 1/1
#3 lore raw

Re: [PATCH 1/1] drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

In reply to Dan Moulding
Quoted 10 lines · Dan Moulding

In 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()"), ttm_global_init was changed so that if creation of the debugfs global root directory fails, ttm_global_init will bail out early and return an error, leading to initialization failure of DRM drivers. However, not every system will be using debugfs. On such a system, debugfs directory creation can be expected to fail, but DRM drivers must still be usable. This changes it so that if creation of TTM's debugfs root directory fails, then no biggie: keep calm and carry on.

Quoted 2 lines
Fixes 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")

It looks ok for me.

Thanks,
Ray

Quoted 21 lines
---
 drivers/gpu/drm/ttm/ttm_device.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +0 -2
index 74e3b460132b..2df59b3c2ea1 100644
@@ -78,9 +78,7 @@ static int ttm_global_init(void)
 
 	ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
 	if (IS_ERR(ttm_debugfs_root)) {
-		ret = PTR_ERR(ttm_debugfs_root);
 		ttm_debugfs_root = NULL;
-		goto out;
 	}
 
 	/* Limit the number of pages in the pool to about 50% of the total
Signature · 1 line
2.31.1
#4 lore raw

Re: [PATCH 1/1] drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

In reply to Dan Moulding

Am 10.08.21 um 21:59 schrieb Dan Moulding:

Quoted 10 lines

In 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()"), ttm_global_init was changed so that if creation of the debugfs global root directory fails, ttm_global_init will bail out early and return an error, leading to initialization failure of DRM drivers. However, not every system will be using debugfs. On such a system, debugfs directory creation can be expected to fail, but DRM drivers must still be usable. This changes it so that if creation of TTM's debugfs root directory fails, then no biggie: keep calm and carry on.

Quoted 2 lines
Fixes 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")

Good point, patch is Reviewed-by: Christian König <[email protected]>.

Going to pick that up later today.

Regards,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/ttm/ttm_device.c | 2 --
  1 file changed, 2 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +0 -2
index 74e3b460132b..2df59b3c2ea1 100644
@@ -78,9 +78,7 @@ static int ttm_global_init(void)
 
  	ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
  	if (IS_ERR(ttm_debugfs_root)) {
-		ret = PTR_ERR(ttm_debugfs_root);
  		ttm_debugfs_root = NULL;
-		goto out;
  	}
 
  	/* Limit the number of pages in the pool to about 50% of the total
Reviewed-by
#5 lore raw

Re: [PATCH 1/1] drm: ttm: Don't bail from ttm_global_init if debugfs_create_dir fails

Makes sense

Quoted 42 lines · Christian König

Am 10.08.21 um 21:59 schrieb Dan Moulding:

Quoted 10 lines

In 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()"), ttm_global_init was changed so that if creation of the debugfs global root directory fails, ttm_global_init will bail out early and return an error, leading to initialization failure of DRM drivers. However, not every system will be using debugfs. On such a system, debugfs directory creation can be expected to fail, but DRM drivers must still be usable. This changes it so that if creation of TTM's debugfs root directory fails, then no biggie: keep calm and carry on.

Quoted 2 lines
Fixes 69de4421bb4c ("drm/ttm: Initialize debugfs from ttm_global_init()")

Good point, patch is Reviewed-by: Christian König
<[email protected]>.

Going to pick that up later today.

Regards,
Christian.

Quoted 18 lines
---
  drivers/gpu/drm/ttm/ttm_device.c | 2 --
  1 file changed, 2 deletions(-)
drivers/gpu/drm/ttm/ttm_device.c +0 -2
index 74e3b460132b..2df59b3c2ea1 100644
@@ -78,9 +78,7 @@ static int ttm_global_init(void)
 
      ttm_debugfs_root = debugfs_create_dir("ttm", NULL);
      if (IS_ERR(ttm_debugfs_root)) {
-             ret = PTR_ERR(ttm_debugfs_root);
              ttm_debugfs_root = NULL;
-             goto out;
      }
 
      /* Limit the number of pages in the pool to about 50% of the total
#6 lore raw
In reply to Dan Moulding

Just a friendly reminder that this fix for a regression needs review. It should be a quick review.

It would probably be good to ensure this gets in before the final 5.14 release, otherwise this is going to be a very visible regression for anyone that uses DRM and does not use debugfs.

Thanks!

-- Dan

#7 lore raw
Quoted 7 lines · Dan Moulding

Just a friendly reminder that this fix for a regression needs review. It should be a quick review.

It would probably be good to ensure this gets in before the final 5.14 release, otherwise this is going to be a very visible regression for anyone that uses DRM and does not use debugfs.

Just took a look at your patch, it's ok for me. Alex/Christian, could you help to apply this fix if you have no concern?

Best Regards,
Ray

#8 lore raw

Am 16.08.21 um 08:20 schrieb Huang Rui:

Quoted 10 lines · Dan Moulding
Quoted 7 lines

Just a friendly reminder that this fix for a regression needs review. It should be a quick review.

It would probably be good to ensure this gets in before the final 5.14 release, otherwise this is going to be a very visible regression for anyone that uses DRM and does not use debugfs.

Just took a look at your patch, it's ok for me. Alex/Christian, could you help to apply this fix if you have no concern?

Sorry for the delay, just came back from vacation today.

Patch is pushed to drm-misc-fixes and will hopefully still get into 5.14.

Thanks,
Christian.

Quoted 3 lines

Best Regards,
Ray