From: Tim C. <tim...@ya...> - 2006-01-22 07:46:54
|
When people are trying to relay a problem their having to me, I always ask for the console output so I can see exactly what their typing. So I thought this may be of interest to you. As you can see klog claims to have processed one sub-buffer, while the length of the cpu0 file is 0. Previously when I was generating output via the test-mod.ko module. the file cpu0 in this same directory would end up being 2700+ bytes after I hit ctrl-c and the output generated by test-mod.ko would be in the that. Anyway, maybe that helps, maybe it doesn't. tim darkstar # ./klog Creating channel with 4 sub-buffers of size 262144. Logging... Press Control-C to stop summary: cpu 0: 1 sub-buffers processed 1 max backlog darkstar # pwd /home/tcullen/src/relay-apps/examples/klog darkstar # ls -l total 108 -rw-r--r-- 1 tcullen users 297 Jan 21 13:28 Makefile -rw-r--r-- 1 tcullen users 597 Nov 4 01:47 README -rw-r--r-- 1 root root 0 Jan 21 23:34 cpu0 -rwxr-xr-x 1 tcullen users 15378 Jan 21 13:28 klog* -rw-r--r-- 1 tcullen users 15266 Nov 1 16:37 klog-mod.c -rw-r--r-- 1 tcullen users 9987 Jan 21 13:28 klog-mod.ko -rw-r--r-- 1 tcullen users 429 Jan 21 13:28 klog-mod.mod.c -rw-r--r-- 1 tcullen users 1460 Jan 21 13:28 klog-mod.mod.o -rw-r--r-- 1 tcullen users 9124 Jan 21 13:28 klog-mod.o -rw-r--r-- 1 tcullen users 12598 Nov 1 14:56 klog.c -rw-r--r-- 1 tcullen users 1184 Nov 1 19:28 test-mod.c -rw-r--r-- 1 tcullen users 1954 Jan 21 13:28 test-mod.ko -rw-r--r-- 1 tcullen users 429 Jan 21 13:28 test-mod.mod.c -rw-r--r-- 1 tcullen users 1460 Jan 21 13:28 test-mod.mod.o -rw-r--r-- 1 tcullen users 1092 Jan 21 13:28 test-mod.o darkstar # cat ./cpu0 darkstar # Tom Zanussi <za...@us...> wrote: Tim Cullen writes: > I suspose thats possible. "ps ax" shows them as at least being started, and the very first thing they do is call klog_printk. The thread routine looks like this: > > static void tm_thread( void *arg ) > { > klog_printk( "hello from thread %d\n",(int)arg ); > while( 1 ) { > set_current_state( TASK_INTERRUPTIBLE ); > schedule_timeout( 5 * HZ ); > } > } > > So one would expect that the klog_printk call would run, if indeed the thread gets run at all. > Are you just doing that one klog_printk()? The output won't be seen by the daemon until a sub-buffer fills up or the buffer is flushed when you Ctrl-C to stop the daemon. You don't see any output even after you stop the daemon? I also wonder why even a printk() wouldn't be showing up, strange. Tom > tim > > Tom Zanussi wrote: Tim Cullen writes: > > Hi Tom > > > > Guess I forgot to mention that the klog daemon is running. Everything is the same in as the klog example from the relay-apps tarball. The only difference is that instead of using test-mod.ko to generate log data, I'm using my own module that calls klog_printk from a kernel thread started by kthread_create. > > > > On a maybe-related, maybe-not-related note I'm having the same problem with output from printk even though I've done a "echo 8 > /proc/sys/kernel/printk" as root before hand. > > > > very confusing... > > > > Hmm, could it be possible that the kernel thread doesn't actually run? > It sounds like the printk() or klog_printk() calls may not be getting > executed for some reason... > > Tom > > > tim > > > > Tom Zanussi wrote: Tim Cullen writes: > > > I got the klog example working with kernel 2.6.16-rc with test-mod.ko outputting 123 strings. That all works fine. However when I try using klog_printk from a kernel thread created by kthread_create the output never shows up anywhere. Anyone have ideas whats going on? > > > > > > > Hi, > > > > Is the klog daemon running when the kernel thread is calling > > klog_printk()? If the klog daemon isn't running, nothing gets logged. > > > > The reason logging doesn't happen if the daemon isn't running is that > > the klog handler defined in klog-mod.c doesn't actually call > > relay_write() unless 'logging' is true, and 'logging' isn't true until > > the daemon tells it to turn logging on when it starts up, the idea > > being that you normally wouldn't want to log anything unless there's a > > reader to drain the channel. > > > > Hope that helps, > > > > Tom > > > > > > > > > > > > > > --------------------------------- > > > > What are the most popular cars? Find out at Yahoo! AutosHi Tom > > Guess I forgot to mention that the klog daemon is running. Everything is the same in as the klog example from the relay-apps tarball. The only difference is that instead of using test-mod.ko to generate log data, I'm using my own module that calls klog_printk from a kernel thread started by kthread_create. > > On a maybe-related, maybe-not-related note I'm having the same problem with output from printk even though I've done a "echo 8 > /proc/sys/kernel/printk" as root before hand. > > very confusing... > > tim > > Tom Zanussi wrote: Tim Cullen writes: > > I got the klog example working with kernel 2.6.16-rc with test-mod.ko outputting 123 strings. That all works fine. However when I try using klog_printk from a kernel thread created by kthread! > > _create > > the output never shows up anywhere. Anyone have ideas whats going on? > > > > Hi, > > Is the klog daemon running when the kernel thread is calling > klog_printk()? If the klog daemon isn't running, nothing gets logged. > > The reason logging doesn't happen if the daemon isn't running is that > the klog handler defined in klog-mod.c doesn't actually call > relay_write() unless 'logging' is true, and 'logging' isn't true until > the daemon tells it to turn logging on when it starts up, the idea > being that you normally wouldn't want to log anything unless there's a > reader to drain the channel. > > Hope that helps, > > Tom > > > > > > > > > --------------------------------- > > > > What are the most popular cars? Find out at Yahoo! Autos > > -- > Regards, > > Tom Zanussi > IBM Linux Technology Center/RAS > > > > --------------------------------- > Yahoo! Photos Showcase holiday pictures in hardcover > Photo Books. You design it and well bind it!I suspose thats possible. "ps ax" shows them as at least being started, and the very first thing they do is call klog_printk. The thread routine looks like this: static void tm_thread( void *arg ) { klog_printk( "hello from thread %d\n",(int)arg ); while( 1 ) { set_current_state( TASK_INTERRUPTIBLE ); schedule_timeout( 5 * HZ ); } } So one would expect that the klog_printk call would run, if indeed the thread gets run at all. tim Tom Zanussi <za...@us...> wrote: Tim Cullen writes: > Hi Tom > > Guess I forgot to mention that the klog daemon is running. Everything is the same in as the klog example from the relay-a > pps > tarball. The only difference is that instead of using test-mod.ko to generate log data, I'm using my own module that calls klog_printk from a kernel thread started by kthread_create. > > On a maybe-related, maybe-not-related note I'm having the same problem with output from printk even though I've done a "echo 8 > /proc/sys/kernel/printk" as root before hand. > > very confusing... > Hmm, could it be possible that the kernel thread doesn't actually run? It sounds like the printk() or klog_printk() calls may not be getting executed for some reason... Tom > tim > > Tom Zanussi wrote: Tim Cullen writes: > > I got the klog example working with kernel 2.6.16-rc with test-mod.ko outputting 123 strings. That all works fine. However when I try using klog_printk from a kernel thread created by kthread_create the output never shows up anywhere. Anyone hav > e ideas > whats going on? > > > > Hi, > > Is the klog daemon running when the kernel thread is calling > klog_printk()? If the klog daemon isn't running, nothing gets logged. > > The reason logging doesn't happen if the daemon isn't running is that > the klog handler defined in klog-mod.c doesn't actually call > relay_write() unless 'logging' is true, and 'logging' isn't true until > the daemon tells it to turn logging on when it starts up, the idea > being that you normally wouldn't want to log anything unless there's a > reader to drain the channel. > > Hope that helps, > > Tom > > > > > > > --------------------------------- > > What are the most popular cars? Find out at Yahoo! AutosHi Tom Guess I forgot to mention that the klog daemon is > running. > Everything is the same in as the klog example from the relay-apps tarball. The only difference is that instead of using test-mod.ko to generate log data, I'm using my own module that calls klog_printk from a kernel thread started by kthread_create. On a maybe-related, maybe-not-related note I'm having the same problem with output from printk even though I've done a "echo 8 > /proc/sys/kernel/printk" as root before hand. very confusing... tim Tom Zanussi <za...@us...> wrote: Tim Cullen writes: > I got the klog example working with kernel 2.6.16-rc with test-mod.ko outputting 123 strings. That all works fine. However when I try using klog_printk from a kernel thread created by kthread! > _create > the output never shows up anywhere. Anyone have ideas whats going on? > > ; > Hi, Is the klog daemon running when the kernel thread is calling klog_printk()? If the klog daemon isn't running, nothing gets logged. The reason logging doesn't happen if the daemon isn't running is that the klog handler defined in klog-mod.c doesn't actually call relay_write() unless 'logging' is true, and 'logging' isn't true until the daemon tells it to turn logging on when it starts up, the idea being that you normally wouldn't want to log anything unless there's a reader to drain the channel. Hope that helps, Tom > --------------------------------- > What are the most popular cars? Find out at Yahoo! Autos -- Regards, Tom Zanussi IBM > Linux > Technology Center/RAS > --------------------------------- Yahoo! Photos Showcase holiday pictures in hardcover > Photo Books. You design it and well bind it! -- Regards, Tom Zanussi IBM Linux Technology Center/RASN¬HYÞµéX¬²'²Þu¼¦[§Ü¨º Þ¦Øk¢è!W¬~é®åzk¶C£ å¡§m éÞÀ@^ÇÈ^§zØZ¶f¤zËj·!x2¢êå¢âë±æ¬É«,º·â a{ å,àHòÔ4¨m¶ÿ±éZ²ëjYwþÇ¥rgy$õÓ~7Ù¸môãÎjõÛ^¸Ú·¥k'ìuëÞf¢)à+-éZÉûz÷¥+-²Ê.Ç¢¸ëa¶Úlÿùb²Û,¢êÜyú+éÞ·ùb²Û?+-wèþ·¥k'ìuëÞ --------------------------------- What are the most popular cars? Find out at Yahoo! Autos |