From: "Michel Dänzer" <michel@daenzer.net>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Jakub Jelinek <jakub@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Debian GCC Maintainers <debian-gcc@lists.debian.org>,
Debian Kernel Team <debian-kernel@lists.debian.org>
Subject: Re: Random panic in load_balance() with 3.16-rc
Date: Fri, 25 Jul 2014 10:25:03 +0900 [thread overview]
Message-ID: <53D1B1EF.7030603@daenzer.net> (raw)
In-Reply-To: <CA+55aFyJhqiPv0kQ+51=Ei-zaAO+0JszxtnEyx-Gbto3SE00xw@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3808 bytes --]
[ Adding the Debian kernel and gcc teams to Cc ]
On 25.07.2014 03:47, Linus Torvalds wrote:
> On Wed, Jul 23, 2014 at 6:43 PM, Michel Dänzer <michel@daenzer.net> wrote:
>>>
>>> Michel, mind doing
>>>
>>> make kernel/sched/fair.s
>>>
>>> and sending us the resulting file?
>>
>> Here it is, gzipped, hope that's okay.
>>
>> Note that my tree is now based on 3.16-rc6.
>
> Ok, so I'm looking at the code generation and your compiler is pure
> and utter *shit*.
>
> Adding Jakub to the cc, because gcc-4.9.0 seems to be terminally broken.
>
> Lookie here, your compiler does some absolutely insane things with the
> spilling, including spilling a *constant*. For chrissake, that
> compiler shouldn't have been allowed to graduate from kindergarten.
> We're talking "sloth that was dropped on the head as a baby" level
> retardation levels here:
>
> ...
> movq $load_balance_mask, -136(%rbp) #, %sfp
> subq $184, %rsp #,
> movq (%rdx), %rax # sd_22(D)->parent, sd_parent
> movl %edi, -144(%rbp) # this_cpu, %sfp
> movl %ecx, -140(%rbp) # idle, %sfp
> movq %r8, -200(%rbp) # continue_balancing, %sfp
> movq %rax, -184(%rbp) # sd_parent, %sfp
> movq -136(%rbp), %rax # %sfp, tcp_ptr__
> #APP
> add %gs:this_cpu_off, %rax # this_cpu_off, tcp_ptr__
> #NO_APP
> ...
>
> Note the contents of -136(%rbp). Seriously. That's an
> _immediate_constant_ that the compiler is spilling.
>
> Somebody needs to raise that as a gcc bug. Because it damn well is
> some seriously crazy shit.
>
> However, that constant spilling part just counts as "too stupid to
> live". The real bug is this:
>
> movq $load_balance_mask, -136(%rbp) #, %sfp
> subq $184, %rsp #,
>
> where gcc creates the stack frame *after* having already used it to
> save that constant *deep* below the stack frame.
>
> The x86-64 ABI specifies a 128-byte red-zone under the stack pointer,
> and this is ok by that limit. It looks like it's illegal (136 > 128),
> but the fact is, we've had four "pushq"s to update %rsp since loading
> the frame pointer, so it's just *barely* legal with the red-zoning.
>
> But we build the kernel with -mno-red-zone. We do *not* follow the
> x86-64 ABI wrt redzoning, because we *cannot*: interrupts while in
> kernel mode *will* use the stack without a redzone. So that
> "-mno-red-zone" is not some "optional guideline". It's a hard and
> harsh requirement for the kernel, and gcc-4.9 is a buggy piece of shit
> for ignoring it. And your bug happens becuase you happen to hit an
> interrupt _just_ in that single instruction window (or perhaps hit
> some other similar case and corrupted kernel data structures earlier).
>
> Now, I suspect that this redzoning bug might actually be related to
> the fact that gcc is stupid in spilling a constant. I would not be
> surprised if there is some liveness analysis going on to decide *when*
> to insert the stack decrement, and constants are being ignored because
> clearly liveness isn't an issue for a constant value. So the two bugs
> ("stupid constant spilling" and "invalid use or red zone stack") go
> hand in hand. But who knows.
>
> Anyway, this is not a kernel bug. This is your compiler creating
> completely broken code. We may need to add a warning to make sure
> nobody compiles with gcc-4.9.0, and the Debian people should probably
> downgrate their shiny new compiler.
Attached is fair.s from Debian gcc 4.8.3-5. Does that look better? I'm
going to try reproducing the problem with a kernel built by that now.
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
[-- Attachment #2: fair.s-4.8.3-5.gz --]
[-- Type: application/gzip, Size: 185309 bytes --]
next prev parent reply other threads:[~2014-07-25 1:25 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <53C77BB8.6030804@daenzer.net>
2014-07-17 7:58 ` Random panic in load_balance() with 3.16-rc Peter Zijlstra
2014-07-18 9:29 ` Michel Dänzer
2014-07-22 6:13 ` Michel Dänzer
2014-07-23 3:53 ` Michel Dänzer
2014-07-23 4:21 ` Linus Torvalds
2014-07-23 6:49 ` Peter Zijlstra
2014-07-23 8:05 ` Michel Dänzer
2014-07-23 8:28 ` Peter Zijlstra
2014-07-23 9:25 ` Peter Zijlstra
2014-07-23 9:31 ` Michel Dänzer
2014-07-23 9:45 ` Dietmar Eggemann
2014-07-23 11:11 ` Peter Zijlstra
2014-07-23 11:30 ` Peter Zijlstra
2014-07-23 14:24 ` Peter Zijlstra
2014-07-23 14:38 ` Michel Dänzer
2014-07-23 15:51 ` Linus Torvalds
[not found] ` <20140723155526.GW3935@laptop>
2014-07-23 16:54 ` Linus Torvalds
2014-07-23 17:03 ` Peter Zijlstra
2014-07-23 17:12 ` Linus Torvalds
2014-07-23 17:26 ` Linus Torvalds
2014-07-23 18:25 ` Peter Zijlstra
2014-07-23 18:35 ` Linus Torvalds
2014-07-23 18:41 ` Peter Zijlstra
2014-07-23 18:55 ` Linus Torvalds
2014-07-23 19:02 ` Peter Zijlstra
2014-07-23 19:20 ` Linus Torvalds
2014-07-24 1:43 ` Michel Dänzer
2014-07-24 18:47 ` Linus Torvalds
2014-07-24 18:59 ` Peter Zijlstra
2014-07-25 1:25 ` Michel Dänzer [this message]
2014-07-25 2:33 ` Linus Torvalds
2014-07-25 2:50 ` Nick Krause
2014-07-25 2:36 ` Nick Krause
2014-07-25 3:55 ` Alexei Starovoitov
2014-07-25 4:00 ` Nick Krause
2014-07-25 14:02 ` Steven Rostedt
2014-07-25 18:29 ` Linus Torvalds
2014-07-25 19:10 ` Steven Rostedt
2014-07-25 20:01 ` Linus Torvalds
2014-07-25 20:13 ` Steven Rostedt
2014-07-25 21:25 ` Jakub Jelinek
2014-07-26 18:28 ` Linus Torvalds
2014-07-26 18:39 ` Linus Torvalds
2014-07-26 19:35 ` Markus Trippelsdorf
2014-07-26 19:55 ` Theodore Ts'o
2014-07-26 20:20 ` Markus Trippelsdorf
2014-07-26 22:08 ` Jakub Jelinek
2014-07-26 19:56 ` Linus Torvalds
2014-07-26 20:03 ` Linus Torvalds
2014-07-26 20:19 ` Markus Trippelsdorf
2014-07-26 20:39 ` Linus Torvalds
2014-07-28 12:26 ` Frank Ch. Eigler
2014-07-28 13:10 ` Theodore Ts'o
2014-07-28 14:11 ` Frank Ch. Eigler
2014-07-28 16:45 ` Linus Torvalds
2014-07-28 17:27 ` Alexei Starovoitov
2014-07-28 18:09 ` Markus Trippelsdorf
2014-07-28 18:28 ` Linus Torvalds
2014-07-28 18:41 ` Markus Trippelsdorf
2014-07-29 8:58 ` Jakub Jelinek
2014-07-28 19:50 ` Theodore Ts'o
2014-07-28 3:47 ` Michel Dänzer
2014-07-28 16:48 ` Linus Torvalds
2014-07-29 2:29 ` Michel Dänzer
2014-08-05 3:19 ` Steven Rostedt
2014-07-26 18:02 ` Steven Chamberlain
2014-07-29 9:20 ` Michel Dänzer
2014-07-25 6:48 ` Jakub Jelinek
2014-07-25 8:15 ` Linus Torvalds
2014-07-25 9:03 ` Michel Dänzer
2014-07-25 9:21 ` Markus Trippelsdorf
2014-07-25 9:42 ` Markus Trippelsdorf
2014-07-23 18:07 ` Linus Torvalds
2014-07-23 18:31 ` Peter Zijlstra
2014-07-23 18:24 ` Peter Zijlstra
2014-07-23 17:04 ` Peter Zijlstra
2014-07-23 17:15 ` Linus Torvalds
2014-07-23 18:25 ` Peter Zijlstra
2014-07-23 18:23 ` Peter Zijlstra
2014-07-23 10:52 ` Peter Zijlstra
2014-07-24 7:18 ` Michel Dänzer
2014-07-24 7:51 ` Peter Zijlstra
2014-07-24 9:55 ` Peter Zijlstra
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=53D1B1EF.7030603@daenzer.net \
--to=michel@daenzer.net \
--cc=debian-gcc@lists.debian.org \
--cc=debian-kernel@lists.debian.org \
--cc=jakub@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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