mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	H Peter Anvin <hpa@linux.intel.com>,
	Borislav Petkov <bp@alien8.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] panic: Avoid extra noisy messages due to stopped cpus
Date: Thu, 11 Oct 2018 17:59:41 +0800	[thread overview]
Message-ID: <20181011095941.mlh675ag5v4fpgos@shbuild888> (raw)
In-Reply-To: <20181011093500.GB9848@hirez.programming.kicks-ass.net>

Hi Peter,

On Thu, Oct 11, 2018 at 11:35:00AM +0200, Peter Zijlstra wrote:
> On Thu, Oct 11, 2018 at 03:17:48PM +0800, Feng Tang wrote:
> > Sometimes when debugging kernel panic, we saw many extra noisy error
> > messages after the expected end:
> > 
> > [   35.743249] ---[ end Kernel panic - not syncing: Fatal exception
> > [   35.749975] ------------[ cut here ]------------
> > 
> > These messages may overflow the sceen (framebuffer) and make debugging
> > much difficulter.
> 
> *blink* you actually using the framebuffer for debugging ?! Why the heck
> are you doing that?

I didn't make it clear.

I just wanted to show some use case, that when I work under command line
mode, if the kernel panic (without reboot configured), it will pop out
the panic message, and these noisy message may keep poping up and I
hardly see the actual panic message on the screen.

> 
> > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> > index c93fcfd..b703862 100644
> > --- a/arch/x86/kernel/process.c
> > +++ b/arch/x86/kernel/process.c
> > @@ -520,6 +520,7 @@ void stop_this_cpu(void *dummy)
> >  	 * Remove this CPU:
> >  	 */
> >  	set_cpu_online(smp_processor_id(), false);
> > +	set_cpu_active(smp_processor_id(), false);
> >  	disable_local_APIC();
> >  	mcheck_cpu_clear(this_cpu_ptr(&cpu_info));
> >  
> 
> WTH is stop_this_cpu() and how do we even get here with active still
> set?

Current panic() will call
	smp_send_stop
		native_stop_other_cpus
			apic->send_IPI_allbutself(REBOOT_VECTOR)
				smp_reboot_interrupt
					stop_this_cpu

> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 7fc4a37..cf41b7b 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -9034,7 +9034,7 @@ static inline int find_new_ilb(void)
> >  {
> >  	int ilb = cpumask_first(nohz.idle_cpus_mask);
> >  
> > -	if (ilb < nr_cpu_ids && idle_cpu(ilb))
> > +	if (ilb < nr_cpu_ids && idle_cpu(ilb) && cpu_online(ilb))
> >  		return ilb;
> >  
> >  	return nr_cpu_ids;
> 
> 
> Similar, this is the result of taking the CPU away without going through
> the normal path. You're doing something dodgy.

You are right, it's hacky. As I said in the commit log, suggestions are
appreciated.

Current emergercy handling of panic didn't notify the idle subsystem of
other cpus being stopped.

I have tried several other ways:
a) add a panic notifier to cancel the schdule timer when panic happens
b) don't re-enable the local interrupt inside panic() after normal panic
handling.

Thanks,
Feng



  reply	other threads:[~2018-10-11  9:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-11  7:17 Feng Tang
2018-10-11  9:35 ` Peter Zijlstra
2018-10-11  9:59   ` Feng Tang [this message]
2018-10-22  9:55     ` Feng Tang
2018-11-08 13:05       ` [PATCH v2] panic: Avoid the extra noise dmesg Feng Tang
2018-11-26 23:59         ` Andrew Morton
2018-11-27  3:32           ` Feng Tang

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=20181011095941.mlh675ag5v4fpgos@shbuild888 \
    --to=feng.tang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=hpa@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®