From: Andrew Morton on
On Fri, 12 Feb 2010 16:35:37 -0600 Jason Wessel <jason.wessel(a)windriver.com> wrote:

> @@ -609,6 +610,14 @@ asmlinkage int printk(const char *fmt, ...)
> va_list args;
> int r;
>
> +#ifdef CONFIG_KGDB_KDB
> + if (unlikely(kdb_trap_printk)) {
> + va_start(args, fmt);
> + r = vkdb_printf(fmt, args);
> + va_end(args);
> + return r;
> + }
> +#endif
> va_start(args, fmt);
> r = vprintk(fmt, args);
> va_end(args);

this?

--- a/kernel/printk.c~a
+++ a/kernel/printk.c
@@ -594,7 +594,11 @@ asmlinkage int printk(const char *fmt, .
int r;

va_start(args, fmt);
+#ifdef CONFIG_KGDB_KDB
+ r = vkdb_printf(fmt, args);
+#else
r = vprintk(fmt, args);
+#endif
va_end(args);

return r;
_

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jason Wessel on
Andrew Morton wrote:
> On Fri, 12 Feb 2010 16:35:37 -0600 Jason Wessel <jason.wessel(a)windriver.com> wrote:
>
>
>> @@ -609,6 +610,14 @@ asmlinkage int printk(const char *fmt, ...)
>> va_list args;
>> int r;
>>
>> +#ifdef CONFIG_KGDB_KDB
>> + if (unlikely(kdb_trap_printk)) {
>> + va_start(args, fmt);
>> + r = vkdb_printf(fmt, args);
>> + va_end(args);
>> + return r;
>> + }
>> +#endif
>> va_start(args, fmt);
>> r = vprintk(fmt, args);
>> va_end(args);
>>
>
> this?
>
> --- a/kernel/printk.c~a
> +++ a/kernel/printk.c
> @@ -594,7 +594,11 @@ asmlinkage int printk(const char *fmt, .
> int r;
>
> va_start(args, fmt);
> +#ifdef CONFIG_KGDB_KDB
> + r = vkdb_printf(fmt, args);
> +#else
> r = vprintk(fmt, args);
> +#endif
> va_end(args);
>
> return r;
> _
>

If you feel that would be cleaner, I can make that change, but I would
also have to call vprintk() from vkdb_printf when ever kdb_trap_printk
is not set. Do I understand your recommendation correctly?

The only time the kdb_trap_printk is ever set comes when we are inside
the kernel debug shell, and do something like "bt". It serves the
purpose of letting folks run the stack dumper and a few other
functions. We want to trap printk's in this instance because we don't
want them in the log them and also for the case when your debug
connection is not actually a system log console, or if you run the
command via gdb (example is "monitor bt").

Thanks,
Jason.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Andrew Morton on
On Fri, 12 Feb 2010 17:20:22 -0600 Jason Wessel <jason.wessel(a)windriver.com> wrote:

> Andrew Morton wrote:
> > On Fri, 12 Feb 2010 16:35:37 -0600 Jason Wessel <jason.wessel(a)windriver.com> wrote:
> >
> >
> >> @@ -609,6 +610,14 @@ asmlinkage int printk(const char *fmt, ...)
> >> va_list args;
> >> int r;
> >>
> >> +#ifdef CONFIG_KGDB_KDB
> >> + if (unlikely(kdb_trap_printk)) {
> >> + va_start(args, fmt);
> >> + r = vkdb_printf(fmt, args);
> >> + va_end(args);
> >> + return r;
> >> + }
> >> +#endif
> >> va_start(args, fmt);
> >> r = vprintk(fmt, args);
> >> va_end(args);
> >>
> >
> > this?
> >
> > --- a/kernel/printk.c~a
> > +++ a/kernel/printk.c
> > @@ -594,7 +594,11 @@ asmlinkage int printk(const char *fmt, .
> > int r;
> >
> > va_start(args, fmt);
> > +#ifdef CONFIG_KGDB_KDB
> > + r = vkdb_printf(fmt, args);
> > +#else
> > r = vprintk(fmt, args);
> > +#endif
> > va_end(args);
> >
> > return r;
> > _
> >
>
> If you feel that would be cleaner, I can make that change, but I would
> also have to call vprintk() from vkdb_printf when ever kdb_trap_printk
> is not set. Do I understand your recommendation correctly?
>

err, no, I must have been in a drunken stupor. Was trying to find
a way to avoid the code duplication.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jason Wessel on
Andrew Morton wrote:
> On Fri, 12 Feb 2010 17:20:22 -0600 Jason Wessel <jason.wessel(a)windriver.com> wrote:
>
>
>> If you feel that would be cleaner, I can make that change, but I would
>> also have to call vprintk() from vkdb_printf when ever kdb_trap_printk
>> is not set. Do I understand your recommendation correctly?
>>
>>
>
> Was trying to find
> a way to avoid the code duplication.
>
>
>


You did make me think about the interface a bit further. If you were
going to ack one of the versions of this patch, which would you prefer?
The previous version, this new version or something else?

The difference here is that we use a replaced function call vs using the
if statement. There are more lines source in the kdb, but the interface
api is clean.

Thanks,
Jason.