registering same sysfs class in different drivers.
The DRI drivers for each card type are indepenent from each other, but they all exist in the same sysfs class. Right now when I try to load a second driver I'm faulting in sysfs:create_dir with parent dentry NULL. create_dir() is called via simple_add_class_device(). Either driver loads standalone without problem.
I suspect the fault is because each driver is registering it's own copy of the 'dri' class. Is there some mechanism to see if the class has already been registered and use the preexisting copy? class_register() always returns 0.
[drm] Debug messages ON
sysfs:create_dir: kobject *f8b1cfb4, p dentry *f7fc5280, nstr dri, d dentry *f2e47f44
sysfs:create_dir: kobject *f8b1d060, p dentry *f7fe6180, nstr radeon, d dentry *f2e47f18
[drm:drm_probe]
[drm:radeon_stub_register]
sysfs:create_dir: kobject *f59ded00, p dentry *f7fc5a80, nstr drm, d dentry *f2e47e1c
[drm:radeon_stub_register] calling inter_module_register
PCI: Enabling device 0000:01:00.0 (0080 -> 0083) [drm:radeon_ctxbitmap_next] drm_ctxbitmap_next bit : 0 [drm:radeon_ctxbitmap_init] drm_ctxbitmap_init : 0
[drm] Initialized radeon 1.11.0 20040115 on minor 0: ATI Radeon If R250 9000 [drm:radeon_initmap]
[drm:radeon_initmap] initmap offset = 0xfe9e0000, size = 0x00010000, type = 1 [drm:radeon_initmap]
[drm:radeon_initmap] initmap offset = 0xf4000000, size = 0x04000000, type = 0 [drm:radeon_postinit] registering secondary video headclass_device_add: class_id card0
sysfs:create_dir: kobject *f5a56594, p dentry *f2e6fb80, nstr card0, d dentry *f2e47e34
[drm:radeon_need_reset] Memmode is 0, if zero needs reset
[drm] Debug messages ON
sysfs:create_dir: kobject *f8b3b154, p dentry *f7fc5280, nstr dri, d dentry *f2f33f44
sysfs:create_dir: kobject *f8b3b200, p dentry *f7fe6180, nstr r128, d dentry *f2f33f18
[drm:drm_probe]
[drm:r128_stub_register]
[drm:r128_stub_register] already registered [drm:r128_ctxbitmap_next] drm_ctxbitmap_next bit : 0 [drm:r128_ctxbitmap_init] drm_ctxbitmap_init : 0
[drm] Initialized r128 2.5.0 20030725 on minor 1: ATI Rage 128 Pro PD (PCI)class_device_add: class_id card1
sysfs:create_dir: kobject *f510e514, p dentry *00000000, nstr card1, d dentry *f2f33e34
Unable to handle kernel NULL pointer dereference at virtual address 0000000c printing eip: c018d022 *pde = 00000000 Oops: 0000 [#1] CPU: 1 EIP: 0060:[<c018d022>] Not tainted EFLAGS: 00010282
EIP is at create_dir+0x3f/0xc2
eax: 0000005b ebx: f510e518 ecx: c02f19b4 edx: 0000ee04
esi: 00000000 edi: f2f33e34 ebp: f510e514 esp: f2f33dfc
ds: 007b es: 007b ss: 0068
Process insmod (pid: 2772, threadinfoòf32000 taskõf29940)
Stack: c02bd420 f510e514 00000000 f510e518 f2f33e34 f510e514 f510e514 c0327a40
f8b3b140 c018d10f f510e514 00000000 f510e518 f2f33e34 00000000 00000000
c01ba3dd f510e514 f510e514 f8b3b154 c01ba84d f510e514 00000000 f510e514
Call Trace:
[<c018d10f>] sysfs_create_dir+0x40/0x73
[<c01ba3dd>] create_dir+0x1f/0x4b
[<c01ba84d>] kobject_add+0x99/0x11c
[<c0202046>] class_device_add+0x79/0x122
[<c0201fc0>] class_device_initialize+0x1d/0x2a
[<c020250a>] simple_add_class_device+0x80/0xd7
[<f8b26d5e>] drm_probe+0x215/0x262 [r128]
[<c01c4162>] pci_device_probe_static+0x52/0x63
[<c01c41ae>] __pci_device_probe+0x3b/0x4e
[<c01c41ed>] pci_device_probe+0x2c/0x4a
[<c0201463>] bus_match+0x3f/0x6a
[<c0201575>] driver_attach+0x56/0x80
[<c02017f8>] bus_add_driver+0x8c/0x9f
[<c01c43b9>] pci_register_driver+0x6c/0x94
[<f895b036>] drm_init+0x36/0x52 [r128]
[<c0136083>] sys_init_module+0x11d/0x20e
[<c010a84d>] sysenter_past_esp+0x52/0x71
Code: 8b 46 0c 8d 48 6c f0 ff 48 6c 0f 88 1b 03 00 00 89 34 24 89[root@smirl drm]#
==Jon Smirl
[email protected]
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
The bug was in reregistering the class device from multiple drivers. I reworked it using inter_module_register to only register the dri class once and share it. That fixed the problem.
Quoted 100 lines · --- Jon Smirl
The DRI drivers for each card type are indepenent from each other, but they all
exist in the same sysfs class. Right now when I try to load a second driver I'm
faulting in sysfs:create_dir with parent dentry NULL.create_dir()is called viasimple_add_class_device(). Either driver loads standalone without problem.I suspect the fault is because each driver is registering it's own copy of the 'dri' class. Is there some mechanism to see if the class has already been registered and use the preexisting copy?
class_register()always returns 0.[drm] Debug messages ON
sysfs:create_dir: kobject *f8b1cfb4, p dentry *f7fc5280, nstr dri, d dentry *f2e47f44
sysfs:create_dir: kobject *f8b1d060, p dentry *f7fe6180, nstr radeon, d dentry *f2e47f18
[drm:drm_probe]
[drm:radeon_stub_register]
sysfs:create_dir: kobject *f59ded00, p dentry *f7fc5a80, nstr drm, d dentry *f2e47e1c
[drm:radeon_stub_register] callinginter_module_register
PCI: Enabling device 0000:01:00.0 (0080 -> 0083) [drm:radeon_ctxbitmap_next]drm_ctxbitmap_nextbit : 0 [drm:radeon_ctxbitmap_init]drm_ctxbitmap_init: 0
[drm] Initialized radeon 1.11.0 20040115 on minor 0: ATI Radeon If R250 9000 [drm:radeon_initmap]
[drm:radeon_initmap] initmap offset =0xfe9e0000, size =0x00010000, type = 1 [drm:radeon_initmap]
[drm:radeon_initmap] initmap offset =0xf4000000, size =0x04000000, type = 0 [drm:radeon_postinit] registering secondary video headclass_device_add:class_idcard0
sysfs:create_dir: kobject *f5a56594, p dentry *f2e6fb80, nstr card0, d dentry *f2e47e34
[drm:radeon_need_reset] Memmode is 0, if zero needs reset
[drm] Debug messages ON
sysfs:create_dir: kobject *f8b3b154, p dentry *f7fc5280, nstr dri, d dentry *f2f33f44
sysfs:create_dir: kobject *f8b3b200, p dentry *f7fe6180, nstr r128, d dentry *f2f33f18
[drm:drm_probe]
[drm:r128_stub_register]
[drm:r128_stub_register] already registered [drm:r128_ctxbitmap_next]drm_ctxbitmap_nextbit : 0 [drm:r128_ctxbitmap_init]drm_ctxbitmap_init: 0
[drm] Initialized r128 2.5.0 20030725 on minor 1: ATI Rage 128 Pro PD (PCI)class_device_add:class_idcard1
sysfs:create_dir: kobject *f510e514, p dentry *00000000, nstr card1, d dentry *f2f33e34Unable to handle kernel NULL pointer dereference at virtual address 0000000c printing eip: c018d022 *pde = 00000000 Oops: 0000 [#1] CPU: 1 EIP: 0060:[<c018d022>] Not tainted EFLAGS: 00010282EIP is at
create_dir+0x3f/0xc2
eax:0000005bebx:f510e518ecx:c02f19b4edx:0000ee04
esi: 00000000 edi:f2f33e34ebp:f510e514esp:f2f33dfc
ds: 007b es: 007b ss: 0068
Process insmod (pid: 2772, threadinfoòf32000 taskõf29940)Stack: c02bd420 f510e514 00000000 f510e518 f2f33e34 f510e514 f510e514 c0327a40 f8b3b140 c018d10f f510e514 00000000 f510e518 f2f33e34 00000000 00000000 c01ba3dd f510e514 f510e514 f8b3b154 c01ba84d f510e514 00000000 f510e514 Call Trace: [<c018d10f>] sysfs_create_dir+0x40/0x73 [<c01ba3dd>] create_dir+0x1f/0x4b [<c01ba84d>] kobject_add+0x99/0x11c [<c0202046>] class_device_add+0x79/0x122 [<c0201fc0>] class_device_initialize+0x1d/0x2a [<c020250a>] simple_add_class_device+0x80/0xd7 [<f8b26d5e>] drm_probe+0x215/0x262 [r128] [<c01c4162>] pci_device_probe_static+0x52/0x63 [<c01c41ae>] __pci_device_probe+0x3b/0x4e [<c01c41ed>] pci_device_probe+0x2c/0x4a [<c0201463>] bus_match+0x3f/0x6a [<c0201575>] driver_attach+0x56/0x80 [<c02017f8>] bus_add_driver+0x8c/0x9f [<c01c43b9>] pci_register_driver+0x6c/0x94 [<f895b036>] drm_init+0x36/0x52 [r128] [<c0136083>] sys_init_module+0x11d/0x20e [<c010a84d>] sysenter_past_esp+0x52/0x71 Code: 8b 46 0c 8d 48 6c f0 ff 48 6c 0f 88 1b 03 00 00 89 34 24 89[root@smirl drm]#
==> Jon Smirl
[email protected]__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
Quoted 9 lines
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
==Jon Smirl
[email protected]
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 8 lines · Jon Smirl
The DRI drivers for each card type are indepenent from each other, but they all exist in the same sysfs class. Right now when I try to load a second driver I'm faulting in sysfs:create_dir with parent dentry NULL.
create_dir()is called viasimple_add_class_device(). Either driver loads standalone without problem.I suspect the fault is because each driver is registering it's own copy of the 'dri' class. Is there some mechanism to see if the class has already been registered and use the preexisting copy?
class_register()always returns 0.
Yes, you can't register two classes with the same name.
But that should have given you an error, care to fix that up and send me a patch?
thanks,
greg k-h
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel