Shiny New E-Book Gizmo: The Amazon Kindle


View Full Version : contentLister: part of the power problem


scotty1024
10-24-2006, 02:02 PM
content lister sure has a lot of processes fork()'d, half of them sitting around doing nothing even when the page bar gets poked.

Makes figuring out which processes are doing what a bit more fun.

Like process 565 here. It gets kill -32'd when the page bar is poked and makes the click noise.

root@ereader:/media/cf/opt/debian# strace -p 565
Process 565 attached - interrupt to quit
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
sigreturn() = ? (mask now [RTMIN])
open("/dev/dsp", O_WRONLY) = 23
write(23, "RIFF\300\16\0\0WAVEfmt \20\0\0\0\1\0\1\0\"V\0\0D\254\0"..., 3784) = 3784
close(23) = 0
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([] <unfinished ...>
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
<... rt_sigsuspend resumed> ) = 32
sigreturn() = ? (mask now [RTMIN])
open("/dev/dsp", O_WRONLY) = 23
write(23, "RIFF\300\16\0\0WAVEfmt \20\0\0\0\1\0\1\0\"V\0\0D\254\0"..., 3784) = 3784
close(23) = 0
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0


As you can see, even with sound turned off, contentLister is still opening the sound file and writing the click sound file into it to make the clicking sound.

Which by the way seems to be all process 565 does, wait for a signal 32 to tell it the page bar flipped and write a sound to the sound device.

Got this off the parent contentLister when poking the page bar.

Process 494 attached - interrupt to quit
.. check for input from X ...
ioctl(4, FIONREAD, [0]) = 0

... check for page bar etc...
poll([{fd=5, events=POLLIN}, {fd=4, events=POLLIN, revents=POLLIN}, {fd=19, events=POLLIN|POLLPRI}, {fd=10, events=POLLIN}], 4, -1) = 1

I clicked page bar here

... X windows ...
ioctl(4, FIONREAD, [32]) = 0
read(4, "\202u\352{1\331\233{8\0\0\0\7\0\240\0\0\0\0\0\1\0\ 1\0\1"..., 32) = 32
write(4, "\22\0\7\0\7\0\240\0\214\0\0\0\6\0\0\0 \0\1\0\1\0\0\000"..., 32) = 32
read(4, "\203u\352{4\331\233{8\0\0\0\7\0\240\0\0\0\0\0\1\0\ 1\0\1"..., 32) = 32
read(4, "\34\0\353{\7\0\240\0\214\0\0\0\215\331\233{\0\0\0\ 0\0\0"..., 32) = 32
read(4, "\1\1\354{\0\0\0\0\7\0\240\0\200\367\0\0t:\r\0h:\r\ 0\274"..., 32) = 32

... side conversation via socket with another process ...
sendto(14, "2,101,27,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10
sendto(14, "2,101,47,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10
sendto(14, "2,101,48,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10
sendto(14, "7,101,6", 7, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 7

... log to std out ...
write(2, "(CL_W)erMdsFs.c:627,erClGetDispl"..., 88) = 88

... Scanning directory to get files...
stat64("/mnt/cf/mke2fs", {st_mode=S_IFREG|0755, st_size=61444, ...}) = 0
stat64("/mnt/cf/mke2fs", {st_mode=S_IFREG|0755, st_size=61444, ...}) = 0
stat64("/mnt/cf/ncurses-5.5.tar.gz", {st_mode=S_IFREG|0644, st_size=2314030, ...}) = 0
stat64("/mnt/cf/ncurses-5.5.tar.gz", {st_mode=S_IFREG|0644, st_size=2314030, ...}) = 0
stat64("/mnt/cf/ncurses-term_5.4-4_all.deb", {st_mode=S_IFREG|0644, st_size=278364, ...}) = 0
stat64("/mnt/cf/ncurses-term_5.4-4_all.deb", {st_mode=S_IFREG|0644, st_size=278364, ...}) = 0

.. more logging to stdout ...
write(2, "(CL_W)erMdsFs.c:627,erClGetDispl"..., 90) = 90

... back to examining directory ...
stat64("/mnt/cf/nslookup", {st_mode=S_IFREG|0755, st_size=489588, ...}) = 0
stat64("/mnt/cf/nslookup", {st_mode=S_IFREG|0755, st_size=489588, ...}) = 0
stat64("/mnt/cf/opt", {st_mode=S_IFDIR|0755, st_size=1024, ...}) = 0
stat64("/mnt/cf/p.tar.gz", {st_mode=S_IFREG|0644, st_size=10122084, ...}) = 0
stat64("/mnt/cf/p.tar.gz", {st_mode=S_IFREG|0644, st_size=10122084, ...}) = 0

... side conversation via socket with another process ...
sendto(14, "2,101,27,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10
sendto(14, "2,101,47,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10
sendto(14, "2,101,48,0", 10, 0, {sa_family=AF_INET, sin_port=htons(50065), sin_addr=inet_addr("127.0.0.1")}, 16) = 10

... a lot of x windows ...
write(4, "\2\0\4\0$\0\240\0\1\0\0\0\0\0\0\0+\0\1\0", 20) = 20

(clipped)

... side conversation via socket with another process ...
sendto(13, "17,101", 6, 0, {sa_family=AF_INET, sin_port=htons(50073), sin_addr=inet_addr("127.0.0.1")}, 16) = 6
sendto(13, "0,101,8", 7, 0, {sa_family=AF_INET, sin_port=htons(50073), sin_addr=inet_addr("127.0.0.1")}, 16) = 7
sendto(13, "1,101,6", 7, 0, {sa_family=AF_INET, sin_port=htons(50073), sin_addr=inet_addr("127.0.0.1")}, 16) = 7
sendto(13, "19,101", 6, 0, {sa_family=AF_INET, sin_port=htons(50073), sin_addr=inet_addr("127.0.0.1")}, 16) = 6

Now process 666, he wakes up when I poke the page bar and opens a connection to the X server.

root@ereader:/media/cf/debs# strace -p 666
Process 666 attached - interrupt to quit
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
sigreturn() = ? (mask now [RTMIN])
gettimeofday({1161715820, 374478}, NULL) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [RTMIN], 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN], [RTMIN], 8) = 0
gettimeofday({1161715820, 377899}, NULL) = 0
nanosleep({0, 496579000}, 0) = -1 EINTR (Interrupted system call)
--- SIGRTMIN (Unknown signal 32) @ 0 (0) ---
rt_sigprocmask(SIG_SETMASK, [RTMIN], NULL, 8) = 0
kill(565, SIGRTMIN) = 0
sendto(12, "0,1", 3, 0, {sa_family=AF_INET, sin_port=htons(50071), sin_addr=inet_addr("127.0.0.1")}, 16) = 3
uname({sys="Linux", node="ereader", ...}) = 0
socket(PF_FILE, SOCK_STREAM, 0) = 22
uname({sys="Linux", node="ereader", ...}) = 0
uname({sys="Linux", node="ereader", ...}) = 0
connect(22, {sa_family=AF_FILE, path="/tmp/.X11-unix/X0"}, 19) = 0
uname({sys="Linux", node="ereader", ...}) = 0
fcntl64(22, F_SETFD, FD_CLOEXEC) = 0
access("/home/root/.Xauthority", R_OK) = -1 ENOENT (No such file or directory)
writev(22, [{"l\0\v\0\0\0\0\0\0\0\0\0", 12}], 1) = 12
fcntl64(22, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(22, F_SETFL, O_RDWR|O_NONBLOCK) = 0
read(22, "\1\0\v\0\0\0008\0", 8) = 8
read(22, "6\32\0\0\0\0\300\0\377\377\37\0\0\1\0\0\17\0\377\3 77\1"..., 224) = 224
write(22, "7\0\5\0\0\0\300\0008\0\0\0\10\0\0\0\377\0\0\0b\0\5 \0\f"..., 64) = 64
read(22, "\0016\2\0\0\0\0\0\1\203\0\0\3106\25\0\24\0\0\0\0\0 \0\0"..., 32) = 32
read(22, "\1\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0016\2\0\ 0\0\0"..., 32) = 32
write(22, "\203\0\1\0", 4) = 4
read(22, "\1\315\4\0\0\0\0\0\377\377\17\0\3106\25\0\24\0\0\0 \0\0"..., 32) = 32
writev(22, [{"b\0\5\0\t\0\300\0", 8}, {"XKEYBOARD", 9}, {"\0\0\0", 3}], 3) = 20
read(22, "\1\315\5\0\0\0\0\0\0\0\0\0\3106\25\0\24\0\0\0\0\0\ 0\0T"..., 32) = 32
gettimeofday({1161715820, 641285}, NULL) = 0
write(22, "e\0\2\0\10\200\300\0", 8) = 8
read(22, "\1\4\6\0\0\2\0\0\254\220\3\0\0\0\0\0\3106\25\0\24\ 0\0\0"..., 32) = 32
read(22, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\33\377\0\0\0\0\0\ 0\0\0"..., 2048) = 2048
write(22, "w\0\1\0", 4) = 4
read(22, "\1\3\7\0\6\0\0\0\0\0\0\0\3106\25\0\24\0\0\0\0\0\0\ 0h\24"..., 32) = 32
readv(22, [{"2>xB\0\0%i\0@\0\0M\0\0\0\0\0l\0\0\0\0\0", 24}, {"", 0}], 2) = 24
gettimeofday({1161715820, 651663}, NULL) = 0
write(22, "\31\1\v\0\7\0\240\0\1\0\0\0\2p\0\0\21\250\250{8\0\ 0\0\7"..., 92) = 92
read(22, "\1\1\n\0\0\0\0\0\7\0\240\0h\24\1\0t:\r\0h:\r\0\274 9\r\0"..., 32) = 32
write(22, "<\1\2\0\0\0\300\0+\0\1\0", 12) = 12
read(22, "\1\1\f\0\0\0\0\0\7\0\240\0h\24\1\0t:\r\0h:\r\0\274 9\r\0"..., 32) = 32
shutdown(22, 2 /* send and receive */) = 0
close(22) = 0
kill(494, SIGRTMIN) = 0
rt_sigprocmask(SIG_SETMASK, NULL, [RTMIN], 8) = 0
rt_sigsuspend([]


Process 665, its part of the power management crisis. :D

This next one is polling every .1 seconds, even when you aren't pressing buttons. This one keeps the CPU and lord above only knows what else out of sleep mode...

ioctl(15, 0x80046207, 0xbf3ffb0c) = 0
nanosleep({0, 100000000}, NULL) = 0
ioctl(15, 0x80046207, 0xbf3ffb0c) = 0
nanosleep({0, 100000000}, NULL) = 0
ioctl(15, 0x80046207, 0xbf3ffb0c) = 0
nanosleep({0, 100000000}, NULL) = 0
ioctl(15, 0x80046207, 0xbf3ffb0c) = 0


So there you have it, not bad for my first strace investigations of contentLister I think.

scotty1024
10-24-2006, 02:10 PM
Ah, finally caught 665 in action!

665 is the .1 second poller process which is polling an ioctl call on file descriptor 15.

Acoording to lsof fd 15 is hooked to:

contentLi 665 root 15u CHR 222,0 329 /dev/buttons

See how all these tools work together?

So now we see that when the page bar gets tweaked 665 does something about it.

ioctl(15, 0x80046207, 0xbf3ffb0c) = 0
nanosleep({0, 100000000}, NULL) = 0
ioctl(15, 0x80046207, 0xbf3ffb0c) = 0
kill(666, SIGRTMIN) = 0
kill(666, SIGRTMIN) = 0
nanosleep({0, 100000000}, NULL) = 0

It does the kill 32 on process 666 which we saw in the earlier straces.

scotty1024
10-24-2006, 02:12 PM
And in case you wanted to know what that signal is: http://en.wikipedia.org/wiki/SIGRTMIN

NatCh
10-24-2006, 02:19 PM
So ... do I understand correctly that the much (you should pardon the term) demonized "plonk" sound is part of process 666?

How ironic. :devilish:

design256
10-24-2006, 02:19 PM
Ah, finally caught 665 in action!

665 is the .1 second poller process which is polling an ioctl call on file descriptor 15.


Intriguing. I wonder why they haven't used an interrupt.

arivero
10-24-2006, 03:06 PM
So ... do I understand correctly that the much (you should pardon the term) demonized "plonk" sound is part of process 666?

How ironic. :devilish:

No, 666 is actually angelical :sunny: It sends the keyboard/mouse event to the Xserver instead of being temped to communicate with the application via some secret RPC. This means: you can control iLiad applications with a keyboard/mouse. And: you can use the iLiad buttons in your own reader apps simply as if they were some specific keys of a keyboard/mouse.

tribble
10-24-2006, 03:59 PM
Does this mean, that there basically is no way to suspend the machine in between pageflips, since the buttons dont use interrupts to wake the machine?

scotty1024
10-24-2006, 04:10 PM
I've already posted to iRex asking them to re-write /dev/buttons.

Silly thing really should block that ioctl call, sigh...

And if sound is off? Why feed the sound file? They're chewing up energy feeding sound into a speaker with the volume turned down!

Argh!

Where is the meditation thread?

tribble
10-24-2006, 04:12 PM
Here you go: Meditation thread (http://www.mobileread.com/forums/showthread.php?t=6902&highlight=meditation)

Oh, and for the speaker, i read somewhere, that they have to do soundchip PM. I think thats, when all those things get sorted out.

CommanderROR
10-24-2006, 04:38 PM
really scotty1024...you are one of my big heroes these days...the stuff you find out by poking around in the Iliad's software internals...WOW is all I can say about that...

vranghel
10-24-2006, 04:47 PM
really scotty1024...you are one of my big heroes these days...the stuff you find out by poking around in the Iliad's software internals...WOW is all I can say about that...

Indeed! Too bad i have no idea what he's talking about 90% of the time. :blink: But it sounds important!

CommanderROR
10-24-2006, 04:53 PM
Believe me vranghel, I don't understand much either, but it still sounds amazing...:-)

The way he's going right now, he'll give us a completely rewritten Iliad OS with Suspend Mode and higher overall speed in...2 days or something...:-)