All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Keniston <jkenisto@us.ibm.com>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: Greg KH <greg@kroah.com>, LKML <linux-kernel@vger.kernel.org>,
	netdev <netdev@oss.sgi.com>, Jeff Garzik <jgarzik@pobox.com>,
	"Feldman, Scott" <scott.feldman@intel.com>,
	Larry Kessler <kessler@us.ibm.com>,
	Randy Dunlap <rddunlap@osdl.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Andrew Morton <akpm@osdl.org>,
	Daniel Stekloff <dsteklof@us.ibm.com>,
	Hien Nguyen <hien@us.ibm.com>, jkenisto <jkenisto@us.ibm.com>
Subject: Re: [PATCH 1/4] Net device error logging, revised
Date: Fri, 29 Aug 2003 14:22:07 -0700	[thread overview]
Message-ID: <3F4FC3FF.8A704B85@us.ibm.com> (raw)
In-Reply-To: 20030826180626.50778705.shemminger@osdl.org

Stephen Hemminger wrote:
> 
> > The following options come to mind:
> > 1. Keep the msg buffer, but make it smaller.  Around 120 bytes would probably be
> > big enough for the vast majority of messages.  (printk() uses a 1024-byte buffer,
> > but it's static -- see #2.)
> >
> > 2. Use a big, static buffer, protected by a spinlock.  printk() does this.
> >
> > 3. Do the whole thing in a macro, as in previous proposals.  The size of the macro
> > expansion could be reduced somewhat by doing the encode-prefix step in a function --
> > something like:
[more on #3 snipped]
> 
> Is there some way to tack copy and prepend what you want onto the format
> string, and add additional arguments to the call to printk?  That way you
> wouldn't need space for the potentially large resulting string, but only
> enough room for the expanded format string.

Interesting idea.  I pondered this for a while.  But even if you postulate 
a varargs version of printk (which doesn't exist), it's not really
feasible to do this in a function.  There's no way for a function to
prepend args to a va_list.  That means you'd have to encode the text of
the prefix as part of the format string, and that would require you to
allocate room for prefix+format, which is still a lot of stack.  Also,
the fact that the interface name itself may contain "%d" or some such
makes it even messier.

Greg K-H thinks #2 is a reasonable solution (you're about to serialize on printk's
lock anyway), so I'll go with that.

Thanks.
Jim

  reply	other threads:[~2003-08-29 21:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-25 21:31 [PATCH 1/4] Net device error logging, revised Jim Keniston
2003-08-25 21:39 ` Subject: [PATCH 2/4] Net device error logging, revised (e100) Jim Keniston
2003-08-25 21:41 ` Subject: [PATCH 3/4] Net device error logging, revised (e1000) Jim Keniston
2003-08-25 21:43 ` [PATCH 4/4] Net device error logging, revised (tg3) Jim Keniston
2003-08-26 18:32 ` [PATCH 1/4] Net device error logging, revised Greg KH
2003-08-26 23:34   ` Jim Keniston
2003-08-26 23:51     ` Jeff Garzik
2003-08-27  1:07       ` Jim Keniston
2003-09-03 17:32         ` Jeff Garzik
2003-09-03 20:56           ` Jim Keniston
2003-08-27  1:06     ` Stephen Hemminger
2003-08-29 21:22       ` Jim Keniston [this message]
2003-09-15 23:08 ` [PATCH] " Jim Keniston

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=3F4FC3FF.8A704B85@us.ibm.com \
    --to=jkenisto@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dsteklof@us.ibm.com \
    --cc=greg@kroah.com \
    --cc=hien@us.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=kessler@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@oss.sgi.com \
    --cc=rddunlap@osdl.org \
    --cc=scott.feldman@intel.com \
    --cc=shemminger@osdl.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.