public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Laurent Dufour <ldufour@linux.vnet.ibm.com>,
	Andrew Morton <akpm@osdl.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: Do not bug in __sched_setscheduler() when pi is not used
Date: Mon, 19 Nov 2018 16:13:11 +0100	[thread overview]
Message-ID: <20181119151311.GA5340@kroah.com> (raw)
In-Reply-To: <46a07263-3327-94b6-f6b8-a0a17ae7bfee@broadcom.com>

On Wed, Nov 14, 2018 at 12:55:20PM -0800, Florian Fainelli wrote:
> On 3/9/17 7:18 AM, Steven Rostedt wrote:
> > From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> > 
> > 
> > When priority inheritance was added back in 2.6.18 to sched_setscheduler, it
> > added a path to taking an rt-mutex wait_lock, which is not IRQ safe. As PI
> > is not a common occurrence, lockdep will likely never trigger if
> > sched_setscheduler was called from interrupt context. A BUG_ON() was added
> > to trigger if __sched_setscheduler() was ever called from interrupt context
> > because there was a possibility to take the wait_lock.
> > 
> > Today the wait_lock is irq safe, but the path to taking it in
> > sched_setscheduler() is the same as the path to taking it from normal
> > context. The wait_lock is taken with raw_spin_lock_irq() and released with
> > raw_spin_unlock_irq() which will indiscriminately enable interrupts,
> > which would be bad in interrupt context.
> > 
> > The problem is that normalize_rt_tasks, which is called by triggering the
> > sysrq nice-all-RT-tasks was changed to call __sched_setscheduler(), and this
> > is done from interrupt context!
> > 
> > Now __sched_setscheduler() takes a "pi" parameter that is used to know if
> > the priority inheritance should be called or not. As the BUG_ON() only cares
> > about calling the PI code, it should only bug if called from interrupt
> > context with the "pi" parameter set to true.
> > 
> > Link: http://lkml.kernel.org/r/20170308124654.10e598f2@gandalf.local.home
> > 
> > Reported-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> > Tested-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> > Fixes: dbc7f069b93a ("sched: Use replace normalize_task() with __sched_setscheduler()")
> > Cc: Andrew Morton <akpm@osdl.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@elte.hu>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> 
> Can this patch also be applied to the stable trees? The offending commit
> was first introduced in 4.2.

What is the git commit id of this patch in Linus's tree?

thanks,

greg k-h

  reply	other threads:[~2018-11-19 15:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-09 15:18 [PATCH] sched: Do not bug in __sched_setscheduler() when pi is not used Steven Rostedt
2017-05-16 22:55 ` Steven Rostedt
2017-05-17  6:56   ` Peter Zijlstra
2018-11-14 20:55 ` Florian Fainelli
2018-11-19 15:13   ` Greg KH [this message]
2018-11-19 15:46     ` Steven Rostedt
2018-11-19 16:24       ` Greg KH
2018-11-19 16:35         ` Steven Rostedt
2018-11-19 19:09           ` Florian Fainelli
2018-11-19 19:27             ` Steven Rostedt
2018-11-29 12:23               ` Greg KH

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=20181119151311.GA5340@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@osdl.org \
    --cc=f.fainelli@gmail.com \
    --cc=ldufour@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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