On Mon, May 11, 2020 at 03:53:17PM +0200, Alexandre Chartre wrote: > > On 5/5/20 3:53 PM, Thomas Gleixner wrote: > > The pagefault handler cannot use the regular idtentry_enter() because on > > that invokes rcu_irq_enter() the pagefault was caused in the kernel. > > I am struggling to understand this part of the sentence: "because on > that invokes rcu_irq_enter() the pagefault was caused in the kernel." > > Do you mean: "because that invokes rcu_irq_enter() if the pagefault was > caused in the kernel." ?
The problem is that rcu_irq_enter() uses per-cpu state and expect rcu_irq_exit() to be called on the very same cpu we did enter on. However, #PF likes to schedule and breaks that expectation. While there are more exceptions that schedule when from userspace, #PF is the only one that does so when from kernel space, which makes is 'special'.

