[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a37be173-6702-5523-8757-2b5a1b4ae311@suse.com>
Date: Wed, 9 Dec 2020 15:05:39 +0100
From: Jürgen Groß <jgross@...e.com>
To: Mark Rutland <mark.rutland@....com>,
Andy Lutomirski <luto@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Stefano Stabellini <sstabellini@...nel.org>,
"VMware, Inc." <pv-drivers@...are.com>, X86 ML <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux Virtualization <virtualization@...ts.linux-foundation.org>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
xen-devel <xen-devel@...ts.xenproject.org>,
Thomas Gleixner <tglx@...utronix.de>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>
Subject: Re: [PATCH v2 05/12] x86: rework arch_local_irq_restore() to not use
popf
On 09.12.20 15:02, Mark Rutland wrote:
> On Wed, Dec 09, 2020 at 01:27:10PM +0000, Mark Rutland wrote:
>> On Sun, Nov 22, 2020 at 01:44:53PM -0800, Andy Lutomirski wrote:
>>> On Sat, Nov 21, 2020 at 10:55 PM Jürgen Groß <jgross@...e.com> wrote:
>>>> On 20.11.20 12:59, Peter Zijlstra wrote:
>>>>> If someone were to write horrible code like:
>>>>>
>>>>> local_irq_disable();
>>>>> local_irq_save(flags);
>>>>> local_irq_enable();
>>>>> local_irq_restore(flags);
>>>>>
>>>>> we'd be up some creek without a paddle... now I don't _think_ we have
>>>>> genius code like that, but I'd feel saver if we can haz an assertion in
>>>>> there somewhere...
>
>> I was just talking to Peter on IRC about implementing the same thing for
>> arm64, so could we put this in the generic irqflags code? IIUC we can
>> use raw_irqs_disabled() to do the check.
>>
>> As this isn't really entry specific (and IIUC the cases this should
>> catch would break lockdep today), maybe we should add a new
>> DEBUG_IRQFLAGS for this, that DEBUG_LOCKDEP can also select?
>>
>> Something like:
>>
>> #define local_irq_restore(flags) \
>> do { \
>> if (!raw_irqs_disabled_flags(flags)) { \
>> trace_hardirqs_on(); \
>> } else if (IS_ENABLED(CONFIG_DEBUG_IRQFLAGS) { \
>> if (unlikely(raw_irqs_disabled()) \
>
> Whoops; that should be !raw_irqs_disabled().
>
>> warn_bogus_irqrestore(); \
>> } \
>> raw_local_irq_restore(flags); \
>> } while (0)
>>
>> ... perhaps? (ignoring however we deal with once-ness).
>
> If no-one shouts in the next day or two I'll spin this as its own patch.
Fine with me. So I'll just ignore a potential error case in my patch.
Thanks,
Juergen
Download attachment "OpenPGP_0xB0DE9DD628BF132F.asc" of type "application/pgp-keys" (3092 bytes)
Download attachment "OpenPGP_signature" of type "application/pgp-signature" (496 bytes)
Powered by blists - more mailing lists