[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161129141054.GD21230@pathway.suse.cz>
Date: Tue, 29 Nov 2016 15:10:55 +0100
From: Petr Mladek <pmladek@...e.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Jan Kara <jack@...e.cz>, Tejun Heo <tj@...nel.org>,
Calvin Owens <calvinowens@...com>,
Thomas Gleixner <tglx@...utronix.de>,
Mel Gorman <mgorman@...hsingularity.net>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] early_printk: Add simple serialization to
early_vprintk()
On Tue 2016-10-18 19:08:33, Peter Zijlstra wrote:
> In order to avoid multiple CPUs banging on the serial port at the same
> time, add simple serialization. This explicitly deals with nested
> contexts (like IRQs etc.).
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Makes sense. Just a small comment below.
Reviewd-by: Petr Mladek <pmladek@...e.com>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -356,14 +356,28 @@ static int __init force_early_printk_set
> }
> early_param("force_early_printk", force_early_printk_setup);
>
> +static int early_printk_cpu = -1;
[...]
> + for (;;) {
> + old = cmpxchg(&early_printk_cpu, -1, cpu);
> + if (old == -1 || old == cpu)
> + break;
> +
> + cpu_relax();
> + }
>
> n = vscnprintf(buf, sizeof(buf), fmt, args);
> early_console->write(early_console, buf, n);
>
> + smp_store_release(&early_printk_cpu, old);
checkpatch.pl complains about using a barrier without a comment.
The code is simple but it still might help to add something like:
/* Releasing early_printk_cpu custom lock. */
Best Regards,
Petr
Powered by blists - more mailing lists