Re: [patch 4/8] x86/entry: Move irq tracing on syscall entry to C-code

Andy Lutomirski
2020-02-26T05:43:52Z

On 2/25/20 2:08 PM, Thomas Gleixner wrote:
> Now that the C entry points are safe, move the irq flags tracing code into
> the entry helper.

I'm so confused.

>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> arch/x86/entry/common.c | 5 +++++
> arch/x86/entry/entry_32.S | 12 ------------
> arch/x86/entry/entry_64.S | 2 --
> arch/x86/entry/entry_64_compat.S | 18 ------------------
> 4 files changed, 5 insertions(+), 32 deletions(-)
>
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -57,6 +57,11 @@ static inline void enter_from_user_mode(
> */
> static __always_inline void syscall_entry_fixups(void)
> {
> + /*
> + * Usermode is traced as interrupts enabled, but the syscall entry
> + * mechanisms disable interrupts. Tell the tracer.
> + */
> + trace_hardirqs_off();

Your earlier patches suggest quite strongly that tracing isn't safe
until enter_from_user_mode(). But trace_hardirqs_off() calls
trace_irq_disable_rcuidle(), which looks [0] like a tracepoint.

Did you perhaps mean to do this *after* enter_from_user_mode()?

(My tracepoint-fu is pretty bad, and I can't actually find where it's
defined as a tracepoint. But then it does nothing at all, so it must be
a tracepoint, right?)

> enter_from_user_mode();
> local_irq_enable();
> }