Re: [PATCH] usbhid: Fix lockdep unannotated irqs-off warning

From: Steven Rostedt
Date: Mon Mar 07 2016 - 12:12:00 EST


On Mon, 7 Mar 2016 11:41:37 -0500 (EST)
Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:


> It's hard to call this a compiler bug, but perhaps it is -- I don't
> know how programmers are supposed to tell CLANG that a subroutine
> modifies the Interrupt Flag in a way that the compiler shouldn't mess
> up.


I would state that this is a compiler bug for any kernel development.
Because it's modifying a global variable (IF) that can be modified by
asm(). Clang is assuming that this is userspace where IF can't change.
But because this is kernel space, the IF can (and does here), which
makes this "feature" incompatible with any (Linux or otherwise) kernel
programming.

-- Steve