public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Reconciling rcu_irq_enter()/rcu_nmi_enter() with context tracking
@ 2015-07-17  1:53 Andy Lutomirski
  2015-07-17  4:29 ` Paul E. McKenney
  2015-07-18 13:00 ` Frederic Weisbecker
  0 siblings, 2 replies; 15+ messages in thread
From: Andy Lutomirski @ 2015-07-17  1:53 UTC (permalink / raw)
  To: Sasha Levin, Frédéric Weisbecker, Paul McKenney,
	linux-kernel@vger.kernel.org, Peter Zijlstra, X86 ML,
	Rik van Riel

For reasons that mystify me a bit, we currently track context tracking
state separately from rcu's watching state.  This results in strange
artifacts: nothing generic cause IRQs to enter CONTEXT_KERNEL, and we
can nest exceptions inside the IRQ handler (an example would be
wrmsr_safe failing), and, in -next, we splat a warning:

https://gist.github.com/sashalevin/a006a44989312f6835e7

I'm trying to make context tracking more exact, which will fix this
issue (the particular splat that Sasha hit shouldn't be possible when
I'm done), but I think it would be nice to unify all of this stuff.
Would it be plausible for us to guarantee that RCU state is always in
sync with context tracking state?  If so, we could maybe simplify
things and have fewer state variables.

Doing this for NMIs might be weird.  Would it make sense to have a
CONTEXT_NMI that's somehow valid even if the NMI happened while
changing context tracking state.

Thoughts?  As it stands, I think we might already be broken for real:

Syscall -> user_exit.  Perf NMI hits *during* user_exit.  Perf does
copy_from_user_nmi, which can fault, causing do_page_fault to get
called, which calls exception_enter(), which can't be a good thing.

RCU is okay (sort of) because of rcu_nmi_enter, but this seems very fragile.

Thoughts?  As it stands, I need to do something because -tip and thus
-next spews occasional warnings.

--Andy

-- 
Andy Lutomirski
AMA Capital Management, LLC

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-07-18 13:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17  1:53 Reconciling rcu_irq_enter()/rcu_nmi_enter() with context tracking Andy Lutomirski
2015-07-17  4:29 ` Paul E. McKenney
2015-07-17  4:49   ` Paul E. McKenney
2015-07-17 18:59     ` Andy Lutomirski
2015-07-17 20:12       ` Paul E. McKenney
2015-07-17 20:32         ` Andy Lutomirski
2015-07-17 21:19           ` Paul E. McKenney
2015-07-17 21:22             ` Paul E. McKenney
2015-07-17 22:45               ` Andy Lutomirski
2015-07-17 22:13             ` Andy Lutomirski
2015-07-17 22:55               ` Paul E. McKenney
2015-07-17 23:20                 ` Andy Lutomirski
2015-07-18  0:04                   ` Paul E. McKenney
2015-07-18 13:12       ` Frederic Weisbecker
2015-07-18 13:00 ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox