Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755380AbcCBQYZ (ORCPT ); Wed, 2 Mar 2016 11:24:25 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:39224 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbcCBQYX (ORCPT ); Wed, 2 Mar 2016 11:24:23 -0500 Date: Wed, 2 Mar 2016 17:24:12 +0100 From: Peter Zijlstra To: Sedat Dilek Cc: Steven Rostedt , Jiri Kosina , Tejun Heo , Lai Jiangshan , Benjamin Tissoires , Paul McKenney , Andy Lutomirski , LKML , linux-usb@vger.kernel.org, Greg Kroah-Hartman , Alan Stern , Felipe Balbi , Ingo Molnar Subject: Re: [PATCH] usbhid: Fix lockdep unannotated irqs-off warning Message-ID: <20160302162412.GI6357@twins.programming.kicks-ass.net> References: <20151012205755.7ad86f4c@grimm.local.home> <20160301100740.759440b7@gandalf.local.home> <20160301151700.GU6356@twins.programming.kicks-ass.net> <20160302151713.GG6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9778 Lines: 171 On Wed, Mar 02, 2016 at 04:53:36PM +0100, Sedat Dilek wrote: > ffffffff8110f570 : > ffffffff8110f570: 55 push %rbp > ffffffff8110f571: 48 89 e5 mov %rsp,%rbp > ffffffff8110f574: 41 57 push %r15 > ffffffff8110f576: 41 56 push %r14 > ffffffff8110f578: 53 push %rbx > ffffffff8110f579: 48 83 ec 28 sub $0x28,%rsp stack offset is 0x28 bytes [*] > ffffffff8110f57d: 48 89 fb mov %rdi,%rbx > ffffffff8110f580: e8 6b 6e 80 00 callq ffffffff819163f0 > ffffffff8110f585: e8 66 6e 80 00 callq ffffffff819163f0 > ffffffff8110f58a: e8 61 6e 80 00 callq ffffffff819163f0 > ffffffff8110f58f: e8 5c 6e 80 00 callq ffffffff819163f0 Your compiler is on drugs! > ffffffff8110f594: 9c pushfq > ffffffff8110f595: 8f 45 e0 popq -0x20(%rbp) Saves flags in -0x20(%rbp) > ffffffff8110f598: 4c 8b 7d e0 mov -0x20(%rbp),%r15 And in %r15 /me wonders what's wrong with: popf %r15 > ffffffff8110f59c: e8 4f 6e 80 00 callq ffffffff819163f0 > ffffffff8110f5a1: e8 4a 6e 80 00 callq ffffffff819163f0 > ffffffff8110f5a6: fa cli > ffffffff8110f5a7: e8 84 cb fc ff callq ffffffff810dc130 > ffffffff8110f5ac: 4c 8d 73 50 lea 0x50(%rbx),%r14 > ffffffff8110f5b0: 48 c7 04 24 b0 f5 10 movq $0xffffffff8110f5b0,(%rsp) > ffffffff8110f5b7: 81 > ffffffff8110f5b8: 31 f6 xor %esi,%esi > ffffffff8110f5ba: 31 d2 xor %edx,%edx > ffffffff8110f5bc: 31 c9 xor %ecx,%ecx > ffffffff8110f5be: 41 b8 01 00 00 00 mov $0x1,%r8d > ffffffff8110f5c4: 45 31 c9 xor %r9d,%r9d > ffffffff8110f5c7: 4c 89 f7 mov %r14,%rdi > ffffffff8110f5ca: e8 c1 e5 fc ff callq ffffffff810ddb90 > ffffffff8110f5cf: be 01 00 00 00 mov $0x1,%esi > ffffffff8110f5d4: 48 c7 c2 cf f5 10 81 mov $0xffffffff8110f5cf,%rdx > ffffffff8110f5db: 4c 89 f7 mov %r14,%rdi > ffffffff8110f5de: e8 8d 08 fd ff callq ffffffff810dfe70 > ffffffff8110f5e3: e8 08 6e 80 00 callq ffffffff819163f0 > ffffffff8110f5e8: 4c 89 f8 mov %r15,%rax > ffffffff8110f5eb: 49 89 c6 mov %rax,%r14 Moves r15 into r14 through rax > ffffffff8110f5ee: f6 c4 02 test $0x2,%ah > ffffffff8110f5f1: 75 19 jne ffffffff8110f60c > ffffffff8110f5f3: e8 f8 6d 80 00 callq ffffffff819163f0 > ffffffff8110f5f8: e8 f3 6d 80 00 callq ffffffff819163f0 > ffffffff8110f5fd: 4c 89 75 d0 mov %r14,-0x30(%rbp) > ffffffff8110f601: ff 75 d0 pushq -0x30(%rbp) > ffffffff8110f604: 9d popfq put r14 into -0x30(rbp) and pushes/pops that, see [*] this is 8 bytes over stack ?! > ffffffff8110f605: e8 26 cb fc ff callq ffffffff810dc130 > ffffffff8110f60a: eb 17 jmp ffffffff8110f623 > ffffffff8110f60c: e8 2f cb fc ff callq ffffffff810dc140 > ffffffff8110f611: e8 da 6d 80 00 callq ffffffff819163f0 > ffffffff8110f616: e8 d5 6d 80 00 callq ffffffff819163f0 > ffffffff8110f61b: 4c 89 75 d8 mov %r14,-0x28(%rbp) > ffffffff8110f61f: ff 75 d8 pushq -0x28(%rbp) > ffffffff8110f622: 9d popfq puts r14 into -0x28(rbp) and pushes/pops that > ffffffff8110f623: e8 c8 6d 80 00 callq ffffffff819163f0 > ffffffff8110f628: 65 8b 04 25 d4 ae 00 mov %gs:0xaed4,%eax > ffffffff8110f62f: 00 > ffffffff8110f630: a9 00 00 0f 00 test $0xf0000,%eax > ffffffff8110f635: 74 25 je ffffffff8110f65c > ffffffff8110f637: f6 43 2a 20 testb $0x20,0x2a(%rbx) > ffffffff8110f63b: 75 1f jne ffffffff8110f65c > ffffffff8110f63d: 48 c7 c7 04 54 c5 81 mov $0xffffffff81c55404,%rdi > ffffffff8110f644: be 61 04 00 00 mov $0x461,%esi > ffffffff8110f649: e8 12 c4 f6 ff callq ffffffff8107ba60 > ffffffff8110f64e: eb 0c jmp ffffffff8110f65c > ffffffff8110f650: e8 9b 6d 80 00 callq ffffffff819163f0 > ffffffff8110f655: e8 96 6d 80 00 callq ffffffff819163f0 > ffffffff8110f65a: f3 90 pause > ffffffff8110f65c: 48 89 df mov %rbx,%rdi > ffffffff8110f65f: e8 4c fe ff ff callq ffffffff8110f4b0 > ffffffff8110f664: 85 c0 test %eax,%eax > ffffffff8110f666: 78 e8 js ffffffff8110f650 > ffffffff8110f668: 48 83 c4 28 add $0x28,%rsp > ffffffff8110f66c: 5b pop %rbx > ffffffff8110f66d: 41 5e pop %r14 > ffffffff8110f66f: 41 5f pop %r15 > ffffffff8110f671: 5d pop %rbp > ffffffff8110f672: c3 retq > ffffffff8110f673: 66 66 66 66 2e 0f 1f data32 data32 data32 nopw %cs:0x0(%rax,%rax,1) > ffffffff8110f67a: 84 00 00 00 00 00 That LLVM generate disgusting code, as a contrast, this is what my GCC makes of this: ffffffff81155f50 : ffffffff81155f50: e8 bb 02 9c 00 callq ffffffff81b16210 <__fentry__> ffffffff81155f55: 55 push %rbp ffffffff81155f56: 48 89 e5 mov %rsp,%rbp ffffffff81155f59: 41 55 push %r13 ffffffff81155f5b: 41 54 push %r12 ffffffff81155f5d: 53 push %rbx ffffffff81155f5e: 48 89 fb mov %rdi,%rbx ffffffff81155f61: 48 83 ec 08 sub $0x8,%rsp ffffffff81155f65: 9c pushfq ffffffff81155f66: 41 5c pop %r12 ffffffff81155f68: fa cli ffffffff81155f69: e8 72 5c fd ff callq ffffffff8112bbe0 ffffffff81155f6e: 4c 8d 6b 50 lea 0x50(%rbx),%r13 ffffffff81155f72: 45 31 c9 xor %r9d,%r9d ffffffff81155f75: 31 c9 xor %ecx,%ecx ffffffff81155f77: 31 d2 xor %edx,%edx ffffffff81155f79: 31 f6 xor %esi,%esi ffffffff81155f7b: 4c 89 ef mov %r13,%rdi ffffffff81155f7e: 48 c7 04 24 55 5f 15 movq $0xffffffff81155f55,(%rsp) ffffffff81155f85: 81 ffffffff81155f86: 41 b8 01 00 00 00 mov $0x1,%r8d ffffffff81155f8c: e8 3f b3 fd ff callq ffffffff811312d0 ffffffff81155f91: 48 c7 c2 55 5f 15 81 mov $0xffffffff81155f55,%rdx ffffffff81155f98: be 01 00 00 00 mov $0x1,%esi ffffffff81155f9d: 4c 89 ef mov %r13,%rdi ffffffff81155fa0: e8 0b b5 fd ff callq ffffffff811314b0 ffffffff81155fa5: 41 f7 c4 00 02 00 00 test $0x200,%r12d ffffffff81155fac: 75 52 jne ffffffff81156000 ffffffff81155fae: 41 54 push %r12 ffffffff81155fb0: 9d popfq ffffffff81155fb1: e8 2a 5c fd ff callq ffffffff8112bbe0 ffffffff81155fb6: 65 8b 05 5b 66 eb 7e mov %gs:0x7eeb665b(%rip),%eax # c618 <__preempt_count> ffffffff81155fbd: a9 00 00 0f 00 test $0xf0000,%eax ffffffff81155fc2: 74 25 je ffffffff81155fe9 ffffffff81155fc4: f6 43 2a 20 testb $0x20,0x2a(%rbx) ffffffff81155fc8: 75 1f jne ffffffff81155fe9 ffffffff81155fca: be 61 04 00 00 mov $0x461,%esi ffffffff81155fcf: 48 c7 c7 09 87 f3 81 mov $0xffffffff81f38709,%rdi ffffffff81155fd6: e8 15 03 f8 ff callq ffffffff810d62f0 ffffffff81155fdb: 48 89 df mov %rbx,%rdi ffffffff81155fde: e8 fd fe ff ff callq ffffffff81155ee0 ffffffff81155fe3: 85 c0 test %eax,%eax ffffffff81155fe5: 79 0e jns ffffffff81155ff5 ffffffff81155fe7: f3 90 pause ffffffff81155fe9: 48 89 df mov %rbx,%rdi ffffffff81155fec: e8 ef fe ff ff callq ffffffff81155ee0 ffffffff81155ff1: 85 c0 test %eax,%eax ffffffff81155ff3: 78 f2 js ffffffff81155fe7 ffffffff81155ff5: 48 83 c4 08 add $0x8,%rsp ffffffff81155ff9: 5b pop %rbx ffffffff81155ffa: 41 5c pop %r12 ffffffff81155ffc: 41 5d pop %r13 ffffffff81155ffe: 5d pop %rbp ffffffff81155fff: c3 retq ffffffff81156000: e8 4b 8b fd ff callq ffffffff8112eb50 ffffffff81156005: 41 54 push %r12 ffffffff81156007: 9d popfq ffffffff81156008: eb ac jmp ffffffff81155fb6 ffffffff8115600a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)