[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09556880-A22B-4767-89B3-D2B2FCEBC9F5@zytor.com>
Date: Fri, 24 Feb 2017 01:06:54 -0800
From: hpa@...or.com
To: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>
CC: Arjan van de Ven <arjan@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
bp@...en8.de, jpoimboe@...hat.com, richard.weinberger@...il.com,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] x86: Implement __WARN using UD0
On February 24, 2017 12:31:15 AM PST, Peter Zijlstra <peterz@...radead.org> wrote:
>On Fri, Feb 24, 2017 at 08:43:25AM +0100, Ingo Molnar wrote:
>> The only high level question is whether we trust the trap machinery
>to generate
>> WARN_ON()s. I believe we do.
>>
>> BTW.: why not use INT3 instead of all these weird #UD opcodes? It's a
>single byte
>> opcode and we can do a quick exception table search in do_debug().
>This way we'll
>> also have irqs disabled which might help getting the message out
>before any irq
>> handler comes in and muddies the waters.
>>
>> In a sense WARN_ON()s and BUG_ON()s can be considered permanently
>installed
>> in-line kprobes, with a special, built-in handler.
>
>I've actually been looking into that. There's a bunch of 'fun' details
>that I've been checking, but I think I can make that happen.
>
>My initial patch extended the existing UD2 BUG trap to include the
>WARN,
>this is what many other architectures already do. Arjan then complained
>that some emulators terminate on UD2 and could I please not use that
>for
>WARN, at which point Borislav called my attention to UD0/UD1.
>
>So I made the UD0 change and posted (fwiw, there's a lost refresh in
>the
>patch I posted and it will not actually work).
>
>I think I'll post an update of said patch and then attempt to do the
>INT3 thing in a later patch -- that will require at least one new knob
>in the generic BUG code ...
>
>> BTW. #2: side note, GCC generated crap code here. Why didn't it do:
>
>I've seen GCC do 'wonderful' things the past few weeks. Absolutely mind
>boggling stuff.
Terminating on UD2 is really obnoxious, btw. JMPE, ICEBP/INT1, some I/O port or MSR would be appropriate choices for that, but UD2 is rude in the extreme.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Powered by blists - more mailing lists