kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Delay in Printk Messages.
@ 2014-06-28 17:33 Arun Kumar
  2014-06-28 17:39 ` Kristofer Hallin
  2014-06-28 21:58 ` mhornung.linux at gmail.com
  0 siblings, 2 replies; 4+ messages in thread
From: Arun Kumar @ 2014-06-28 17:33 UTC (permalink / raw)
  To: kernelnewbies

I am able to read my printk messages in the kernel buffer only after 
unloading the module..
Is there some reason or configuration behind this.

I used a simple kernel module with only init and exit functions, and 
after loading the module i cannot see the message printed by the 
"module_init" function in the output given by "dmesg -c" I can see them 
only after i unload the module.

i wait for around 15-20 seconds for the init message but it only shows 
up on removing the module.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Delay in Printk Messages.
  2014-06-28 17:33 Delay in Printk Messages Arun Kumar
@ 2014-06-28 17:39 ` Kristofer Hallin
  2014-06-28 17:43   ` Aruna Hewapathirane
  2014-06-28 21:58 ` mhornung.linux at gmail.com
  1 sibling, 1 reply; 4+ messages in thread
From: Kristofer Hallin @ 2014-06-28 17:39 UTC (permalink / raw)
  To: kernelnewbies

Try 'sysctl kernel.printk=7' where 7 is one of the levels defined in
"include/linux/kern_levels.h".

On Sat, Jun 28, 2014 at 7:33 PM, Arun Kumar <arunkr.linux@gmail.com> wrote:
> I am able to read my printk messages in the kernel buffer only after
> unloading the module..
> Is there some reason or configuration behind this.
>
> I used a simple kernel module with only init and exit functions, and
> after loading the module i cannot see the message printed by the
> "module_init" function in the output given by "dmesg -c" I can see them
> only after i unload the module.
>
> i wait for around 15-20 seconds for the init message but it only shows
> up on removing the module.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Delay in Printk Messages.
  2014-06-28 17:39 ` Kristofer Hallin
@ 2014-06-28 17:43   ` Aruna Hewapathirane
  0 siblings, 0 replies; 4+ messages in thread
From: Aruna Hewapathirane @ 2014-06-28 17:43 UTC (permalink / raw)
  To: kernelnewbies

Try echo "7" > /proc/sys/kernel/printk to enable all console log levels.

The numbers are corresponding to below:

#define KERN_EMERG "<0>" /* system is unusable*/
#define KERN_ALERT "<1>" /* action must be taken immediately*/
#define KERN_CRIT "<2>" /* critical conditions*/
#define KERN_ERR "<3>" /* error conditions*/
#define KERN_WARNING "<4>" /* warning conditions*/
#define KERN_NOTICE "<5>" /* normal but significant condition*/
#define KERN_INFO "<6>" /* informational*/
#define KERN_DEBUG "<7>" /* debug-level messages*/

The default number is 4, which allows console to show messages only at
least in KERN_WARNING. That could be why you cannot see log in
KERN_INFO level.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Delay in Printk Messages.
  2014-06-28 17:33 Delay in Printk Messages Arun Kumar
  2014-06-28 17:39 ` Kristofer Hallin
@ 2014-06-28 21:58 ` mhornung.linux at gmail.com
  1 sibling, 0 replies; 4+ messages in thread
From: mhornung.linux at gmail.com @ 2014-06-28 21:58 UTC (permalink / raw)
  To: kernelnewbies

Hello Arun Kumar,

On Sat, 28. Jun 23:03, Arun Kumar wrote:
> I am able to read my printk messages in the kernel buffer only after 
> unloading the module..
> Is there some reason or configuration behind this.
> 
> I used a simple kernel module with only init and exit functions, and 
> after loading the module i cannot see the message printed by the 
> "module_init" function in the output given by "dmesg -c" I can see them 
> only after i unload the module.
> 

Since you do not provide your code I have to guess that your print
statement looks like this:

	  pr_debug("Hello World!");

Please notice that printk doesn't flush until a trailing newline is
provided (Linux Device Drivers Chapter 4). So maybe this is what you want:

	  pr_debug("Hello World!\n");

> i wait for around 15-20 seconds for the init message but it only shows 
> up on removing the module.
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

With best regards

Michael Hornung

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-28 21:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-28 17:33 Delay in Printk Messages Arun Kumar
2014-06-28 17:39 ` Kristofer Hallin
2014-06-28 17:43   ` Aruna Hewapathirane
2014-06-28 21:58 ` mhornung.linux at gmail.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).