[1.] One line summary of the problem: i8042 kernel module failed to load after unloading [2.] Full description of the problem/report: i8042 is compiled as dynamic module for the purpose of deactivation keyboard controller handling by i8042 and using alternative specialized kernel module instead The scenario works fine on 2.6.30 kernel (steps 3-7 could be repeated many times after boot) 1) i8042 is loaded at boot stage 2) boot procedure completes 3) i8042 is unloaded before starting usermode program /sys/devices/platform/i8042 directory disappeares 4) specialized kernel module is loaded to service usermode program 5) usermode program does its chores and exits 6) specialized kernel module is unloaded 7) i8042 is loaded to return system to the usual way of life /sys/devices/platform/i8042 directory appeares again After upgrade to 2.6.35.2 (also tested on 2.6.36-rc1) things went wrong: 1) i8042 is loaded at boot stage 2) boot procedure completes 3) i8042 is unloaded before starting usermode program rmmod psmouse rmmod atkbd rmmod libps2 rmmod i8042 !!! At this point /sys/devices/platform/i8042 directory DOES NOT disappeare Skipping steps 4,5,6 for the clarity of the experiment 7) trying to load i8042 again modprobe i8042 i8042 loading FAILES with the following error: Aug 17 20:05:42 localhost kernel: ------------[ cut here ]------------ Aug 17 20:05:42 localhost kernel: WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x5f/0x70() Aug 17 20:05:42 localhost kernel: Hardware name: VT8601 Aug 17 20:05:42 localhost kernel: sysfs: cannot create duplicate filename '/devices/platform/i8042' See full kernel error report below [3.] Keywords (i.e., modules, networking, kernel): modules i8042 sysfs [4.] Kernel version (from /proc/version): Linux version 2.6.35.2 (root@localhost.localdomain) (gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC) ) #1 SMP PREEMPT Mon Aug 16 16:29:03 MSD 2010 [5.] Output of Oops.. message (if applicable) with symbolic information resolved (see Documentation/oops-tracing.txt) /var/log/messages ------------------------ Aug 17 20:05:42 localhost kernel: PNP: PS/2 Controller [PNP0303] at 0x60,0x64 irq 1 Aug 17 20:05:42 localhost kernel: PNP: PS/2 appears to have AUX port disabled, if this is incorrect please boot with i8042.nopnp Aug 17 20:05:42 localhost kernel: ------------[ cut here ]------------ Aug 17 20:05:42 localhost kernel: WARNING: at fs/sysfs/dir.c:451 sysfs_add_one+0x5f/0x70() Aug 17 20:05:42 localhost kernel: Hardware name: VT8601 Aug 17 20:05:42 localhost kernel: sysfs: cannot create duplicate filename '/devices/platform/i8042' Aug 17 20:05:42 localhost kernel: Modules linked in: i8042(+) iptable_filter ip_tables 8139too pata_via libata [last unloaded: i8042] Aug 17 20:05:42 localhost kernel: Pid: 2025, comm: modprobe Not tainted 2.6.35.2 #1 Aug 17 20:05:42 localhost kernel: Call Trace: Aug 17 20:05:42 localhost kernel: [<c01272e2>] ? warn_slowpath_common+0x68/0x93 Aug 17 20:05:42 localhost kernel: [<c0127372>] ? warn_slowpath_fmt+0x28/0x2c Aug 17 20:05:42 localhost kernel: [<c01bac09>] ? sysfs_add_one+0x5f/0x70 Aug 17 20:05:42 localhost kernel: [<c01bb35a>] ? create_dir+0x53/0x83 Aug 17 20:05:42 localhost kernel: [<c01bb400>] ? sysfs_create_dir+0x76/0x8d Aug 17 20:05:42 localhost kernel: [<c02322b4>] ? kobject_add_internal+0xb5/0x14e Aug 17 20:05:42 localhost kernel: [<c023246c>] ? kobject_add+0x44/0x47 Aug 17 20:05:42 localhost kernel: [<c02b1491>] ? device_add+0x8e/0x45a Aug 17 20:05:42 localhost kernel: [<c02323c2>] ? kobject_set_name_vargs+0x45/0x4c Aug 17 20:05:42 localhost kernel: [<c02b4002>] ? platform_device_add+0xdf/0x11d Aug 17 20:05:42 localhost kernel: [<c02b41a2>] ? platform_create_bundle+0x65/0x93 Aug 17 20:05:42 localhost kernel: [<c816050f>] ? i8042_probe+0x0/0x58b [i8042] Aug 17 20:05:42 localhost kernel: [<c8160067>] ? i8042_init+0x0/0x332 [i8042] Aug 17 20:05:42 localhost kernel: [<c8160366>] ? i8042_init+0x2ff/0x332 [i8042] Aug 17 20:05:42 localhost kernel: [<c010112d>] ? do_one_initcall+0x44/0x120 Aug 17 20:05:42 localhost kernel: [<c014828a>] ? sys_init_module+0x77/0x193 Aug 17 20:05:42 localhost kernel: [<c041c635>] ? syscall_call+0x7/0xb Aug 17 20:05:42 localhost kernel: ---[ end trace 8636451dbd740ccc ]--- Aug 17 20:05:42 localhost kernel: kobject_add_internal failed for i8042 with -EEXIST, don't try to register things with the same name in the same directory. Aug 17 20:05:42 localhost kernel: Pid: 2025, comm: modprobe Tainted: G W 2.6.35.2 #1 Aug 17 20:05:42 localhost kernel: Call Trace: Aug 17 20:05:42 localhost kernel: [<c023233d>] ? kobject_add_internal+0x13e/0x14e Aug 17 20:05:42 localhost kernel: [<c023246c>] ? kobject_add+0x44/0x47 Aug 17 20:05:42 localhost kernel: [<c02b1491>] ? device_add+0x8e/0x45a Aug 17 20:05:42 localhost kernel: [<c02323c2>] ? kobject_set_name_vargs+0x45/0x4c Aug 17 20:05:42 localhost kernel: [<c02b4002>] ? platform_device_add+0xdf/0x11d Aug 17 20:05:42 localhost kernel: [<c02b41a2>] ? platform_create_bundle+0x65/0x93 Aug 17 20:05:42 localhost kernel: [<c816050f>] ? i8042_probe+0x0/0x58b [i8042] Aug 17 20:05:42 localhost kernel: [<c8160067>] ? i8042_init+0x0/0x332 [i8042] Aug 17 20:05:43 localhost kernel: [<c8160366>] ? i8042_init+0x2ff/0x332 [i8042] Aug 17 20:05:43 localhost kernel: [<c010112d>] ? do_one_initcall+0x44/0x120 Aug 17 20:05:43 localhost kernel: [<c014828a>] ? sys_init_module+0x77/0x193 Aug 17 20:05:43 localhost kernel: [<c041c635>] ? syscall_call+0x7/0xb ------------------------ [6.] A small shell script or example program which triggers the problem (if possible) ---------------- #!/bin/sh rmmod psmouse rmmod atkbd rmmod libps2 rmmod i8042 echo "Here comes the trouble (press any key)" read modprobe i8042 ---------------- [7.] Environment [7.1.] Software (add the output of the ver_linux script here) Linux localhost 2.6.35.2 #1 SMP PREEMPT Mon Aug 16 16:29:03 MSD 2010 i686 i686 i386 GNU/Linux Gnu C ./ver_linux: binutils 2.13.90.0.18 util-linux 2.11y mount support module-init-tools 3.6 e2fsprogs 1.41.4 Linux C Library 2.3.2 Dynamic linker (ldd) 2.3.2 Procps 3.2.7 Net-tools 1.60 Kbd 1.15 Sh-utils 4.5.3 Modules Loaded iptable_filter ip_tables 8139too pata_via libata [7.2.] Processor information (from /proc/cpuinfo): rocessor : 0 vendor_id : CentaurHauls cpu family : 6 model : 7 model name : VIA Samuel 2 stepping : 3 cpu MHz : 532.615 cache size : 64 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu de tsc msr cx8 mtrr pge mmx 3dnow up bogomips : 1065.23 clflush size : 32 cache_alignment : 32 address sizes : 32 bits physical, 32 bits virtual power management: [7.3.] Module information (from /proc/modules): psmouse 23896 0 - Live 0xc813e000 iptable_filter 1002 0 - Live 0xc812a000 ip_tables 8403 1 iptable_filter, Live 0xc811e000 8139too 16612 0 - Live 0xc8107000 pata_via 6440 3 - Live 0xc80af000 libata 127723 1 pata_via, Live 0xc8080000 atkbd 13678 0 - Live 0xc8033000 libps2 3684 2 psmouse,atkbd, Live 0xc8024000 i8042 12611 1 libps2, Live 0xc800f000 Kernel configuration (see attachment): kernel-config-2.6.30 kernel-config-2.6.35.2 kernel-config-2.6.36-rc1 linux-2.6.30/drivers/input/serio/i8042.c: static void __exit i8042_exit(void) { platform_device_unregister(i8042_platform_device); platform_driver_unregister(&i8042_driver); i8042_platform_exit(); panic_blink = NULL; } linux-2.6.35.2/drivers/input/serio/i8042.c: static void __exit i8042_exit(void) { platform_driver_unregister(&i8042_driver); platform_device_unregister(i8042_platform_device); i8042_platform_exit(); panic_blink = NULL; } The order of platform_driver_unregister(&i8042_driver) and platform_device_unregister(i8042_platform_device); has been changed Workaround: If i8042_exit() from the linux-2.6.35.2drivers/input/serio/i8042.c modified as it was done in 2.6.30 kernel: first called platform_device_unregister() and then platform_driver_unregister() everything start to work in fine 2.6.32.5 as it was in 2.6.30 kernel
Created attachment 27487 [details] 2.6.30 kernel config (kernel which works fine)
Created attachment 27488 [details] 2.6.35.2 kernel config (kernel which works bad)
Created attachment 27489 [details] 2.6.36-rc1 kernel config (kernel which works bad)
On Mon, 30 Aug 2010 09:13:04 +0400 Victor Seryodkin <vvscore@gmail.com> wrote: > Verifying: the bug is still actual >
Hmm, it the order of unregistering devices and drivers should not matter, need to look into drivers/base/platform.c
Ah, nevermind, i8042_remove() resets i8042_platform_device and so platform_device_unregister(i8042_platform_device); does not do anything.
Created attachment 28731 [details] Fix device removal on unload This should fix the issue.
(In reply to comment #7) > Created an attachment (id=28731) [details] > Fix device removal on unload > > This should fix the issue. With this correction i8042 driver reload works properly.
Patch : https://bugzilla.kernel.org/attachment.cgi?id=28731 Handled-By : Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixed by commit af045b86662f17bf130239a65995c61a34f00a6b .