Skip to contentSkip to conversation

drm: register more drm device nodes

PATCH Superseded James Zhu 3 participants 5 messages May 30, 2024 – Sep 2, 2024

Subsystems (2)
lore
Share & tools
lore

James Zhu

author
#0 lore raw

PATCH 1/1 drm: register more drm device nodes

Since the default number 256 can't handle large modern systems with large numbers of GPUs, specify a more reasonable default.

---
 drivers/gpu/drm/drm_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +1 -1
index 243cacb3575c..719ea57a70ab 100644
@@ -1086,7 +1086,7 @@ static int __init drm_core_init(void)
 
 	drm_debugfs_root = debugfs_create_dir("dri", NULL);
 
-	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+	ret = __register_chrdev(DRM_MAJOR, 0, 1024, "drm", &drm_stub_fops);
 	if (ret < 0)
 		goto error;
 
Signature · 1 line
2.34.1
#1 lore raw

Ping ...

Quoted 21 lines · James Zhu

Since the default number 256 can't handle large modern systems with large numbers of GPUs, specify a more reasonable default.

---
  drivers/gpu/drm/drm_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +1 -1
index 243cacb3575c..719ea57a70ab 100644
@@ -1086,7 +1086,7 @@ static int __init drm_core_init(void)
 
  	drm_debugfs_root = debugfs_create_dir("dri", NULL);
 
-	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+	ret = __register_chrdev(DRM_MAJOR, 0, 1024, "drm", &drm_stub_fops);
  	if (ret < 0)
  		goto error;
 
#2 lore raw

Please ignore this. need update unregister_chrdev in the meantime Will send out v2 later,

Quoted 21 lines · James Zhu

Ping ...

Quoted 18 lines · James Zhu

Since the default number 256 can't handle large modern systems with large numbers of GPUs, specify a more reasonable default.

---
  drivers/gpu/drm/drm_drv.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/drm_drv.c +1 -0
index 243cacb3575c..719ea57a70ab 100644
@@ -1086,7 +1086,7 @@ static int __init drm_core_init(void)
         drm_debugfs_root = debugfs_create_dir("dri", NULL);
   -    ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+    ret = __register_chrdev(DRM_MAJOR, 0, 1024, "drm", &drm_stub_fops);
       if (ret < 0)
           goto error;
author
#3 lore raw

PATCH v2 1/1 drm: register more drm device nodes

In reply to James Zhu

Since the default number 256 can't handle large modern systems with large numbers of GPUs, specify a more reasonable default.

-v2: update drm_core_exit to unregister more drm device nodes

---
 drivers/gpu/drm/drm_drv.c | 4 ++--
 include/drm/drm_drv.h     | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index 243cacb3575c..bfc6c18a7a92 100644
@@ -1063,7 +1063,7 @@ static void drm_core_exit(void)
 {
 	drm_privacy_screen_lookup_exit();
 	accel_core_exit();
-	unregister_chrdev(DRM_MAJOR, "drm");
+	__unregister_chrdev(DRM_MAJOR, 0, DRM_CHRDEV_MAX, "drm");
 	debugfs_remove(drm_debugfs_root);
 	drm_sysfs_destroy();
 	idr_destroy(&drm_minors_idr);
@@ -1086,7 +1086,7 @@ static int __init drm_core_init(void)
 
 	drm_debugfs_root = debugfs_create_dir("dri", NULL);
 
-	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+	ret = __register_chrdev(DRM_MAJOR, 0, DRM_CHRDEV_MAX, "drm", &drm_stub_fops);
 	if (ret < 0)
 		goto error;
 
include/drm/drm_drv.h +2 -0
index 8878260d7529..8a2da92f02b7 100644
@@ -45,6 +45,8 @@ struct drm_mode_create_dumb;
 struct drm_printer;
 struct sg_table;
 
+#define DRM_CHRDEV_MAX                1024
+
 /**
  * enum drm_driver_feature - feature flags
  *
Signature · 1 line
2.34.1
#4 lore raw
Quoted 6 lines · James Zhu

Since the default number 256 can't handle large modern systems with large numbers of GPUs, specify a more reasonable default.

-v2: update drm_core_exit to unregister more drm device nodes

We've merged a more complete solution meanwhile, I think this should also cover your case:

https://lore.kernel.org/dri-devel/[email protected]/

Cheers, Sima

Quoted 43 lines
---
 drivers/gpu/drm/drm_drv.c | 4 ++--
 include/drm/drm_drv.h     | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index 243cacb3575c..bfc6c18a7a92 100644
@@ -1063,7 +1063,7 @@ static void drm_core_exit(void)
 {
 	drm_privacy_screen_lookup_exit();
 	accel_core_exit();
-	unregister_chrdev(DRM_MAJOR, "drm");
+	__unregister_chrdev(DRM_MAJOR, 0, DRM_CHRDEV_MAX, "drm");
 	debugfs_remove(drm_debugfs_root);
 	drm_sysfs_destroy();
 	idr_destroy(&drm_minors_idr);
@@ -1086,7 +1086,7 @@ static int __init drm_core_init(void)
 
 	drm_debugfs_root = debugfs_create_dir("dri", NULL);
 
-	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+	ret = __register_chrdev(DRM_MAJOR, 0, DRM_CHRDEV_MAX, "drm", &drm_stub_fops);
 	if (ret < 0)
 		goto error;
 
include/drm/drm_drv.h +2 -0
index 8878260d7529..8a2da92f02b7 100644
@@ -45,6 +45,8 @@ struct drm_mode_create_dumb;
 struct drm_printer;
 struct sg_table;
 
+#define DRM_CHRDEV_MAX                1024
+
 /**
  * enum drm_driver_feature - feature flags
  *
Signature · 1 line
2.34.1
Signature · 3 lines
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch