All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] include KERN_* constant in printk() calls in
Date: Mon, 09 Apr 2007 21:23:22 +0000	[thread overview]
Message-ID: <20070409212322.GB26692@parisc-linux.org> (raw)
In-Reply-To: <20070409194151.GG4262@traven>

On Mon, Apr 09, 2007 at 04:02:09PM -0400, Dave Jones wrote:
>  > --- a/mm/slab.c
>  > +++ b/mm/slab.c
>  > @@ -1732,9 +1732,9 @@ static void dump_line(char *data, int offset, int limit)
>  >  			error = data[offset + i];
>  >  			bad_count++;
>  >  		}
>  > -		printk(" %02x", (unsigned char)data[offset + i]);
>  > +		printk(KERN_ERR " %02x", (unsigned char)data[offset + i]);
>  >  	}
> 
> This one is wrong.  It's printing a bunch of numbers in a loop, so with your change
> it'll print for example...
> 
> KERN_ERR 00 KERN_ERR 01 KERN_ERR 02 KERN_ERR etc etc..
> 
> you only want the KERN_ERR at the beginning of each line.

Another point is that if you have two CPUs calling printk, the output
can get interleaved if you don't print everything in one go.  If you
come across something like this (printing things in a loop), it's a good
idea to take a hard look at it and see if you can see a way to do it
without the loop so you can print everything on one line.

You can see one example of this here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;f=drivers/scsi/scsi_scan.c;h\x180399406510917111b7580dfc8f3a5f1ce7d95d;hp^[d92b9b46d9ccc5209103beb59cfb75ccafdb5d;hbOf36718ede26ee2da73f2dae94d71e2b06845fc;hpb\08cd5bbfb4763322837cd1f7c621f02ebe22fef

I don't see a clean way to fix this one up, to be honest.  I think it
has to be left as a loop.
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2007-04-09 21:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-09 19:41 [KJ] [PATCH] include KERN_* constant in printk() calls in mm/slab.c Matthias Kaehlcke
2007-04-09 20:02 ` [KJ] [PATCH] include KERN_* constant in printk() calls in Dave Jones
2007-04-09 20:08 ` Matthias Kaehlcke
2007-04-09 20:53 ` Matthias Kaehlcke
2007-04-09 21:23 ` Matthew Wilcox [this message]
2007-04-09 21:41 ` Matthew Wilcox
2007-04-10  6:48 ` Matthias Kaehlcke
2007-04-10 21:07 ` Alexey Dobriyan
2007-04-10 21:37 ` Dave Jones
2007-04-10 21:50 ` Robert P. J. Day
2007-04-10 21:58 ` Randy Dunlap
2007-04-11  6:50 ` Matthias Kaehlcke
2007-04-14  5:50   ` [PATCH] include KERN_* constant in printk() calls in arch/i386/mach-default/setup.c Matthias Kaehlcke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070409212322.GB26692@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.