Ticket #2279 (new defect)
toggling backlight very fast blocks reads of /proc/apm
| Reported by: | lindi | Owned by: | openmoko-kernel |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | kernel | Version: | unspecified |
| Severity: | minor | Keywords: | kernel backlight DoS |
| Cc: | Blocked By: | ||
| Blocking: | Estimated Completion (week): | ||
| HasPatchForReview: | no | PatchReviewResult: | |
| Reproducible: | always |
Description
Steps to reproduce:
1) Start "while cat /proc/apm; do sleep 1; done" in one terminal
2) Start
while true; do
echo 255 > /sys/class/backlight/gta02-bl/brightness
echo 15 > /sys/class/backlight/gta02-bl/brightness
done
in another terminal
Expected results:
2) backlight brightness changes very fast but cat is still sometimes scheduled and can read from /proc/apm
Actual results:
2) backlight brightness changes very fast but the read() to /proc/apm never returns.
More info:
1) I was just trying to make freerunner work as a strobe light when I noticed that I could not stop the program. This probably happened because Xorg was stuck reading from some file and would never succeed.
2) I am using andy-tracking 9ecc089861ab238e
Change History
comment:2 Changed 4 years ago by lindi
Well, my window manager (icewm) supports /proc/apm and I got very upset when I suddenly noticed that it got stuck when I started the blinking program :-)
Anyways, I tried reading other files in /proc and noticed that also reading from /proc/driver/rtc seems to block forever. This probably suggests that the problem is not APM related?
comment:3 Changed 4 years ago by lindi
I wrote a small program that tries to read every file in /sys:
#!/bin/sh
find /sys -type f | while read f; do
echo "==== $f"
md5sum $f &
pid="$!"
for i in 0 1 2 3 4 5 6 7 8 9; do
if ! [ -d "/proc/$pid" ]; then
break
fi
sleep 0.1
done
if [ -d "/proc/$pid" ]; then
echo stuck on $f
sleep 4
fi
done
It reported that the following files can not be read when the backlight blinking program is running:
/sys/devices/platform/s3c24xx_pwm.0/hdq.0/hdq/dump
/sys/class/regulator/regulator.0/microvolts
/sys/class/regulator/regulator.0/state
/sys/class/regulator/regulator.1/microvolts
/sys/class/regulator/regulator.1/state
/sys/class/regulator/regulator.2/microvolts
/sys/class/regulator/regulator.2/state
/sys/class/regulator/regulator.3/microvolts
/sys/class/regulator/regulator.3/state
/sys/class/regulator/regulator.4/microvolts
/sys/class/regulator/regulator.4/state
/sys/class/regulator/regulator.5/microvolts
/sys/class/regulator/regulator.5/state
/sys/class/regulator/regulator.6/microvolts
/sys/class/regulator/regulator.6/state
/sys/class/regulator/regulator.7/microvolts
/sys/class/regulator/regulator.7/state
/sys/class/regulator/regulator.8/microvolts
/sys/class/regulator/regulator.8/state
/sys/class/regulator/regulator.9/microvolts
/sys/class/regulator/regulator.9/state
/sys/class/regulator/regulator.10/microvolts
/sys/class/regulator/regulator.10/state
/sys/class/backlight/gta02-bl/actual_brightness
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/chgmode
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/usb_curlim
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-mbc/chg_curlim
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.6/neo1973-pm-bt.0/microamps_requested_BT_3V2
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.7/neo1973-pm-gps.0/microamps_requested_RF_3V
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.7/neo1973-pm-gps.0/power_on
/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.9/glamo3362.0/glamo-mci.0/microamps_requested_SD_3V3
After the last file the phone rebooted with watchdog and ramconsole showed the following kernel
error:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c7b18000 [00000000] *pgd=37bb1031, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] PREEMPT Modules linked in: fuse snd_soc_neo1973_gta02_wm8753 snd_soc_s3c24xx_i2s snd_soc_s3c24xx g_ether s3c2410_wdt ar6000 snd_soc_wm8753 s3cmci snd_soc_core snd_pcm snd_timer snd_page_alloc snd CPU: 0 Not tainted (2.6.29-GTA02_lindi-andy-tracking-mokodev #17) PC is at s3c24xx_serial_show_clksrc+0x1c/0x30 LR is at dev_attr_show+0x2c/0x4c pc : [<c019f85c>] lr : [<c01a0408>] psr: a0000013 sp : c7b49ee0 ip : c7b49ef0 fp : c7b49eec r10: 00000000 r9 : 00001000 r8 : c7b49f78 r7 : c03a2830 r6 : c7990ab4 r5 : c03a2680 r4 : c038bbb8 r3 : 00000000 r2 : c7bb6000 r1 : 00001000 r0 : c7bb6000 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: c000717f Table: 37b18000 DAC: 00000015 Process md5sum (pid: 1750, stack limit = 0xc7b48268) Stack: (0xc7b49ee0 to 0xc7b4a000) 9ee0: c7b49f04 c7b49ef0 c01a0408 c019f850 c038bbb8 c7bb7360 c7b49f4c c7b49f08 9f00: c00f1e30 c01a03ec c02ad038 c004b2a8 c7b568f4 c7b568f4 be8605dc c7bb7378 9f20: c01606d8 c7b302c0 be8605dc c7b49f78 00001000 c002f048 c7b48000 00000000 9f40: c7b49f74 c7b49f50 c00ad7ec c00f1d7c c7b49f74 c7b49f60 00000000 00000000 9f60: c7b302c0 00000003 c7b49fa4 c7b49f78 c00ad944 c00ad744 00000000 00000000 9f80: ffffffff 00000000 00017858 00000000 00017858 00001000 00000000 c7b49fa8 9fa0: c002eea0 c00ad908 00000000 00017858 00000003 be8605dc 00001000 00000000 9fc0: 00000000 00017858 00001000 00000003 00001000 be8618f4 00000002 00000101 9fe0: be8605dc be8605a0 400ad154 4010173c 60000010 00000003 00000000 00000000 Backtrace: [<c019f840>] (s3c24xx_serial_show_clksrc+0x0/0x30) from [<c01a0408>] (dev_attr_show+0x2c/0x4c) [<c01a03dc>] (dev_attr_show+0x0/0x4c) from [<c00f1e30>] (sysfs_read_file+0xc4/0x1c0) r5:c7bb7360 r4:c038bbb8 [<c00f1d6c>] (sysfs_read_file+0x0/0x1c0) from [<c00ad7ec>] (vfs_read+0xb8/0x148) [<c00ad734>] (vfs_read+0x0/0x148) from [<c00ad944>] (sys_read+0x4c/0x7c) r7:00000003 r6:c7b302c0 r5:00000000 r4:00000000 [<c00ad8f8>] (sys_read+0x0/0x7c) from [<c002eea0>] (ret_fast_syscall+0x0/0x2c) r6:00001000 r5:00017858 r4:00000000 Code: e59030e4 e3a01a01 e513300c e1a00002 (e5933000) ---[ end trace 247919efb6119d22 ]--- s3c2410-wdt s3c2410-wdt: Unexpected close, not stopping watchdog Flash device refused suspend due to active operation (state 0) Restarting system. arch_reset: attempting watchdog reset

Should we still care about it? APM is deprecated long time ago, as to the suspend/resume hooks (/etc/apm.d), that's probably userspace issues, no?