linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Question WRT early IRQ/NMI entry code
@ 2021-11-30 11:28 Nicolas Saenz Julienne
  2021-11-30 12:05 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Nicolas Saenz Julienne @ 2021-11-30 11:28 UTC (permalink / raw)
  To: linux-kernel, linux-arm-kernel, rcu
  Cc: Thomas Gleixner, Peter Zijlstra, Mark Rutland, Steven Rostedt,
	paulmck, mtosatti, frederic

Hi All,
while going over the IRQ/NMI entry code I've found a small 'inconsistency':
while in the IRQ entry path, we inform RCU of the context change *before*
incrementing the preempt counter, the opposite happens for the NMI entry
path. This applies to both arm64 and x86[1].

Actually, rcu_nmi_enter() — which is also the main RCU context switch function
for the IRQ entry path — uses the preempt counter to verify it's not in NMI
context. So it would make sense to assume all callers have the same updated
view of the preempt count, which isn't true ATM.

I'm sure there an obscure/non-obvious reason for this, right?

Thanks!
Nicolas

[1] 
IRQ path:
  -> x86_64 asm (entry_64.S)
  -> irqentry_enter() -> rcu_irq_enter() -> *rcu_nmi_enter()*
  -> run_irq_on_irqstack_cond() -> irq_exit_rcu() -> *preempt_count_add(HARDIRQ_OFFSET)*
  -> // Run IRQ...

NMI path:
  -> x86_64 asm (entry_64.S)
  -> irqentry_nmi_enter() -> __nmi_enter() -> *__preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET)*
                          -> *rcu_nmi_enter()*

For arm64, see 'arch/arm64/kernel/entry-common.c'.


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

end of thread, other threads:[~2021-12-13 16:41 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 11:28 Question WRT early IRQ/NMI entry code Nicolas Saenz Julienne
2021-11-30 12:05 ` Frederic Weisbecker
2021-11-30 12:50 ` Mark Rutland
2021-11-30 13:47 ` Thomas Gleixner
2021-11-30 14:13   ` Steven Rostedt
2021-11-30 22:31     ` [PATCH] Documentation: Fill the gaps about entry/noinstr constraints Thomas Gleixner
2021-12-01 10:56       ` Mark Rutland
2021-12-01 18:14         ` Thomas Gleixner
2021-12-01 18:23           ` Mark Rutland
2021-12-01 20:28             ` Thomas Gleixner
2021-12-01 20:35               ` [PATCH v2] " Thomas Gleixner
2021-12-02 10:03                 ` Mark Rutland
2021-12-03 20:08                 ` Paul E. McKenney
2021-12-13 10:36                   ` Nicolas Saenz Julienne
2021-12-13 16:41                     ` Paul E. McKenney
2021-12-04  3:48                 ` Randy Dunlap
2021-12-06 17:36                   ` Mark Rutland
2021-12-06 17:53                     ` Paul E. McKenney
2021-12-06 21:24                       ` Randy Dunlap
2021-12-06 21:36                         ` Paul E. McKenney
2021-11-30 15:13   ` Question WRT early IRQ/NMI entry code Nicolas Saenz Julienne

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).