linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* registering same sysfs class in different drivers.
@ 2004-01-16  6:42 Jon Smirl
  2004-01-16 19:51 ` Jon Smirl
  2004-01-17  0:09 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Jon Smirl @ 2004-01-16  6:42 UTC (permalink / raw)
  To: linux-hotplug

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 head
class_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
jonsmirl@yahoo.com

__________________________________
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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: registering same sysfs class in different drivers.
  2004-01-16  6:42 registering same sysfs class in different drivers Jon Smirl
@ 2004-01-16 19:51 ` Jon Smirl
  2004-01-17  0:09 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Jon Smirl @ 2004-01-16 19:51 UTC (permalink / raw)
  To: linux-hotplug

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.

--- Jon Smirl <jonsmirl@yahoo.com> wrote:
> 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 head
> class_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
> jonsmirl@yahoo.com
> 
> __________________________________
> 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
> Linux-hotplug-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel


==Jon Smirl
jonsmirl@yahoo.com

__________________________________
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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: registering same sysfs class in different drivers.
  2004-01-16  6:42 registering same sysfs class in different drivers Jon Smirl
  2004-01-16 19:51 ` Jon Smirl
@ 2004-01-17  0:09 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2004-01-17  0:09 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Jan 15, 2004 at 10:42:33PM -0800, Jon Smirl wrote:
> 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.

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
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-01-17  0:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-16  6:42 registering same sysfs class in different drivers Jon Smirl
2004-01-16 19:51 ` Jon Smirl
2004-01-17  0:09 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).