Subject: [mac80211_hwsim] WARNING: at include/linux/kref.h:42 kobject_get()

From: Fengguang Wu <[email-masked]>
Date: Mon, 8 Sep 2014 18:32:34 +0800

Hi Martin,

FYI, new WARNING and kernel panic shows up after this patch. It may
not be the root cause, because before patch, there are boot hangs
(which I'll continue bisect). But if you happen to know how it comes
about, it would be great!

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
commit 9ea927748ced4953f1e9a0f1fa1fdeacd1018b4e
Author:     Martin Pitt <[email-masked]>
AuthorDate: Mon Apr 8 11:30:01 2013 +0200
Commit:     Johannes Berg <[email-masked]>
CommitDate: Wed Apr 10 20:23:50 2013 +0200

    mac80211_hwsim: Register and bind to driver
    
    Properly register our mac80211_hwsim_driver, attach it to the platform bus.
    Bind newly created hwsim devices to that driver, so that our wlan devices get
    a proper "driver" sysfs attribute.
    
    This makes mac80211_hwsim interfaces work with NetworkManager.
    
    Signed-off-by: Martin Pitt <[email-masked]>
    [fix an old and a new message to not be line-broken,
     also fix the driver_register error path]
    Signed-off-by: Johannes Berg <[email-masked]>

===================================================
PARENT COMMIT NOT CLEAN. LOOK OUT FOR WRONG BISECT!
===================================================
Attached dmesg for the parent commit, too, to help confirm whether it is a noise error.
Also attached a dmesg for next-20140905.

+------------------------------------------------------+------------+------------+---------------+
|                                                      | ddc4db2e3d | 9ea927748c | next-20140905 |
+------------------------------------------------------+------------+------------+---------------+
| boot_successes                                       | 0          | 0          | 0             |
| boot_failures                                        | 60         | 20         | 11            |
| BUG:kernel_boot_hang                                 | 60         | 0          | 1             |
| WARNING:at_include/linux/kref.h:kobject_get()        | 0          | 20         | 10            |
| INFO:trying_to_register_non-static_key               | 0          | 20         |               |
| BUG:unable_to_handle_kernel_NULL_pointer_dereference | 0          | 20         |               |
| Oops                                                 | 0          | 20         |               |
| EIP_is_at_mutex_lock_nested                          | 0          | 20         |               |
| Kernel_panic-not_syncing:Fatal_exception             | 0          | 20         |               |
| backtrace:driver_unregister                          | 0          | 20         |               |
| backtrace:init_mac80211_hwsim                        | 0          | 20         | 10            |
| backtrace:kernel_init_freeable                       | 0          | 20         | 10            |
| WARNING:at_kernel/locking/lockdep.c:__lock_acquire() | 0          | 0          | 10            |
| INFO:task_blocked_for_more_than_seconds              | 0          | 0          | 10            |
| INFO:lockdep_is_turned_off                           | 0          | 0          | 10            |
| Kernel_panic-not_syncing:hung_task:blocked_tasks     | 0          | 0          | 10            |
| backtrace:platform_driver_unregister                 | 0          | 0          | 10            |
| backtrace:watchdog                                   | 0          | 0          | 10            |
+------------------------------------------------------+------------+------------+---------------+

[    2.008328] mac80211_hwsim: ieee80211_register_hw failed (-2)
[    2.009770] ------------[ cut here ]------------
[    2.009770] ------------[ cut here ]------------
[    2.010962] WARNING: at include/linux/kref.h:42 kobject_get+0x2f/0x40()
[    2.010962] WARNING: at include/linux/kref.h:42 kobject_get+0x2f/0x40()
[    2.012978] Hardware name: Standard PC (i440FX + PIIX, 1996)
[    2.012978] Hardware name: Standard PC (i440FX + PIIX, 1996)
[    2.014327] Pid: 1, comm: swapper Not tainted 3.9.0-rc1-00122-g9ea92774 #8
[    2.014327] Pid: 1, comm: swapper Not tainted 3.9.0-rc1-00122-g9ea92774 #8
[    2.015959] Call Trace:
[    2.015959] Call Trace:
[    2.016557]  [<7825c682>] warn_slowpath_common+0x62/0x90
[    2.016557]  [<7825c682>] warn_slowpath_common+0x62/0x90
[    2.017839]  [<783688ff>] ? kobject_get+0x2f/0x40
[    2.017839]  [<783688ff>] ? kobject_get+0x2f/0x40
[    2.018986]  [<783688ff>] ? kobject_get+0x2f/0x40
[    2.018986]  [<783688ff>] ? kobject_get+0x2f/0x40
[    2.032652]  [<7825c74d>] warn_slowpath_null+0x1d/0x20
[    2.032652]  [<7825c74d>] warn_slowpath_null+0x1d/0x20
[    2.033885]  [<783688ff>] kobject_get+0x2f/0x40
[    2.033885]  [<783688ff>] kobject_get+0x2f/0x40
[    2.034980]  [<7844392f>] get_device+0xf/0x20
[    2.034980]  [<7844392f>] get_device+0xf/0x20
[    2.036027]  [<78446ead>] driver_detach+0x1d/0xa0
[    2.036027]  [<78446ead>] driver_detach+0x1d/0xa0
[    2.037166]  [<78445afc>] bus_remove_driver+0x6c/0xe0
[    2.037166]  [<78445afc>] bus_remove_driver+0x6c/0xe0
[    2.038378]  [<78447a05>] ? class_unregister+0x55/0x80
[    2.038378]  [<78447a05>] ? class_unregister+0x55/0x80
[    2.039602]  [<784473f9>] driver_unregister+0x49/0x80
[    2.039602]  [<784473f9>] driver_unregister+0x49/0x80
[    2.053176]  [<78cf3d1f>] init_mac80211_hwsim+0x83b/0x849
[    2.053176]  [<78cf3d1f>] init_mac80211_hwsim+0x83b/0x849
[    2.054480]  [<78cf34e4>] ? if_spi_init_module+0xa1/0xa1
[    2.054480]  [<78cf34e4>] ? if_spi_init_module+0xa1/0xa1
[    2.055752]  [<78cd49a2>] do_one_initcall+0x6a/0x10d
[    2.055752]  [<78cd49a2>] do_one_initcall+0x6a/0x10d
[    2.056947]  [<78cd4b25>] kernel_init_freeable+0xe0/0x153
[    2.056947]  [<78cd4b25>] kernel_init_freeable+0xe0/0x153
[    2.058242]  [<78846bdb>] kernel_init+0xb/0x140
[    2.058242]  [<78846bdb>] kernel_init+0xb/0x140
[    2.059341]  [<788528fb>] ret_from_kernel_thread+0x1b/0x30
[    2.059341]  [<788528fb>] ret_from_kernel_thread+0x1b/0x30
[    2.073480]  [<78846bd0>] ? rest_init+0xb0/0xb0
[    2.073480]  [<78846bd0>] ? rest_init+0xb0/0xb0
[    2.074583] ---[ end trace d404f50b9a11934d ]---
[    2.074583] ---[ end trace d404f50b9a11934d ]---

git bisect start v3.10 v3.9 --
git bisect  bad ff89acc563a0bd49965674f56552ad6620415fe2  # 11:50      0-     20  Merge branch 'rcu/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
git bisect  bad 24d0c2542b38963ae4d5171ecc0a2c1326c656bc  # 11:56      0-     20  Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
git bisect good 151173e8ce9b95bbbbd7eedb9035cfaffbdb7cb2  # 12:09     20+     20  Merge tag 'for-v3.10' of git://git.infradead.org/battery-2.6
git bisect  bad e95893004104054d49406fd108fefa3ddc054366  # 12:19      0-     20  Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
git bisect good 8a72f3820c4d14b27ad5336aed00063a7a7f1bef  # 12:38     20+     20  Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile
git bisect  bad 600fe9751aeb6f6b72de84076a05c5b8c04152c0  # 12:41      0-      8  ipc_schedule_free() can do vfree() directly now
git bisect  bad 126de6b20bfb82cc19012d5048f11f339ae5a021  # 12:44      0-     17  linkage.h: fix build breakage due to symbol prefix handling
git bisect good 251df49db3327c64bf917bfdba94491fde2b4ee0  # 13:01     20+     20  Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
git bisect  bad 73287a43cc79ca06629a88d1a199cd283f42456a  # 13:06      0-      2  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
git bisect good 953c96e0d85615d1ab1f100e525d376053294dc2  # 13:20     20+     20  tg3: Use bool not int
git bisect  bad 4fc4118cdb29ab946b8a586fc766ebb6ae1e1c90  # 13:22      0-     20  wil6210: more Rx descriptor accessor functions
git bisect good e73dcfbf061b524fe9aaef56cf3c2e234a45ec19  # 13:37     20+     20  Bluetooth: hidp: fix sending output reports on intr channel
git bisect good d5590bba37f3c7d496195648532d5313abb43891  # 14:05     20+     20  NFC: pn533: Re-group fields in struct pn533
git bisect  bad 06d961a8e210035bff7e82f466107f9ab4a8fd94  # 14:08      0-     20  mac80211/minstrel: use the new rate control API
git bisect  bad 97990a060e6757f48b931a3946b17c1c4362c3fb  # 14:10      0-     20  nl80211: allow using wdev identifiers to get scan results
git bisect  bad 85220d71bf3ca1ba9129e0744247ae5f61bec559  # 14:13      0-     20  mac80211: support secondary channel offset in CSA
git bisect  bad 0ca54f6c5fd4ce58aa044d1fc7f00d7f6cf2801c  # 14:15      0-     20  mac80211: provide SSID in IBSS mode
git bisect  bad 3088f7d2db42925808c4b43a6258647ee4d1dd5f  # 14:18      0-     20  mac80211: stringify another plink state
git bisect  bad 9d6d6f4924133567a108a862d9cf949cd03f71cb  # 14:20      0-     20  mac80211: unset FC retry bit in mesh fwding path
git bisect  bad 9ea927748ced4953f1e9a0f1fa1fdeacd1018b4e  # 14:23      0-     20  mac80211_hwsim: Register and bind to driver
# first bad commit: [9ea927748ced4953f1e9a0f1fa1fdeacd1018b4e] mac80211_hwsim: Register and bind to driver
git bisect good ddc4db2e3d5393ede7a9222bb3b7522a603a4678  # 14:37     60+     60  mac80211: make ieee802_11_parse_elems an inline
git bisect  bad 92d88cb068a5dc66d53ef017999b2419b125f764  # 14:37      0-     11  Add linux-next specific files for 20140905
git bisect  bad 92d88cb068a5dc66d53ef017999b2419b125f764  # 14:40      0-     11  Add linux-next specific files for 20140905

This script may reproduce the error.

----------------------------------------------------------------------------
#!/bin/bash

kernel=$1
initrd=quantal-core-i386.cgz

wget --no-clobber https://github.com/fengguang/reproduce-kernel-bug/raw/master/initrd/$initrd

kvm=(
	qemu-system-x86_64
	-cpu kvm64
	-enable-kvm
	-kernel $kernel
	-initrd $initrd
	-m 320
	-smp 2
	-net nic,vlan=1,model=e1000
	-net user,vlan=1
	-boot order=nc
	-no-reboot
	-watchdog i6300esb
	-rtc base=localtime
	-serial stdio
	-display none
	-monitor null 
)

append=(
	hung_task_panic=1
	earlyprintk=ttyS0,115200
	debug
	apic=debug
	sysrq_always_enabled
	rcupdate.rcu_cpu_stall_timeout=100
	panic=-1
	softlockup_panic=1
	nmi_watchdog=panic
	oops=panic
	load_ramdisk=2
	prompt_ramdisk=0
	console=ttyS0,115200
	console=tty0
	vga=normal
	root=/dev/ram0
	rw
	drbd.minor_count=8
)

"${kvm[@]}" --append "${append[*]}"
----------------------------------------------------------------------------

Thanks,
Fengguang
_______________________________________________
LKP mailing list
[email-masked]