kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* question about pr_info (newbie)
@ 2014-12-29  9:32 Kevin Wilson
  2014-12-29 13:58 ` Valdis.Kletnieks at vt.edu
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wilson @ 2014-12-29  9:32 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I have the following very simply kernel module.
The module_init() method has one call to pr_info("Hello world!\n").
However, when I run "insmod helloWorld.ko" I get TWO messages in the
kernel log and not one, as I expected:

..
Dec 29 11:24:40 kv kernel: [67479.245642] Hello world!
Dec 29 11:24:40 kv kernel: Hello world!
...

The same is for "rmmod helloWorld" (TWO messages instead of one)

I built and run this module under kernel 3.17.6-300.fc21.x86_64, Fedora 21.
Any ideas ? Is there some way to configure the kernel to emit only one
message in such a case ?

Following is the code:

static int __init hello_init(void)
{
        pr_info("Hello world!\n");
        return 0;
ded.
}

static void __exit hello_cleanup(void)
        {
        pr_info("Cleaning up module.\n");
        }

module_init(hello_init);
module_exit(hello_cleanup);


Regards,
Kevin

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

* question about pr_info (newbie)
  2014-12-29  9:32 Kevin Wilson
@ 2014-12-29 13:58 ` Valdis.Kletnieks at vt.edu
  0 siblings, 0 replies; 5+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2014-12-29 13:58 UTC (permalink / raw)
  To: kernelnewbies

On Mon, 29 Dec 2014 11:32:22 +0200, Kevin Wilson said:

> The module_init() method has one call to pr_info("Hello world!\n").
> However, when I run "insmod helloWorld.ko" I get TWO messages in the
> kernel log and not one, as I expected:
>
> ..
> Dec 29 11:24:40 kv kernel: [67479.245642] Hello world!
> Dec 29 11:24:40 kv kernel: Hello world!

Check to make sure you don't have a bug in your syslog.conf causing
it to log the message twice....

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141229/90d578fb/attachment.bin 

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

* question about pr_info (newbie)
       [not found] <mailman.1.1419872404.20373.kernelnewbies@kernelnewbies.org>
@ 2014-12-29 17:11 ` Larry Martin
  2014-12-30 11:39   ` Kevin Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Martin @ 2014-12-29 17:11 UTC (permalink / raw)
  To: kernelnewbies

Hi, Kevin -

This gets me all the time.  I think your system is working correctly.

This is the log entry showing your system call:
> Dec 29 11:24:40 kv kernel: [67479.245642] Hello world!

And this is your actual output:
> Dec 29 11:24:40 kv kernel: Hello world!

If you reduce your log level you will lose the first message but not the 
second.

BR,
Larry

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

* question about pr_info (newbie)
  2014-12-29 17:11 ` question about pr_info (newbie) Larry Martin
@ 2014-12-30 11:39   ` Kevin Wilson
  2014-12-30 14:04     ` Larry Martin
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Wilson @ 2014-12-30 11:39 UTC (permalink / raw)
  To: kernelnewbies

Hi,

>If you reduce your log level you will lose the first message but not the
>second.

I would appreciate if somebody can be more specific, how this can be done.
I am using the defaults for syslog, which came with Fedora 21 x86_64.

Regards,
Kevin





On Mon, Dec 29, 2014 at 7:11 PM, Larry Martin <Larry@gluelogix.com> wrote:
> Hi, Kevin -
>
> This gets me all the time.  I think your system is working correctly.
>
> This is the log entry showing your system call:
>> Dec 29 11:24:40 kv kernel: [67479.245642] Hello world!
>
> And this is your actual output:
>> Dec 29 11:24:40 kv kernel: Hello world!
>
> If you reduce your log level you will lose the first message but not the
> second.
>
> BR,
> Larry
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

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

* question about pr_info (newbie)
  2014-12-30 11:39   ` Kevin Wilson
@ 2014-12-30 14:04     ` Larry Martin
  0 siblings, 0 replies; 5+ messages in thread
From: Larry Martin @ 2014-12-30 14:04 UTC (permalink / raw)
  To: kernelnewbies

>

> I would appreciate if somebody can be more specific, how this can be
> done. I am using the defaults for syslog, which came with Fedora 21
> x86_64.
>

Kevin, I understand your frustration.  I think I used the wrong term.
It's not a "log level" thing, but a "dynamic debug" thing.  Dynamic 
Debug lets you turn on your specific message without seeing all other 
messages of the same "level."  But that means you may have to explicitly 
turn it off.

See:

google://pr_info
http://lwn.net/Articles/487437/
https://lwn.net/Articles/434833/

 From the last link:
> Turning on dynamic debug causes a new virtual file to appear at
> /sys/kernel/debug/dynamic_debug/control (modulo any individual
> preferences for the location of debugfs, naturally). Writing to that
> file will enable or disable specific debugging functions, as
> specified by a simple but flexible language.

> echo file tpm_nsc.c function init_nsc +p > .../dynamic_debug/control

So your incantation would be something like:

echo file myfile.c function init_me -p > mypath/dynamic_debug/control

LWN has a dynamic debug howto.  I assume it's in kernel docs too.

-- 
Larry Martin
www.GlueLogix.com
Design, Test and Support of Computerized Systems
desk USA 919.342.0201
cell USA 919.641.1733

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

end of thread, other threads:[~2014-12-30 14:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.1.1419872404.20373.kernelnewbies@kernelnewbies.org>
2014-12-29 17:11 ` question about pr_info (newbie) Larry Martin
2014-12-30 11:39   ` Kevin Wilson
2014-12-30 14:04     ` Larry Martin
2014-12-29  9:32 Kevin Wilson
2014-12-29 13:58 ` Valdis.Kletnieks at vt.edu

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).