The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>,
	Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	linux-kernel@vger.kernel.org, Nicolai Stange <nstange@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH] RFC: x86/smp: use printk_deferred in native_smp_send_reschedule
Date: Wed, 8 May 2019 16:53:02 +0900	[thread overview]
Message-ID: <20190508075302.GC15704@jagdpanzerIV> (raw)
In-Reply-To: <20190508074420.GB15704@jagdpanzerIV>

On (05/08/19 16:44), Sergey Senozhatsky wrote:
> [..]
> >  static void native_smp_send_reschedule(int cpu)
> >  {
> >  	if (unlikely(cpu_is_offline(cpu))) {
> > -		WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
> > +		printk_deferred(KERN_WARNING
> > +				"sched: Unexpected reschedule of offline CPU#%d!\n", cpu);
> >  		return;
> >  	}
> >  	apic->send_IPI(cpu, RESCHEDULE_VECTOR);
> 
> Hmm,
> One thing to notice here is that the CPU in question is offline-ed,
> and printk_deferred() is a per-CPU type of deferred printk(). So the
> following thing
> 
> 	__this_cpu_or(printk_pending, PRINTK_PENDING_OUTPUT);
> 	irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> 
> might not print anything at all. In this particular case we always
> need another CPU to do console_unlock(), since this_cpu() is not
> really expected to do wake_up_klogd_work_func()->console_unlock().

D'oh... It's remote CPU which is offline, not this_cpu().
Sorry, my bad!

Any printk-related patch in this area will make PeterZ really-really
angry :)

printk_deferred(), just like prinkt_safe(), depends on IRQ work;
printk_safe(), however, can redirect multiple lines, unlike
printk_deferred(). So if you want to keep the backtrace, you may
do something like

	if (unlikely(cpu_is_offline(cpu))) {
		printk_safe_enter(...);
		WARN(1, "sched: Unexpected reschedule of offline CPU#%d!\n",
			 cpu);
		printk_safe_exit(...);
		return;
	}

I think, in this case John's reworked-printk can do better than
printk_safe/printk_deferred.

	-ss

  reply	other threads:[~2019-05-08  7:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07 17:33 [PATCH] RFC: x86/smp: use printk_deferred in native_smp_send_reschedule Daniel Vetter
2019-05-08  7:44 ` Sergey Senozhatsky
2019-05-08  7:53   ` Sergey Senozhatsky [this message]
2019-05-08  8:06     ` Daniel Vetter
2019-05-08  8:24       ` Sergey Senozhatsky
2019-05-08  8:14     ` Daniel Vetter
2019-05-08  8:25   ` Daniel Vetter

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=20190508075302.GC15704@jagdpanzerIV \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nstange@suse.de \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    /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