[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878rb01hxv.fsf@jogness.linutronix.de>
Date: Fri, 28 Jul 2023 11:58:44 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Petr Mladek <pmladek@...e.com>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk v2 2/8] printk: Provide debug_store() for nbcon
debugging
On 2023-07-28, John Ogness <john.ogness@...utronix.de> wrote:
> +/*
> + * Define DEBUG_NBCON to allow for nbcon ownership transitions to be logged
> + * to the ringbuffer. The debug_store() macro only logs to the lockless
> + * ringbuffer and does not trigger any printing.
> + */
> +#undef DEBUG_NBCON
> +
> +#ifdef DEBUG_NBCON
> +/* Only write to ringbuffer. */
> +int __debug_store(const char *fmt, ...)
> +{
> + va_list args;
> + int r;
> +
> + va_start(args, fmt);
> + r = vprintk_store(2, 7, NULL, fmt, args);
> + va_end(args);
> +
> + return r;
> +}
> +#define debug_store(cond, fmt, ...) \
> + do { \
> + if (cond) \
> + __debug_store(pr_fmt("DEBUG: " fmt), ##__VA_ARGS__) \
Missing a semi-colon here. Wrapping this with a do-while was a
last-minute change requested by checkpatch.pl. Probably nobody would
notice because you must manually define DEBUG_NBCON by changing the
source code. Fixed for v3 (assuming Petr allows me to keep this
debugging code in place).
> + } while (0)
> +#else
> +#define debug_store(cond, fmt, ...)
> +#endif
John
Powered by blists - more mailing lists