Kernel BUG at fs/sysfs/file.c:552
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
I wrote a little kernel module (a "virtual char-device") and wanted to create a sysfs entry for my device under /sys/devices. When using "device_register" and "device_create_file", I get the following kernel BUG message (and the module stops loading): (Kernel is 2.6.24.4)
- ------------[ cut here ]------------
kernel BUG at fs/sysfs/file.c:552!
invalid opcode: 0000 [#1] SMP
Modules linked in: vdd nvidia(P) fuse kqemu snd_hda_intel snd_pcm_oss
snd_mixer_oss snd_pcm i2c_i801 snd_timer snd_page_alloc snd_hwdep i2c_core usb_storage rtc snd intel_agp agpgart evdev
Pid: 22769, comm: modprobe Tainted: P (2.6.24.4 #1)
EIP: 0060:[<c0195c9d>] EFLAGS: 00010246 CPU: 0
EIP is at sysfs_create_file+0xf/0x1d
EAX: 00000000 EBX: f8875a08 ECX: c048663d EDX: f8875b28
ESI: f8875b28 EDI: 00000000 EBP: f8875b40 ESP: e2981e9c
DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process modprobe (pid: 22769, ti=e2980000 task=e28caff0 task.ti=e2980000)
Stack: c026c66f 00000000 00000001 00000001 f8ddf0ee f88752a8 0fd00000
e2968540
c013d930 00000000 00000000 00000000 00000000 000008c6 000000d7
b7e7c000
00000348 00000200 00000000 f8ddc798 f8ddc794 00000000 00000000
00000000
Call Trace:
[<c026c66f>] device_create_file+0x1c/0x2b
[<f8ddf0ee>] vdd_init+0xee/0x100 [vdd]
[<c013d930>] sys_init_module+0x154d/0x1605
[<c026c307>] device_remove_file+0x0/0x25
[<c0103df6>] sysenter_past_esp+0x5f/0x85
=======================
Code: 11 f0 ff 0e 0f 94 c0 84 c0 74 07 89 f0 e8 5e 06 00 00 83 c4 10 89f8 5b 5e 5f 5d c3 85 c0 74 0b 8b 40 1c 85 c0 74 04 85 d2 75 04 <0f> 0b eb fe b9 02 00 00 00 e9 79 ff ff ff 57 89 cf 56 89 d6 53
EIP: [<c0195c9d>] sysfs_create_file+0xf/0x1d SS:ESP 0068:e2981e9c
- ---[ end trace 4f3d020112c37b18 ]---
I also have another question according to module loading/unloading:
I've set the kernel option 'CONFIG_MODULE_FORCE_UNLOAD', but after above mentioned bug, the module stopped loading and it's use count (according to lsmod) is 1 and I cannot unload it (and I thought "forced unloading" does just that) - are there other any "tricks" how I can unload such a "stuck in loading" module?
regards
Marcus Nutzinger
PS: please CC answers to me since I'm not subscribed to this list. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFH/M22eEFjZ1Jaui4RAt9/AKC9AV3Jp5UZvGi7oiGeYPWAXbfMvACcDp5y wWylWxgtOLcShw8+rlkbApE=
=2NzF
-----END PGP SIGNATURE-----
Quoted 8 lines · Marcus Nutzinger
Hi!
I wrote a little kernel module (a "virtual char-device") and wanted to create a sysfs entry for my device under
/sys/devices. When using "device_register" and "device_create_file", I get the following kernel BUG message (and the module stops loading): (Kernel is 2.6.24.4)
Quoted 8 lines
------------[ cut here ]------------ kernel BUG at fs/sysfs/file.c:552! invalid opcode: 0000 [#1] SMP Modules linked in: vdd nvidia(P) fuse kqemu snd_hda_intel snd_pcm_oss
snd_mixer_osssnd_pcmi2c_i801snd_timersnd_page_allocsnd_hwdepi2c_coreusb_storagertc sndintel_agpagpgart evdevPid: 22769, comm: modprobe Tainted: P (2.6.24.4 #1)
With the nvidia driver, you're not going to get much help on this list :(
Quoted 2 lines
EIP: 0060:[<c0195c9d>] EFLAGS: 00010246 CPU: 0
EIP is atsysfs_create_file+0xf/0x1d
Hm, did you create two files with the same name?
Care to post your code?
thanks,
greg k-h
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 2 lines
With the nvidia driver, you're not going to get much help on this list :(
Well I don't like the driver either but the problem is really totally unrealted I think..
Quoted 1 line
Hm, did you create two files with the same name?
No I only wanted to create one file on the first try, just to test the sysfs interface. It should only give an attribute under /sys/devices, called "writer_pid", which prints 0 or an actual PID of a process writing to my virtual device.
I've just tried some other stuff just this minute and now it seems to work, I get a directory under /sys/devices! Unfortunately I can't say what the real problem was and why this kernel bug occured...
But I've another question: This directory doesn't only contain the attribute ("writer_pid") which I've created in the code, but also a subdirectory "power" and another attribute "uevent".. Could you explain to me what's this all about? Are these just standard attributes which are added to every device which registers there? (Sounds obviousely because other directories under my /sys/devices tree contain them too..).
Quoted 1 line
Care to post your code?
I've uploaded it to http://www.nuuz.at/temp/vdd.c. I didn't want to post the whole code here, I hope that's ok!
thanks for replying,
regards
Marcus Nutzinger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIANFMeEFjZ1Jaui4RAlbfAJ9XzbidhogUUMexqhuc/YPMzIaAjgCdGEtA 0NtTj7FkOfpaYdXQZklTlf0=
=FmIo
-----END PGP SIGNATURE-----