[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZQrzhh62pDB5yUyi@smile.fi.intel.com>
Date: Wed, 20 Sep 2023 16:28:38 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
Luis Chamberlain <mcgrof@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Arnd Bergmann <arnd@...db.de>,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>
Subject: Re: [PATCH printk v2 09/11] panic: Add atomic write enforcement to
oops
On Wed, Sep 20, 2023 at 01:14:54AM +0206, John Ogness wrote:
> Invoke the atomic write enforcement functions for oops to
> ensure that the information gets out to the consoles.
>
> Since there is no single general function that calls both
> oops_enter() and oops_exit(), the nesting feature of atomic
> write sections is taken advantage of in order to guarantee
> full coverage between the first oops_enter() and the last
> oops_exit().
>
> It is important to note that if there are any legacy consoles
> registered, they will be attempting to directly print from the
> printk-caller context, which may jeopardize the reliability of
> the atomic consoles. Optimally there should be no legacy
> consoles registered.
...
> + if (atomic_read(&oops_cpu) == smp_processor_id()) {
> + oops_nesting--;
> + if (oops_nesting == 0) {
> + atomic_set(&oops_cpu, -1);
Between read and set the variable can change, can't it?
If not, why this variable is atomic then? Or, why it's not a problem?
If the latter is the case, perhaps a comment to explain this?
> + /* Exit outmost atomic section. */
> + nbcon_atomic_exit(NBCON_PRIO_EMERGENCY, oops_prev_prio);
> + }
> + }
> + put_cpu();
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists