Re: [GIT pull] timer updates for 4.9

From: Linus Torvalds
Date: Mon Oct 24 2016 - 13:17:06 EST


On Mon, Oct 24, 2016 at 7:51 AM, Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> Can you please check in the disassembly whether gcc really reloads
> timer->flags? Mine does not...

No, me neither. The code generation for lock_timer_base() looks
reasonable, although not pretty (it needs one spill for the
complexities in get_timer_cpu_base(), and the "*flags" games results
in some unnecessary indirection too).

I will try your patch, but also stare at my code some more.

I'm starting to think that the problem could be due to the timer code
being triggered _way_ too early (printk() ends up being obviously used
long before most things end up using timers), and that the problem I
see is just later fallout from that.

Sergey (added to participants) tried an earlier version of my patch,
and had more debug options enabled, and got

BUG: spinlock bad magic on CPU#0

from mod_timer() doing _raw_spin_unlock_irqrestore(), when the
printk() callchain happens very early in setup_arch ->
setup_memory_map -> e820_print_map().

So I think the timer bugs I found were _potentially_ true bugs, but
likely not the cause of this all.

init_timers() happens early, but we do printk's even earlier.

I'll add a "if (system_state > SYSTEM_BOOTING)" or something to test
that theory.

Linus