linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Ogness <john.ogness@linutronix.de>,
	Petr Tesarik <ptesarik@suse.cz>,
	x86@kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] printk/panic/x86: Allow to access printk log buffer after crash_smp_send_stop()
Date: Thu, 18 Jul 2019 14:07:20 +0300	[thread overview]
Message-ID: <CALYGNiMnqUKxKsY1JRi075xs-P_QzfA4Pg3XANiW0mFYkp_RQQ@mail.gmail.com> (raw)
In-Reply-To: <20190718104756.GA22851@jagdpanzerIV>

On Thu, Jul 18, 2019 at 1:48 PM Sergey Senozhatsky
<sergey.senozhatsky.work@gmail.com> wrote:
>
> On (07/16/19 09:28), Petr Mladek wrote:
> [..]
> > +int printk_bust_lock_safe(bool kdump_smp_stop)
> >  {
> >       if (!raw_spin_is_locked(&logbuf_lock))
> >               return 0;
> >
> > -     if (num_online_cpus() == 1) {
> > +     if (num_online_cpus() == 1 || kdump_smp_stop)  {
> >               debug_locks_off();
> >               raw_spin_lock_init(&logbuf_lock);
> >               return 0;
>
> Let me test the waters. Criticize the following idea:
>
> Can we, sort of, disconnect "supposed to be dead" CPUs from printk()
> so then we can unconditionally re-init printk() from panic-CPU?
>
> We have per-CPU printk_state; so panic-CPU can set, let's say,
> DEAD_CPUS_TELL_NO_TALES bit on all CPUs but self, and vprintk_func()
> will do nothing if DEAD_CPUS_TELL_NO_TALES bit set on particular
> CPU. Foreign CPUs are not even supposed to be alive, and smp_send_stop()
> waits for IPI acks from secondary CPUs long enough on average (need
> to check that) so if one of the CPUs is misbehaving and doesn't want
> to die (geez...) we will just "disconnect" it from printk() to minimize
> possible logbuf/console drivers interventions and then proceed with
> panic; assuming that misbehaving CPUs are actually up to something
> sane. Sometimes, you know, in some cases, those CPUs are already dead:
> either accidentally powered off, or went completely nuts and do nothing,
> etc. etc. but we still can kdump() and console_flush_on_panic().

Good idea.
Panic-CPU could just increment state to reroute printk into 'safe'
per-cpu buffer.

>
>         -ss

  reply	other threads:[~2019-07-18 11:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16  7:28 [PATCH 0/2] panic/printk/x86: Prevent some more printk-related deadlocks in panic() Petr Mladek
2019-07-16  7:28 ` [PATCH 1/2] printk/panic: Access the main printk log in panic() only when safe Petr Mladek
2019-07-17  9:56   ` Sergey Senozhatsky
2019-07-18  8:36     ` Petr Mladek
2019-07-18  9:49       ` Sergey Senozhatsky
2019-07-19 12:57         ` Petr Mladek
2019-07-23  3:13           ` Sergey Senozhatsky
2019-07-24 12:27             ` Petr Mladek
2019-07-31  6:08               ` Sergey Senozhatsky
2019-07-31  6:59                 ` Sergey Senozhatsky
2019-07-18 10:11   ` Sergey Senozhatsky
2019-07-16  7:28 ` [PATCH 2/2] printk/panic/x86: Allow to access printk log buffer after crash_smp_send_stop() Petr Mladek
2019-07-18 10:47   ` Sergey Senozhatsky
2019-07-18 11:07     ` Konstantin Khlebnikov [this message]
2019-07-18 11:29       ` Sergey Senozhatsky
2019-07-19 12:19         ` Petr Mladek
2019-07-18  9:59 ` [PATCH 0/2] panic/printk/x86: Prevent some more printk-related deadlocks in panic() Konstantin Khlebnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALYGNiMnqUKxKsY1JRi075xs-P_QzfA4Pg3XANiW0mFYkp_RQQ@mail.gmail.com \
    --to=koct9i@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=ptesarik@suse.cz \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).