mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	Andrew Morton <akpm@linux-foundation.org>,
	werner <w.landgraf@ru.ru>, "H. Peter Anvin" <hpa@zytor.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [block IO crash] Re: 2.6.39-rc5-git2 boot crashs
Date: Wed, 4 May 2011 13:11:34 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.02.1105041233280.3005@ionos> (raw)
In-Reply-To: <20110504101932.GA3392@elte.hu>

On Wed, 4 May 2011, Ingo Molnar wrote:

> 
> * Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> > But I rather suspect, that CONFIG_SLUB=y is the thing we need to look at. The 
> > lockless fastpath cmpxchg comes to my mind.
> 
> Hm, and CONFIG_X86_ELAN, as Linus noted, has an impact on the cmpxchg 
> implementation.

Exactly. With ELAN CONFIG_X86_CMPXCHG64 is not set. When I disable
ELAN it's set.

> > Either we generate broken code with that ELAN caused options or that combo 
> > triggers some hidden problem in SLUB.
> 
> Note that the crash went away with SLUB_DEBUG=y and PAGEALLOC=y and 
> SLUB_DEBUG=y would certainly narrow any lockless-SLUB race windows.

Well, it's pretty simple:

CONFIG_X86_CMPXCHG64=y compiles this_cpu_generic_cmpxchg_double() into:

    28f7:       89 f9                   mov    %edi,%ecx
    28f9:       8b 3e                   mov    (%esi),%edi
    28fb:       89 45 e4                mov    %eax,-0x1c(%ebp)
    28fe:       89 c3                   mov    %eax,%ebx
    2900:       8b 45 f0                mov    -0x10(%ebp),%eax
    2903:       64 0f c7 0f             cmpxchg8b %fs:(%edi)
    2907:       0f 94 c0                sete   %al
    290a:       84 c0                   test   %al,%al
    290c:       88 45 e4                mov    %al,-0x1c(%ebp)
    290f:       74 a4                   je     28b5 <kmem_cache_alloc+0x29>

while CONFIG_X86_CMPXCHG64=n results in:

    28b0:       8b 03                   mov    (%ebx),%eax
    28b2:       64 8b 30                mov    %fs:(%eax),%esi
    28b5:       39 d6                   cmp    %edx,%esi
    28b7:       75 d2                   jne    288b <kmem_cache_alloc+0x26>
    28b9:       64 8b 50 04             mov    %fs:0x4(%eax),%edx
    28bd:       39 ca                   cmp    %ecx,%edx
    28bf:       75 ca                   jne    288b <kmem_cache_alloc+0x26>
    28c1:       8b 4b 14                mov    0x14(%ebx),%ecx
    28c4:       8b 0c 0e                mov    (%esi,%ecx,1),%ecx
    28c7:       64 89 08                mov    %ecx,%fs:(%eax)
    28ca:       8b 03                   mov    (%ebx),%eax
    28cc:       42                      inc    %edx
    28cd:       64 89 50 04             mov    %edx,%fs:0x4(%eax)

And that code runs with preemption enabled. So when the task gets
preempted _BEFORE_ it has actuallty written back the data, then the
race window is wide open.

I'm still trying to understand that macro hell which actually
generates that code. I always thought that George Anzingers macro maze
was horrible, but that's even worse.

Thanks,

	tglx

  parent reply	other threads:[~2011-05-04 11:11 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 22:28 werner
2011-05-02 23:24 ` Linus Torvalds
     [not found]   ` <web-516990066@zbackend1.aha.ru>
2011-05-03 15:22     ` Linus Torvalds
2011-05-03 19:08       ` Ingo Molnar
2011-05-03 20:17         ` Linus Torvalds
2011-05-03 20:20           ` H. Peter Anvin
2011-05-03 20:50             ` Ingo Molnar
2011-05-03 21:45               ` Linus Torvalds
2011-05-03 22:01                 ` H. Peter Anvin
2011-05-04  7:19                 ` Borislav Petkov
2011-05-04  7:38                   ` Ingo Molnar
2011-05-04  7:55                     ` Borislav Petkov
2011-05-04  8:35           ` [block IO crash] " Ingo Molnar
2011-05-04  9:52             ` Thomas Gleixner
2011-05-04 10:19               ` Ingo Molnar
2011-05-04 10:25                 ` Ingo Molnar
2011-05-04 10:33                   ` Ingo Molnar
2011-05-04 12:37                     ` Ingo Molnar
2011-05-04 12:36                   ` Ingo Molnar
2011-05-04 11:11                 ` Thomas Gleixner [this message]
2011-05-04 11:16                   ` Pekka Enberg
2011-05-04 11:27                     ` Tejun Heo
2011-05-04 12:51                       ` Pekka Enberg
2011-05-04 12:57                         ` Ingo Molnar
2011-05-04 13:02                           ` Thomas Gleixner
2011-05-04 13:00                       ` Thomas Gleixner
2011-05-04 13:20                         ` Tejun Heo
2011-05-04 14:10                           ` Thomas Gleixner
2011-05-04 14:14                             ` Ingo Molnar
2011-05-04 14:36                               ` [PATCH] slub: Fix the lockless code on 32-bit platforms with no 64-bit cmpxchg Ingo Molnar
2011-05-04 14:42                                 ` Christoph Lameter
2011-05-04 16:30                                 ` Ingo Molnar
2011-05-04 21:52                                 ` Ben Greear
2011-05-04 22:00                                   ` Linus Torvalds
2011-05-04 22:22                                     ` Ben Greear
2011-05-04 14:19                             ` [block IO crash] Re: 2.6.39-rc5-git2 boot crashs Christoph Lameter
2011-05-04 14:25                             ` Tejun Heo
2011-05-04 14:35                               ` Christoph Lameter
2011-05-04 15:20                                 ` Ingo Molnar
2011-05-04 14:46                               ` Thomas Gleixner
2011-05-04 15:00                                 ` Christoph Lameter
2011-05-04 15:13                                   ` Linus Torvalds
2011-05-04 15:28                                     ` Christoph Lameter
2011-05-04 15:37                                       ` Pekka Enberg
2011-05-04 15:53                                         ` Linus Torvalds
2011-05-04 18:20                                           ` Linus Torvalds
2011-05-04 18:49                                             ` Christoph Lameter
2011-05-04 19:07                                               ` Linus Torvalds
2011-05-04 19:30                                                 ` Christoph Lameter
2011-05-04 19:38                                                   ` Linus Torvalds
2011-05-04 20:04                                                     ` Christoph Lameter
2011-05-04 20:21                                                       ` Valdis.Kletnieks
2011-05-04 20:32                                                         ` Christoph Lameter
2011-05-04 20:49                                                           ` Ingo Molnar
2011-05-04 21:06                                                       ` Linus Torvalds
2011-05-04 21:19                                                         ` Linus Torvalds
2011-05-04 21:40                                                           ` Thomas Gleixner
2011-05-05  9:54                                                             ` Tejun Heo
2011-05-05 10:18                                                               ` Ingo Molnar
2011-05-05 10:45                                                               ` Thomas Gleixner
2011-05-05 18:20                                                               ` Christoph Lameter
2011-05-05 19:13                                                                 ` Ingo Molnar
2011-05-05 19:53                                                               ` werner
2011-05-05 20:09                                                                 ` Christoph Lameter
2011-05-05 21:12                                                                   ` werner
2011-05-05 22:27                                                                     ` Thomas Gleixner
     [not found]                                             ` <web-518008166@zbackend1.aha.ru>
     [not found]                                               ` <web-518059420@zbackend1.aha.ru>
     [not found]                                                 ` <20110505060204.GA28015@elte.hu>
2011-05-05  6:46                                                   ` werner
2011-05-04 15:37                                       ` [block IO crash] " Linus Torvalds
2011-05-04 16:08                                         ` Christoph Lameter
2011-05-04 16:50                                     ` Ingo Molnar
2011-05-04 17:12                                       ` Thomas Gleixner
2011-05-04 15:41                                   ` Pekka Enberg
2011-05-04 13:22                         ` Ingo Molnar
2011-05-04 14:21                         ` Christoph Lameter
2011-05-04 14:04                     ` Christoph Lameter
2011-05-04 14:07                       ` Tejun Heo
2011-05-04 14:21                       ` Thomas Gleixner
2011-05-04 10:13             ` Ingo Molnar
2011-05-04 10:41               ` Ingo Molnar
2011-05-04 10:45                 ` Ingo Molnar
2011-05-04 11:06                   ` Ingo Molnar
2011-05-04 12:37                     ` Ingo Molnar
2011-05-04 12:47                       ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.02.1105041233280.3005@ionos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.org \
    --cc=w.landgraf@ru.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome