Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1507646

Re: [GIT pull] timer updates for 4.9

Path csiph.com!news.mixmin.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: [GIT pull] timer updates for 4.9
Date Mon, 24 Oct 2016 21:20:02 +0200
Message-ID <svSWS-3rd-31@gated-at.bofh.it> (permalink)
References <sv3hD-3en-11@gated-at.bofh.it> <svzKy-785-51@gated-at.bofh.it> <svAng-7PA-5@gated-at.bofh.it> <svK3f-5Kp-9@gated-at.bofh.it> <svOTf-vq-19@gated-at.bofh.it> <svR4J-2cv-11@gated-at.bofh.it>
User-Agent Alpine 2.20 (DEB 67 2015-01-07)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 62
Organization linux.* mail to news gateway
X-Original-Cc Sergey Senozhatsky <sergey.senozhatsky@gmail.com>, LKML <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>
X-Original-Date Mon, 24 Oct 2016 21:09:05 +0200 (CEST)
X-Original-Message-ID <alpine.DEB.2.20.1610242048570.4815@nanos>
X-Original-References <alpine.DEB.2.20.1610221356280.4885@nanos> <CA+55aFw3caJpp36sciVin6=GQF_eHpAHMd2J0bxwrcKoWiuiog@mail.gmail.com> <CA+55aFyDAWBNfyYM_BG2D5-g1skj=iCkhfW9ZNA_h2zZDdfy_g@mail.gmail.com> <alpine.DEB.2.20.1610240947160.4872@nanos> <alpine.DEB.2.20.1610241638170.4983@nanos> <CA+55aFysd6G2Se9DJXmfJdWieksHVHBzoxkK5982iuu3MTArkQ@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1507646

Show key headers only | View raw


On Mon, 24 Oct 2016, Linus Torvalds wrote:
> On Mon, Oct 24, 2016 at 7:51 AM, Thomas Gleixner <tglx@linutronix.de> 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

Weird, that should have triggered in raw_spin_lock() already.

Can you bounce me the patch you are currently testing?

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

These are the things which are not initialized:

1) base->spinlock

   That's a non issue for !debug kernels as the lock initializer is 0
   (unlocked).

2) base->clk
 
   That makes the timer queued at some random array bucket.

3) base->cpu

   That's a non issue as base->cpu is 0 and at this point you are on CPU 0
   and the stupid NOHZ remote queueing is not yet possible.

The hlist_head is not touched by init_timers() as it's NULL initialized
already, so we do not scribble over an already queued timer.

So anything you queue _before_ init_timers() will just be queued to some
random bucket, but it does not explain the wreckage you are seing.

Thanks,

	tglx

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-22 14:10 +0200
  Re: [GIT pull] timer updates for 4.9 Linus Torvalds <torvalds@linux-foundation.org> - 2016-10-24 00:50 +0200
    Re: [GIT pull] timer updates for 4.9 Linus Torvalds <torvalds@linux-foundation.org> - 2016-10-24 01:30 +0200
      Re: [GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-24 11:50 +0200
        Re: [GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-24 17:00 +0200
          Re: [GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-24 17:20 +0200
            [tip:timers/urgent] timers: Plug locking race vs. timer migration tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-10-25 17:00 +0200
            [tip:timers/urgent] timers: Lock base for same bucket optimization tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-10-25 17:00 +0200
          Re: [GIT pull] timer updates for 4.9 Linus Torvalds <torvalds@linux-foundation.org> - 2016-10-24 19:20 +0200
            Re: [GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-24 21:20 +0200
              Re: [GIT pull] timer updates for 4.9 Thomas Gleixner <tglx@linutronix.de> - 2016-10-24 23:40 +0200

csiph-web