Skip to contentSkip to conversation

sony-laptop crash (Sony VPC SE 1V9E) for 3.8.0+

DISCUSSION Marco Krüger 2 participants 10 messages Aug 4, 2013 – Sep 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hey Mattia,

since the kernel 3.8.0 (commit: 23caaeea271cfe3176f0e27374d2016bd7583ea8) the sony-laptop module chrashes for me. Initially reported to the Arch Linux Bugtracker [1]. Link [2] lists full module output with enabled debug parameter.

Thanks!

[  171.492147] ------------[ cut here ]------------
[  171.492151] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xa5/0xd0()
[  171.492153] sysfs: cannot create duplicate filename '/devices/platform/sony-laptop/kbd_backlight'
[  171.492154] Modules linked in: sony_laptop(+) tun fuse joydev nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack iptable_filter ip_tables x_tables tpm_infineon arc4 intel_powerclamp coretemp iwldvm crc32_pclmul iTCO_wdt crc32c_intel iTCO_vendor_support ghash_clmulni_intel mac80211 aesni_intel aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd iwlwifi microcode rtsx_pci_ms snd_hda_codec_hdmi memstick cfg80211 rfkill snd_hda_codec_realtek thermal i915 snd_hda_intel button battery intel_agp snd_hda_codec intel_gtt mperf drm_kms_helper snd_hwdep psmouse snd_pcm tpm_tis drm tpm snd_page_alloc snd_timer tpm_bios i2c_i801 snd i2c_algo_bit ac mei_me video serio_raw soundcore evdev lpc_ich mei i2c_core processor pcspkr ext4 crc16 mbcache jbd2 sd_mod rtsx_pci_sdmmc mmc_core ahci libah
ci libata
[  171.492192]  ehci_pci xhci_hcd ehci_hcd scsi_mod rtsx_pci usbcore usb_common
[  171.492197] CPU: 0 PID: 643 Comm: modprobe Not tainted 3.10.3-1-ARCH #1
[  171.492198] Hardware name: Sony Corporation VPCSE1V9E/VAIO, BIOS R2087H4 06/15/2012
[  171.492200]  0000000000000009 ffff88022cefda20 ffffffff814bd2df ffff88022cefda58
[  171.492202]  ffffffff81055881 00000000ffffffef ffff88022cea52a0 ffff88022cefdb00
[  171.492204]  ffff88022cf50000 00000000000001a4 ffff88022cefdab8 ffffffff810558ec
[  171.492205] Call Trace:
[  171.492210]  [<ffffffff814bd2df>] dump_stack+0x19/0x1b
[  171.492213]  [<ffffffff81055881>] warn_slowpath_common+0x61/0x80
[  171.492214]  [<ffffffff810558ec>] warn_slowpath_fmt+0x4c/0x50
[  171.492216]  [<ffffffff811fc925>] sysfs_add_one+0xa5/0xd0
[  171.492219]  [<ffffffff811fbaf7>] sysfs_add_file_mode+0x97/0xe0
[  171.492221]  [<ffffffff811fbb6a>] sysfs_create_file+0x2a/0x30
[  171.492223]  [<ffffffff8134ea0d>] device_create_file+0x3d/0xa0
[  171.492228]  [<ffffffffa06c4ea4>] sony_nc_add+0xd54/0x10fc [sony_laptop]
[  171.492230]  [<ffffffff811fd2dc>] ? sysfs_do_create_link_sd+0xcc/0x220
[  171.492234]  [<ffffffff812d6449>] acpi_device_probe+0x4e/0xfe
[  171.492237]  [<ffffffff813535f7>] driver_probe_device+0x87/0x3a0
[  171.492238]  [<ffffffff813539e3>] __driver_attach+0x93/0xa0
[  171.492240]  [<ffffffff81353950>] ? __device_attach+0x40/0x40
[  171.492242]  [<ffffffff813515b3>] bus_for_each_dev+0x63/0xa0
[  171.492245]  [<ffffffff8135306e>] driver_attach+0x1e/0x20
[  171.492247]  [<ffffffff81352c08>] bus_add_driver+0x1e8/0x2a0
[  171.492249]  [<ffffffffa04c3000>] ? 0xffffffffa04c2fff
[  171.492251]  [<ffffffff81354071>] driver_register+0x71/0x150
[  171.492253]  [<ffffffffa04c3000>] ? 0xffffffffa04c2fff
[  171.492255]  [<ffffffff812d69b3>] acpi_bus_register_driver+0x3b/0x43
[  171.492258]  [<ffffffffa04c3059>] sony_laptop_init+0x59/0x8e [sony_laptop]
[  171.492261]  [<ffffffff810020e2>] do_one_initcall+0xe2/0x190
[  171.492263]  [<ffffffff810bc38d>] load_module+0x1b6d/0x2610
[  171.492265]  [<ffffffff8128aeb0>] ? ddebug_proc_write+0xf0/0xf0
[  171.492268]  [<ffffffff81158af2>] ? vmap_page_range_noflush+0x262/0x370
[  171.492271]  [<ffffffff810bced2>] SyS_init_module+0xa2/0xf0
[  171.492273]  [<ffffffff814ca75d>] system_call_fastpath+0x1a/0x1f
[  171.492274] ---[ end trace 508654f1445b738e ]---

[1] https://bugs.archlinux.org/task/35184
[2] https://bugs.archlinux.org/task/35184?getfile=10828

maintainer
#1 lore raw
Quoted 8 lines · Marco Krüger

Hey Mattia,

since the kernel 3.8.0 (commit:
23caaeea271cfe3176f0e27374d2016bd7583ea8) the sony-laptop module chrashes for me.
Initially reported to the Arch Linux Bugtracker [1]. Link [2] lists full module output with enabled debug parameter.

Quoted 5 lines

Thanks!

[  171.492147] ------------[ cut here ]------------
[  171.492151] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xa5/0xd0()
[  171.492153] sysfs: cannot create duplicate filename '/devices/platform/sony-laptop/kbd_backlight'

So you seem to have both these that cause the above sysfs to be attempted to be added twice
case 0x0143:
case 0x014b:

Could you send your DSDT?

Signature · 2 lines
mattia
:wq!
#2 lore raw

Am 05.08.2013 00:14, schrieb Mattia Dongili:

Quoted 14 lines · Marco Krüger
Quoted 8 lines

Hey Mattia,

since the kernel 3.8.0 (commit:
23caaeea271cfe3176f0e27374d2016bd7583ea8) the sony-laptop module chrashes for me.
Initially reported to the Arch Linux Bugtracker [1]. Link [2] lists full module output with enabled debug parameter.

Quoted 5 lines

Thanks!

[  171.492147] ------------[ cut here ]------------
[  171.492151] WARNING: at fs/sysfs/dir.c:530 sysfs_add_one+0xa5/0xd0()
[  171.492153] sysfs: cannot create duplicate filename '/devices/platform/sony-laptop/kbd_backlight'
Quoted 6 lines

So you seem to have both these that cause the above sysfs to be attempted to be added twice
case 0x0143:
case 0x014b:

Could you send your DSDT?

My DSDT in raw/decompiled format.

maintainer
#3 lore raw

[Resending as I don't see this mail on the list nor on online archives]

Hi Marco.

Quoted 1 line · Marco Krüger

Am 05.08.2013 00:14, schrieb Mattia Dongili:

...

Quoted 5 lines
Quoted 4 lines

case 0x0143:
case 0x014b:

Could you send your DSDT?

My DSDT in raw/decompiled format.

You have two essentially very similar methods to control backlight (screen, keyboard and ambient light sensor): F143 and F14B. I should probably fix the code to handle one such situation but have you by any chance checked if there is a BIOS update that fixes this mess?

For the record, only this bit seems different:

	If (LEqual (BUF1, 0x40))
	{
	    Store (0x40, P80H)
	    Store (BUF2, Local0)
-	    And (Local0, One, Local0)
+	    And (Local0, 0x03, Local0)
	    Store (Local0, ^^H_EC.KLPC)
	}

but we never call into this method with anything other than 0x1 or 0x0 in BUF2 so it won't make any difference at the moment which one we use.

Still it would be interesting to know what happens with 0x2 or 0x3. Do you remember what states you could set in Windows for the keyboard backlight?

Thanks

Signature · 2 lines
mattia
:wq!
#4 lore raw

Hi Mattia!

I'm already on the latest BIOS (R2087H4). I attached a screenshot of the windows options.

Thanks

#5 lore raw
In reply to Mattia Dongili

Hi Mattia,

you are right!
If I comment out either one case (0x0143/0x014b) no crash occurs. I also recognized that the gfx switch value is wrong. Using the gfx switch toggles the value, but it is the opposite to the actual switch position. What can I do to help you solving this bug?

maintainer
#6 lore raw
Quoted 7 lines · Marco Krüger

Hi Mattia,

you are right!
If I comment out either one case (0x0143/0x014b) no crash occurs. I also recognized that the gfx switch value is wrong. Using the gfx switch toggles the value, but it is the opposite to the actual switch position. What can I do to help you solving this bug?

apologies, this issue flew off my radar and I essentially forgot about it.
I had prepared this patch back then, could you see if it also works?

I think these checks should be extended to all handles not just the keyboard backlight one but that's a bigger patch.

---
commit 0fcf192e1bdd396cb510bed918ee6c450396c8e4

Author: Mattia Dongili <[email protected]>
Date:   Sun Aug 18 19:32:08 2013 +0900

sony-laptop: warn on multiple KBD backlight handles

Some BIOS versions/Vaio models apparently ship with two nearly identical functions to handle backlight related controls.
The only difference seems to be:
If (LEqual (BUF1, 0x40))
{
Store (0x40, P80H)
Store (BUF2, Local0)
- And (Local0, One, Local0)
+ And (Local0, 0x03, Local0)
Store (Local0, ^^H_EC.KLPC)
}

Avoid erroring out on initialization and messing things up on cleanup for now since we never call into those methods with anything different than 1 or 0.
This issue was found on a Sony VPCSE1V9E/BIOS R2087H4.

drivers/platform/x86/sony-laptop.c +12 -4
index 3a1b6bf..b5a7f3c 100644
@@ -146,7 +146,8 @@ static void sony_nc_thermal_resume(void);
 #endif
 static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
 		unsigned int handle);
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd);
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle);
 
 static int sony_nc_battery_care_setup(struct platform_device *pd,
 		unsigned int handle);
@@ -1448,7 +1449,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
 		case 0x014b:
 		case 0x014c:
 		case 0x0163:
-			sony_nc_kbd_backlight_cleanup(pd);
+			sony_nc_kbd_backlight_cleanup(pd, handle);
 			break;
 		default:
 			continue;
@@ -1829,6 +1830,12 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
 	int result;
 	int ret = 0;
 
+	if (kbdbl_ctl) {
+		pr_warn("handle 0x%.4x: keyboard backlight setup already done for 0x%.4x\n",
+				handle, kbdbl_ctl->handle);
+		return -EBUSY;
+	}
+
 	/* verify the kbd backlight presence, these handles are not used for
 	 * keyboard backlight only
 	 */
@@ -1886,9 +1893,10 @@ outkzalloc:
 	return ret;
 }
 
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle)
 {
-	if (kbdbl_ctl) {
+	if (kbdbl_ctl && handle == kbdbl_ctl->handle) {
 		int result;
 
 		device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr);
Signature · 2 lines
mattia
:wq!
#7 lore raw

The patch works as expected.
...

[   49.590035] sony_laptop: Sony Notebook Control Driver v0.6
[   49.590104] input: Sony Vaio Keys as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/SNY5001:00/input/input8
[   49.590162] input: Sony Vaio Jogdial as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/SNY5001:00/input/input9
[   49.595169] sony_laptop: handle 0x014b: keyboard backlight setup already done for 0x0143
[   49.595174] sony_laptop: couldn't set up keyboard backlight function (-16)
[   49.595255] sony_laptop: brightness ignored, must be controlled by ACPI video driver

...

Issues left:
a) The wrong gfx switch reading as mentioned in my last mail.

b) Different mapping for timeout settings:
Modinfo gives me:
"parm: kbd_backlight_timeout:set this to 0 to set the default 10 seconds timeout, 1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout (default: 0) (int)"

My mapping is: 0 -> disabled, 1-> 10 seconds, 2-> 30 seconds, 3 -> 60 seconds

thx

Am 22.09.2013 05:10, schrieb Mattia Dongili:

Quoted 91 lines · Marco Krüger
Quoted 7 lines

Hi Mattia,

you are right!
If I comment out either one case (0x0143/0x014b) no crash occurs. I also recognized that the gfx switch value is wrong. Using the gfx switch toggles the value, but it is the opposite to the actual switch position. What can I do to help you solving this bug?

apologies, this issue flew off my radar and I essentially forgot about it.
I had prepared this patch back then, could you see if it also works?

I think these checks should be extended to all handles not just the keyboard backlight one but that's a bigger patch.

---
commit 0fcf192e1bdd396cb510bed918ee6c450396c8e4

Author: Mattia Dongili <[email protected]>
Date:   Sun Aug 18 19:32:08 2013 +0900

sony-laptop: warn on multiple KBD backlight handles

Some BIOS versions/Vaio models apparently ship with two nearly identical functions to handle backlight related controls.
The only difference seems to be:
If (LEqual (BUF1, 0x40))
{
Store (0x40, P80H)
Store (BUF2, Local0)
- And (Local0, One, Local0)
+ And (Local0, 0x03, Local0)
Store (Local0, ^^H_EC.KLPC)
}

Avoid erroring out on initialization and messing things up on cleanup for now since we never call into those methods with anything different than 1 or 0.
This issue was found on a Sony VPCSE1V9E/BIOS R2087H4.

drivers/platform/x86/sony-laptop.c +12 -4
index 3a1b6bf..b5a7f3c 100644
@@ -146,7 +146,8 @@ static void sony_nc_thermal_resume(void);
  #endif
  static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
  		unsigned int handle);
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd);
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle);
 
  static int sony_nc_battery_care_setup(struct platform_device *pd,
  		unsigned int handle);
@@ -1448,7 +1449,7 @@ static void sony_nc_function_cleanup(struct platform_device *pd)
  		case 0x014b:
  		case 0x014c:
  		case 0x0163:
-			sony_nc_kbd_backlight_cleanup(pd);
+			sony_nc_kbd_backlight_cleanup(pd, handle);
  			break;
  		default:
  			continue;
@@ -1829,6 +1830,12 @@ static int sony_nc_kbd_backlight_setup(struct platform_device *pd,
  	int result;
  	int ret = 0;
 
+	if (kbdbl_ctl) {
+		pr_warn("handle 0x%.4x: keyboard backlight setup already done for 0x%.4x\n",
+				handle, kbdbl_ctl->handle);
+		return -EBUSY;
+	}
+
  	/* verify the kbd backlight presence, these handles are not used for
  	 * keyboard backlight only
  	 */
@@ -1886,9 +1893,10 @@ outkzalloc:
  	return ret;
  }
 
-static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd)
+static void sony_nc_kbd_backlight_cleanup(struct platform_device *pd,
+		unsigned int handle)
  {
-	if (kbdbl_ctl) {
+	if (kbdbl_ctl && handle == kbdbl_ctl->handle) {
  		int result;
 
  		device_remove_file(&pd->dev, &kbdbl_ctl->mode_attr);
maintainer
#8 lore raw
Quoted 10 lines · Marco Krüger

The patch works as expected.
...

[   49.590035] sony_laptop: Sony Notebook Control Driver v0.6
[   49.590104] input: Sony Vaio Keys as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/SNY5001:00/input/input8
[   49.590162] input: Sony Vaio Jogdial as /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/SNY5001:00/input/input9
[   49.595169] sony_laptop: handle 0x014b: keyboard backlight setup
already done for 0x0143
[   49.595174] sony_laptop: couldn't set up keyboard backlight
function (-16)
[   49.595255] sony_laptop: brightness ignored, must be controlled
Quoted 5 lines

by ACPI video driver
...

Issues left:
a) The wrong gfx switch reading as mentioned in my last mail.

what kernel version are you using? 3.11 is supposed to have a fix for that. is it still wrong after that?

Quoted 8 lines

b) Different mapping for timeout settings:
Modinfo gives me:
"parm: kbd_backlight_timeout:set this to 0 to set the default 10 seconds timeout, 1 for 30 seconds, 2 for 60 seconds and 3 to disable timeout (default: 0) (int)"

My mapping is: 0 -> disabled, 1-> 10 seconds, 2-> 30 seconds, 3 -> 60 seconds

ha! I guess this is not particularly pressing, it's just the help text that is incorrect, right?

Signature · 2 lines
mattia
:wq!
#9 lore raw
Quoted 3 lines

what kernel version are you using? 3.11 is supposed to have a fix for that. is it still wrong after that?

It's kernel v3.11.1 - my notebook is a diva ;)

Quoted 3 lines

ha! I guess this is not particularly pressing, it's just the help text that is incorrect, right?

Right! That was my guess, too. 0-> disabled, ... just makes more sense.