Skip to contentSkip to conversation

backlight: oops in __mutex_lock_slowpath during head /sys/class/graphics/fb0/* in 2.6.18

DISCUSSION Olaf Hering 3 participants 6 messages Sep 21, 2006 – Sep 22, 2006 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

The bl_curve code has some room for improvement.

...
<6>Monitor sense value = 0x60b
<6>using video mode 13 and color mode 0. <4>Console: switching to colour frame buffer device 104x39 <6>fb0: valkyrie frame buffer device
...

inst-sys:~ # cat /proc/fb
0 valkyrie
inst-sys:~ # l /sys/class/graphics/fb0/
total 0
drwxr-xr-x 2 root root 0 Sep 21 11:54 ./
drwxr-xr-x 4 root root 0 Sep 21 11:53 ../
-rw-r--r-- 1 root root 4096 Sep 21 12:15 bits_per_pixel -rw-r--r-- 1 root root 4096 Sep 21 12:15 bl_curve -rw-r--r-- 1 root root 4096 Sep 21 12:15 blank -rw-r--r-- 1 root root 4096 Sep 21 12:15 console -rw-r--r-- 1 root root 4096 Sep 21 12:15 cursor -r--r--r-- 1 root root 4096 Sep 21 12:15 dev -rw-r--r-- 1 root root 4096 Sep 21 12:15 mode -rw-r--r-- 1 root root 4096 Sep 21 12:15 modes -r--r--r-- 1 root root 4096 Sep 21 12:15 name -rw-r--r-- 1 root root 4096 Sep 21 12:15 pan -rw-r--r-- 1 root root 4096 Sep 21 12:15 rotate -rw-r--r-- 1 root root 4096 Sep 21 12:15 state -r--r--r-- 1 root root 4096 Sep 21 12:15 stride
lrwxrwxrwx 1 root root 0 Sep 21 12:15 subsystem -> ../../../class/graphics/
--w------- 1 root root 4096 Sep 21 12:15 uevent -rw-r--r-- 1 root root 4096 Sep 21 12:15 virtual_size inst-sys:~ # head /sys/class/graphics/fb0/* ==> /sys/class/graphics/fb0/bits_per_pixel <== 8

==> /sys/class/graphics/fb0/bl_curve <==
Segmentation fault
inst-sys:~ # dmesg
valkyriefb: vmode 13 does not support cmode 1.

Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc02c7bd8
Oops: Kernel access of bad area, sig: 11 [#1]

Modules linked in: tulip mesh cpufreq_ondemand loop nfs nfs_acl lockd sunrpc sg st sd_mod sr_mod scsi_mod ide_cd cdrom
NIP: C02C7BD8 LR: C0170EBC CTR: C0170E90
REGS: c4209db0 TRAP: 0300   Not tainted  (2.6.18-rc7-git1-2-default)
MSR: 00009032 <EE,ME,IR,DR>  CR: 28042488  XER: 00000000
DAR: 00000000, DSISR: 22000000

TASK = c7fc8190[2853] 'head' THREAD: c4208000
GPR00: C4209E6C C4209E60 C7FC8190 C0B77614 C41D5000 C41D5000 00000000 00008000
GPR08: 00000000 C0B77618 00000000 00000000 00000000 100200C8 10020000 00000001
GPR16: 10006D08 7FDF9B3C 100A0000 10080000 00000003 7FDF9CAB C4209F20 C2FCDC78
GPR24: C038BC14 C01EF568 7FDF7858 C41D5000 C0B77614 C0B77400 C7FC8190 C0B77614 NIP [C02C7BD8] __mutex_lock_slowpath+0x2c/0xa4
LR [C0170EBC] show_bl_curve+0x2c/0xa0

Call Trace:  
[C4209E60] [C02C7A54] mutex_lock+0x18/0x5c (unreliable)
[C4209E80] [C0170EBC] show_bl_curve+0x2c/0xa0
[C4209EB0] [C01EF594] class_device_attr_show+0x2c/0x44
[C4209EC0] [C00CC3BC] sysfs_read_file+0xb8/0x204
[C4209EF0] [C0083FE4] vfs_read+0xec/0x1c8
[C4209F10] [C0084444] sys_read+0x4c/0x8c
[C4209F40] [C00125F8] ret_from_syscall+0x0/0x40
--- Exception: c01 at 0xff589f8
    LR = 0x100045e0

Instruction dump:
4e800020 9421ffe0 7c0802a6 39230004 bfc10018 7c7f1b78 7c5e1378 90010024 3801000c 9121000c 81690004 90090004 <900b0000> 91610010 90410014 3800ffff

#1 lore raw
Quoted 65 lines · On Thu, 21 Sep 2006 14:19:52 +0200 Olaf Hering <[email protected]> wrote:

The bl_curve code has some room for improvement.

...
<6>Monitor sense value = 0x60b
<6>using video mode 13 and color mode 0. <4>Console: switching to colour frame buffer device 104x39 <6>fb0: valkyrie frame buffer device
...

inst-sys:~ # cat /proc/fb
0 valkyrie
inst-sys:~ # l /sys/class/graphics/fb0/
total 0
drwxr-xr-x 2 root root 0 Sep 21 11:54 ./
drwxr-xr-x 4 root root 0 Sep 21 11:53 ../

(quoted diff) +0 -13
-rw-r--r-- 1 root root 4096 Sep 21 12:15 bits_per_pixel
-rw-r--r-- 1 root root 4096 Sep 21 12:15 bl_curve
-rw-r--r-- 1 root root 4096 Sep 21 12:15 blank
-rw-r--r-- 1 root root 4096 Sep 21 12:15 console
-rw-r--r-- 1 root root 4096 Sep 21 12:15 cursor
-r--r--r-- 1 root root 4096 Sep 21 12:15 dev
-rw-r--r-- 1 root root 4096 Sep 21 12:15 mode
-rw-r--r-- 1 root root 4096 Sep 21 12:15 modes
-r--r--r-- 1 root root 4096 Sep 21 12:15 name
-rw-r--r-- 1 root root 4096 Sep 21 12:15 pan
-rw-r--r-- 1 root root 4096 Sep 21 12:15 rotate
-rw-r--r-- 1 root root 4096 Sep 21 12:15 state
-r--r--r-- 1 root root 4096 Sep 21 12:15 stride

lrwxrwxrwx 1 root root 0 Sep 21 12:15 subsystem -> ../../../class/graphics/
--w------- 1 root root 4096 Sep 21 12:15 uevent -rw-r--r-- 1 root root 4096 Sep 21 12:15 virtual_size inst-sys:~ # head /sys/class/graphics/fb0/* ==> /sys/class/graphics/fb0/bits_per_pixel <== 8

==> /sys/class/graphics/fb0/bl_curve <==
Segmentation fault
inst-sys:~ # dmesg
valkyriefb: vmode 13 does not support cmode 1.

Unable to handle kernel paging request for data at address 0x00000000
Faulting instruction address: 0xc02c7bd8
Oops: Kernel access of bad area, sig: 11 [#1]

Modules linked in: tulip mesh cpufreq_ondemand loop nfs nfs_acl lockd sunrpc sg st sd_mod sr_mod scsi_mod ide_cd cdrom
NIP: C02C7BD8 LR: C0170EBC CTR: C0170E90
REGS: c4209db0 TRAP: 0300   Not tainted  (2.6.18-rc7-git1-2-default)
MSR: 00009032 <EE,ME,IR,DR>  CR: 28042488  XER: 00000000
DAR: 00000000, DSISR: 22000000

TASK = c7fc8190[2853] 'head' THREAD: c4208000
GPR00: C4209E6C C4209E60 C7FC8190 C0B77614 C41D5000 C41D5000 00000000 00008000
GPR08: 00000000 C0B77618 00000000 00000000 00000000 100200C8 10020000 00000001
GPR16: 10006D08 7FDF9B3C 100A0000 10080000 00000003 7FDF9CAB C4209F20 C2FCDC78
GPR24: C038BC14 C01EF568 7FDF7858 C41D5000 C0B77614 C0B77400 C7FC8190 C0B77614 NIP [C02C7BD8] __mutex_lock_slowpath+0x2c/0xa4
LR [C0170EBC] show_bl_curve+0x2c/0xa0

Call Trace:  
[C4209E60] [C02C7A54] mutex_lock+0x18/0x5c (unreliable)
[C4209E80] [C0170EBC] show_bl_curve+0x2c/0xa0
[C4209EB0] [C01EF594] class_device_attr_show+0x2c/0x44
[C4209EC0] [C00CC3BC] sysfs_read_file+0xb8/0x204
[C4209EF0] [C0083FE4] vfs_read+0xec/0x1c8
[C4209F10] [C0084444] sys_read+0x4c/0x8c
[C4209F40] [C00125F8] ret_from_syscall+0x0/0x40
--- Exception: c01 at 0xff589f8
    LR = 0x100045e0
Quoted 4 lines

Instruction dump:
4e800020 9421ffe0 7c0802a6 39230004 bfc10018 7c7f1b78 7c5e1378 90010024 3801000c 9121000c 81690004 90090004 <900b0000> 91610010 90410014 3800ffff

cc's added.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw
Quoted 3 lines · Andrew Morton
Quoted 1 line · On Thu, 21 Sep 2006 14:19:52 +0200 Olaf Hering <[email protected]> wrote:

The bl_curve code has some room for improvement.

Agreed.

Quoted 4 lines
Quoted 4 lines

inst-sys:~ # dmesg
valkyriefb: vmode 13 does not support cmode 1.

Unable to handle kernel paging request for data at address 0x00000000

Faulting instruction address: 0xc02c7bd8

Seems like not all drivers use the framebuffer_alloc() function and won't have an initialized mutex. But those don't have a backlight, anyway.

What about the patch below? Does it work for you?

---

drivers/video/fbsysfs.c +12 -0
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18.orig/drivers/video/fbsysfs.c linux-2.6.18/drivers/video/fbsysfs.c
@@ -397,6 +397,12 @@ static ssize_t store_bl_curve(struct cla
 	u8 tmp_curve[FB_BACKLIGHT_LEVELS];
 	unsigned int i;
 
+	/* Some drivers don't use framebuffer_alloc(), but those also
+	 * don't have backlights.
+	 */
+	if (!fb_info || !fb_info->bl_dev)
+		return -ENODEV;
+
 	if (count != (FB_BACKLIGHT_LEVELS / 8 * 24))
 		return -EINVAL;
 
@@ -430,6 +436,12 @@ static ssize_t show_bl_curve(struct clas
 	ssize_t len = 0;
 	unsigned int i;
 
+	/* Some drivers don't use framebuffer_alloc(), but those also
+	 * don't have backlights.
+	 */
+	if (!fb_info || !fb_info->bl_dev)
+		return -ENODEV;
+
 	mutex_lock(&fb_info->bl_mutex);
 	for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
 		len += snprintf(&buf[len], PAGE_SIZE,
#3 lore raw
Quoted 1 line · Michael Hanselmann

What about the patch below? Does it work for you?

Appears to work.

tangerine:~ # head /sys/class/graphics/fb0/*
==> /sys/class/graphics/fb0/bits_per_pixel <==
8

==> /sys/class/graphics/fb0/bl_curve <==
head: error reading `/sys/class/graphics/fb0/bl_curve': No such device

==> /sys/class/graphics/fb0/blank <==

==> /sys/class/graphics/fb0/console <==

==> /sys/class/graphics/fb0/cursor <==

==> /sys/class/graphics/fb0/dev <==
29:0

==> /sys/class/graphics/fb0/mode <==

==> /sys/class/graphics/fb0/modes <==
U:832x624p-74

==> /sys/class/graphics/fb0/name <==
valkyrie

==> /sys/class/graphics/fb0/pan <==
0,0

==> /sys/class/graphics/fb0/rotate <==
0

==> /sys/class/graphics/fb0/state <==
0

==> /sys/class/graphics/fb0/stride <==
832

==> /sys/class/graphics/fb0/subsystem <==
head: error reading `/sys/class/graphics/fb0/subsystem': Is a directory
head: cannot open `/sys/class/graphics/fb0/uevent' for reading: Permission denied

==> /sys/class/graphics/fb0/virtual_size <==
832,624

#4 lore raw
Quoted 42 lines · On Fri, 22 Sep 2006 13:26:22 +0200 Olaf Hering <[email protected]> wrote:
Quoted 1 line · Michael Hanselmann

What about the patch below? Does it work for you?

Appears to work.

tangerine:~ # head /sys/class/graphics/fb0/*
==> /sys/class/graphics/fb0/bits_per_pixel <==
8

==> /sys/class/graphics/fb0/bl_curve <==
head: error reading `/sys/class/graphics/fb0/bl_curve': No such device

==> /sys/class/graphics/fb0/blank <==

==> /sys/class/graphics/fb0/console <==

==> /sys/class/graphics/fb0/cursor <==

==> /sys/class/graphics/fb0/dev <==
29:0

==> /sys/class/graphics/fb0/mode <==

==> /sys/class/graphics/fb0/modes <==
U:832x624p-74

==> /sys/class/graphics/fb0/name <==
valkyrie

==> /sys/class/graphics/fb0/pan <==
0,0

==> /sys/class/graphics/fb0/rotate <==
0

==> /sys/class/graphics/fb0/state <==
0

==> /sys/class/graphics/fb0/stride <==
832

Quoted 6 lines

==> /sys/class/graphics/fb0/subsystem <==
head: error reading `/sys/class/graphics/fb0/subsystem': Is a directory
head: cannot open `/sys/class/graphics/fb0/uevent' for reading: Permission denied

==> /sys/class/graphics/fb0/virtual_size <==
832,624

Still looks like a bit of a mess, but I assume that's expected.

Michael, I take it that patch was final?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#5 lore raw
Quoted 3 lines · Andrew Morton

Still looks like a bit of a mess, but I assume that's expected.

Michael, I take it that patch was final?

For now, yes. Thanks for adding it to -mm.