Bug 58401

Summary: poweroff failure in HP Elitebook 6930p
Product: Drivers Reporter: Iru Cai (mytbk920423)
Component: Platform_x86Assignee: drivers_platform_x86 (drivers_platform_x86)
Status: CLOSED CODE_FIX    
Severity: normal CC: tianyu.lan
Priority: P1    
Hardware: x86-64   
OS: Linux   
URL: https://bugs.archlinux.org/task/35237
Kernel Version: 3.9.2 Subsystem:
Regression: Yes Bisected commit-id:

Description Iru Cai 2013-05-17 14:45:47 UTC
I'm using an HP Elitebook 6930p. After I installed the 3.9.2 kernel, the system cannot poweroff, and hangs after all filesystems unmounted. After I unset HP_WMI and rebuilt the kernel, the system can poweroff.
Comment 1 Iru Cai 2013-05-17 14:47:48 UTC
First submitted to archlinux bug tracker.
https://bugs.archlinux.org/task/35237
Comment 2 Lan Tianyu 2013-05-17 15:14:19 UTC
Hi:
   Could you do a bisect to find which commit cause this bug? BTW, since the system can power off if not load HP_WMI driver. This should be a HP platform driver bug so reassign to platform/x86 category.
Comment 3 Iru Cai 2013-05-20 15:10:43 UTC
I did a bisect and found this.

commit 4fca7ce39f57517a31c911d8f66931355a39457e
Author: Trepák Vilmos <trepo@netcomga.sk>
Date:   Thu Oct 11 12:51:00 2012 +0200

    Platform: hp-wmi: add rfkill support for integrated GPS
    
    Add rfkill support for the GPS radio found in HP laptops (HP Elitebook 2170p and the like)
    using the Ericsson F5321/H5321 Mobile Broadband Module.
    
    Signed-off-by: Viliam Trepák <trepo@netcomga.sk>
    Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>

That explains why this bug happens with the following:
[    9.460915] ------------[ cut here ]------------
[    9.460949] kernel BUG at net/rfkill/core.c:244!
[    9.460979] invalid opcode: 0000 [#1] PREEMPT SMP 
[    9.461020] Modules linked in: psmouse ppdev hp_wmi(+) serio_raw pcspkr sparse_keymap iwldvm(+) snd_hda_codec_analog mac80211 pcmcia lpc_ich snd_hda_intel iwlwifi yenta_socket snd_hda_codec pcmcia_rsrc e1000e snd_hwdep pcmcia_core acpi_cpufreq cfg80211 mperf snd_pcm rfkill snd_page_alloc snd_timer snd soundcore parport_pc parport wmi hp_accel thermal ac ptp pps_core battery processor mei lis3lv02d input_polldev evdev btrfs crc32c libcrc32c xor zlib_deflate raid6_pq sd_mod sdhci_pci sdhci mmc_core firewire_ohci firewire_core crc_itu_t ata_piix uhci_hcd ehci_pci ehci_hcd ata_generic pata_acpi libata usbcore usb_common scsi_mod i915 video button i2c_algo_bit intel_agp intel_gtt drm_kms_helper drm i2c_core
[    9.461621] CPU 1 
[    9.461636] Pid: 162, comm: systemd-udevd Not tainted 3.9.2-1-ARCH #1 Hewlett-Packard HP EliteBook 6930p/30DB
[    9.461694] RIP: 0010:[<ffffffffa05c57af>]  [<ffffffffa05c57af>] rfkill_set_hw_state+0x9f/0xb0 [rfkill]
[    9.461755] RSP: 0018:ffff880071523b60  EFLAGS: 00010246
[    9.461788] RAX: 0000000000000001 RBX: 0000000000000000 RCX: 0000000000000018
[    9.461829] RDX: 000000000003b3c1 RSI: 0000000000000001 RDI: 0000000000000000
[    9.461870] RBP: ffff880071523b80 R08: 0000000000016fa0 R09: ffff880077696fa0
[    9.461911] R10: ffffea0001c5a680 R11: ffffffffa088a0ee R12: ffff88007166c410
[    9.461952] R13: ffff88007166c400 R14: 0000000000000000 R15: ffffffffa088b560
[    9.461993] FS:  00007f438a198780(0000) GS:ffff880077680000(0000) knlGS:0000000000000000
[    9.462040] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    9.462074] CR2: 00007f438a162d1f CR3: 000000007172d000 CR4: 00000000000407e0
[    9.462115] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[    9.462155] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[    9.462197] Process systemd-udevd (pid: 162, threadinfo ffff880071522000, task ffff88007175d3c0)
[    9.462246] Stack:
[    9.462261]  0000000000000000 ffff88007166c410 ffff88007166c400 0000000000000000
[    9.462317]  ffff880071523bb0 ffffffffa088d25a 0c0e0f69000000cf ffff88007166c410
[    9.462373]  ffffffffa088b428 ffff88007166c400 ffff880071523be0 ffffffff8135978c
[    9.462428] Call Trace:
[    9.462449]  [<ffffffffa088d25a>] hp_wmi_bios_setup+0x25a/0x3a0 [hp_wmi]
[    9.462493]  [<ffffffff8135978c>] platform_drv_probe+0x3c/0x70
[    9.462530]  [<ffffffff81356d6a>] ? driver_sysfs_add+0x7a/0xb0
[    9.462566]  [<ffffffff81357407>] driver_probe_device+0x87/0x3a0
[    9.462603]  [<ffffffff813577f3>] __driver_attach+0x93/0xa0
[    9.462636]  [<ffffffff81357760>] ? __device_attach+0x40/0x40
[    9.462671]  [<ffffffff81355403>] bus_for_each_dev+0x63/0xa0
[    9.462707]  [<ffffffff81356e8e>] driver_attach+0x1e/0x20
[    9.462740]  [<ffffffff81356a28>] bus_add_driver+0x1f8/0x2b0
[    9.462775]  [<ffffffff81357e81>] driver_register+0x71/0x150
[    9.462810]  [<ffffffff813594e6>] platform_driver_register+0x46/0x50
[    9.462849]  [<ffffffff813595ab>] platform_driver_probe+0x1b/0xa0
[    9.462886]  [<ffffffffa088d55e>] hp_wmi_init+0x1be/0x1fb [hp_wmi]
[    9.462925]  [<ffffffffa088d3a0>] ? hp_wmi_bios_setup+0x3a0/0x3a0 [hp_wmi]
[    9.462967]  [<ffffffff8100210a>] do_one_initcall+0x10a/0x160
[    9.463004]  [<ffffffff810bdac6>] load_module+0x1b46/0x2640
[    9.463038]  [<ffffffff8128da20>] ? ddebug_proc_write+0xf0/0xf0
[    9.463076]  [<ffffffff810be662>] sys_init_module+0xa2/0xf0
[    9.463111]  [<ffffffff814d975d>] system_call_fastpath+0x1a/0x1f
[    9.463146] Code: 48 ff ff ff 80 7b 24 00 74 d2 41 83 e5 01 45 38 ec 74 c9 48 8d bb a0 03 00 00 e8 ed fb aa e0 5b 41 5c 41 5d 44 89 f0 41 5e 5d c3 <0f> 0b 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 
[    9.463479] RIP  [<ffffffffa05c57af>] rfkill_set_hw_state+0x9f/0xb0 [rfkill]
[    9.463526]  RSP <ffff880071523b60>
[    9.463562] ---[ end trace b8ca722a5b62f270 ]---
Comment 4 Iru Cai 2013-05-20 15:14:47 UTC
Well, this commit date is very old, but that's what the bisect found and it seems reasonable to explain this bug.
Comment 5 Iru Cai 2013-05-21 10:27:38 UTC
(In reply to comment #2)
> Hi:
>    Could you do a bisect to find which commit cause this bug? BTW, since the
> system can power off if not load HP_WMI driver. This should be a HP platform
> driver bug so reassign to platform/x86 category.

So how did hp-wmi cause the bug after rfkill support for GPS was added?
Comment 6 Lan Tianyu 2013-05-21 14:03:38 UTC
Please try the following patch.

diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
index 45cacf7..9b60282 100644
--- a/drivers/platform/x86/hp-wmi.c
+++ b/drivers/platform/x86/hp-wmi.c
@@ -680,7 +680,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device)
                }
                rfkill_init_sw_state(gps_rfkill,
                                     hp_wmi_get_sw_state(HPWMI_GPS));
-               rfkill_set_hw_state(bluetooth_rfkill,
+               rfkill_set_hw_state(gps_rfkill,
                                    hp_wmi_get_hw_state(HPWMI_GPS));
                err = rfkill_register(gps_rfkill);
                if (err)
Comment 7 Iru Cai 2013-05-22 05:11:01 UTC
(In reply to comment #6)
> Please try the following patch.
> 
> diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
> index 45cacf7..9b60282 100644
> --- a/drivers/platform/x86/hp-wmi.c
> +++ b/drivers/platform/x86/hp-wmi.c
> @@ -680,7 +680,7 @@ static int hp_wmi_rfkill_setup(struct platform_device
> *device)
>                 }
>                 rfkill_init_sw_state(gps_rfkill,
>                                      hp_wmi_get_sw_state(HPWMI_GPS));
> -               rfkill_set_hw_state(bluetooth_rfkill,
> +               rfkill_set_hw_state(gps_rfkill,
>                                     hp_wmi_get_hw_state(HPWMI_GPS));
>                 err = rfkill_register(gps_rfkill);
>                 if (err)

I edited hp-wmi.c as the patch said, and the kernel is ok now.
Comment 8 Lan Tianyu 2013-05-22 05:25:47 UTC
Ok. I will send this patch to platform/x86 maillist.
Comment 9 Iru Cai 2013-05-25 12:15:17 UTC
(In reply to comment #8)
> Ok. I will send this patch to platform/x86 maillist.

So when will the patch applied to the kernel? I saw linux 3.9.4 still hasn't fixed it.
Comment 10 Lan Tianyu 2013-06-08 02:06:10 UTC
The patch has been merged into linux upstream and 3.9-stable tree.

From af1d486c18bad7820b0ca52b413458914231102c Mon Sep 17 00:00:00 2001
From: "lan,Tianyu" <tianyu.lan@intel.com>
Date: Tue, 28 May 2013 02:25:33 +0000
Subject: x86 / platform / hp_wmi: Fix bluetooth_rfkill misuse in hp_wmi_rfkill_setup()

From: "lan,Tianyu" <tianyu.lan@intel.com>

commit af1d486c18bad7820b0ca52b413458914231102c upstream.

HP wmi platform driver fails to initialize GPS and causes poweroff
failure in HP Elitebook 6930p.