Re: [PATCH] Re: kernel/printk.c: increasing the buffer size to capture devfsd debug messages.

2001-02-20 Thread Robert Read

On Tue, Feb 20, 2001 at 02:53:04PM -0600, Thomas Dodd wrote:
> Robert Read wrote:
> 
> Why not just make the config option in Kbytes.
> and do:
> 
> #define LOG_BUF_LEN (CONFIG_PRINTK_BUF_LEN * 1024)
> 

This is good idea, but I believe LOG_BUF_LEN needs to be a power of
2.  A bitmask is used in several places to wrap around the end of the
ring buffer.  For example

#define LOG_BUF_MASK (LOG_BUF_LEN-1)

printk() {
  
  log_buf[(log_start+log_size) & LOG_BUF_MASK] = *p;
}


I think LOG_BUF_LEN could be defined to round up (or down) at compile
time, but my post-lunch-sleepy brain can't think of the trick to do
it.

robert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] Re: kernel/printk.c: increasing the buffer size to capture devfsd debug messages.

2001-02-20 Thread Thomas Dodd

Thomas Dodd wrote:
> 
> Robert Read wrote:
> >
> > Ok, here is a simple patch to add a config option, I'm compiling it
> > now, so it's not tested yet.  One question: what is the best way to
> > force this option to be a power of 2?
> 
> Why not just make the config option in Kbytes.
> and do:
> 
> #define LOG_BUF_LEN (CONFIG_PRINTK_BUF_LEN * 1024)
> 
> since the config option has a default option and will
> always be defined, is the #ifdef check really needed?

Oops...

It's not needed if all arch's have the config option added.
Only parisc uses a different file, config.common instead of config.in
Would this break any thing?

-Thomas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] Re: kernel/printk.c: increasing the buffer size to capture devfsd debug messages.

2001-02-20 Thread Thomas Dodd

Robert Read wrote:
> 
> On Tue, Feb 20, 2001 at 01:37:16PM -0600, Thomas Dodd wrote:
> > Robert Read wrote:
> > >
> > > On Wed, Feb 21, 2001 at 02:30:08AM +0900, Ishikawa wrote:
> > > >
> > > > Has anyone tried 128K buffer size in kernel/printk.c
> > > > and still have the kernel boot (without
> > > > hard to notice memory corruption problems  and other subtle bugs)?
> > > > Any hints and tips will be appreciated.
> > >
> > > I have used 128k and larger buffer sizes, and I just noticed this
> > > fragment in the RedHat Tux Webserver patch.  It creates a 2MB buffer:
> >
> > I think this should be a config option.
> 
> Ok, here is a simple patch to add a config option, I'm compiling it
> now, so it's not tested yet.  One question: what is the best way to
> force this option to be a power of 2?

Why not just make the config option in Kbytes.
and do:

#define LOG_BUF_LEN (CONFIG_PRINTK_BUF_LEN * 1024)

since the config option has a default option and will
always be defined, is the #ifdef check really needed?

-Thomas
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



[PATCH] Re: kernel/printk.c: increasing the buffer size to capture devfsd debug messages.

2001-02-20 Thread Robert Read

On Tue, Feb 20, 2001 at 01:37:16PM -0600, Thomas Dodd wrote:
> Robert Read wrote:
> > 
> > On Wed, Feb 21, 2001 at 02:30:08AM +0900, Ishikawa wrote:
> > >
> > > Has anyone tried 128K buffer size in kernel/printk.c
> > > and still have the kernel boot (without
> > > hard to notice memory corruption problems  and other subtle bugs)?
> > > Any hints and tips will be appreciated.
> > 
> > I have used 128k and larger buffer sizes, and I just noticed this
> > fragment in the RedHat Tux Webserver patch.  It creates a 2MB buffer:
> 
> I think this should be a config option.

Ok, here is a simple patch to add a config option, I'm compiling it
now, so it's not tested yet.  One question: what is the best way to
force this option to be a power of 2?

robert

diff -ru linux-2.4.2-pre4/arch/i386/config.in 
linux-2.4.2-pre4-logbuf/arch/i386/config.in
--- linux-2.4.2-pre4/arch/i386/config.inMon Jan  8 13:27:56 2001
+++ linux-2.4.2-pre4-logbuf/arch/i386/config.in Tue Feb 20 12:10:19 2001
@@ -366,4 +366,5 @@
 
 #bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
 bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
+int 'Printk buffer size (must be power of 2)' CONFIG_PRINTK_BUF_LEN 16384
 endmenu
Only in linux-2.4.2-pre4-logbuf/arch/i386: config.in~
Only in linux-2.4.2-pre4-logbuf/include: asm
Only in linux-2.4.2-pre4-logbuf/include/linux: autoconf.h
Only in linux-2.4.2-pre4-logbuf/include/linux: modules
diff -ru linux-2.4.2-pre4/kernel/printk.c linux-2.4.2-pre4-logbuf/kernel/printk.c
--- linux-2.4.2-pre4/kernel/printk.cTue Feb 20 11:56:31 2001
+++ linux-2.4.2-pre4-logbuf/kernel/printk.c Tue Feb 20 11:59:35 2001
@@ -23,7 +23,11 @@
 
 #include 
 
-#define LOG_BUF_LEN(16384)
+#ifdef CONFIG_PRINTK_BUF_LEN
+# define LOG_BUF_LEN   (CONFIG_PRINTK_BUF_LEN)
+#else
+# define LOG_BUF_LEN   (16384)
+#endif   
 #define LOG_BUF_MASK   (LOG_BUF_LEN-1)
 
 static char buf[1024];