Re: [PATCH 4.19 37/48] x86/entry/64: Fix unwind hints in register clearing code

From: Josh Poimboeuf
Date: Thu May 14 2020 - 15:27:51 EST


On Wed, May 13, 2020 at 11:48:56PM +0200, Pavel Machek wrote:
> On Wed 2020-05-13 11:45:03, Greg Kroah-Hartman wrote:
> > From: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
> >
> > commit 06a9750edcffa808494d56da939085c35904e618 upstream.
> >
> > The PUSH_AND_CLEAR_REGS macro zeroes each register immediately after
> > pushing it. If an NMI or exception hits after a register is cleared,
> > but before the UNWIND_HINT_REGS annotation, the ORC unwinder will
> > wrongly think the previous value of the register was zero. This can
> > confuse the unwinding process and cause it to exit early.
> >
> > Because ORC is simpler than DWARF, there are a limited number of unwind
> > annotation states, so it's not possible to add an individual unwind hint
> > after each push/clear combination. Instead, the register clearing
> > instructions need to be consolidated and moved to after the
> > UNWIND_HINT_REGS annotation.
>
> This actually makes kernel entry/exit slower, due to poor instruction
> scheduling. And that is a bit of hot path... Is it strictly
> neccessary? Not everyone needs ORC scheduler. Should it be somehow
> optional?

I didn't measure a difference beyond the noise level, did you?

--
Josh