commit 2460c23c35e9a612395b4108dbc19f3c1f016d43
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Tue Jun 5 10:28:58 2018 +0200

    Linux 4.9.106

commit 6464206844f5201dbe757a95f11b77e98965174c
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Mon Feb 27 22:21:16 2017 -0600

    objtool: Enclose contents of unreachable() macro in a block
    
    commit 4e4636cf981b5b629fbfb78aa9f232e015f7d521 upstream.
    
    Guenter Roeck reported a boot failure in mips64.  It was bisected to the
    following commit:
    
      d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends")
    
    The unreachable() macro was formerly only composed of a single
    statement.  The above commit added a second statement, but neglected to
    enclose the statements in a block.
    
    Suggested-by: Guenter Roeck <linux@roeck-us.net>
    Reported-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Fixes: d1091c7fa3d5 ("objtool: Improve detection of BUG() and other dead ends")
    Link: http://lkml.kernel.org/r/20170228042116.glmwmwiohcix7o4a@treble
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 10d15c48ad691581a2d5c0f07943724c57bef46f
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jun 3 13:37:03 2018 +0200

    x86/xen: Add unwind hint annotations to xen_setup_gdt
    
    Not needed in mainline as this function got rewritten in 4.12
    
    This enables objtool to grok the iret in the middle of a C function.
    
    This matches commit 76846bf3cb09 ("x86/asm: Add unwind hint annotations
    to sync_core()")
    
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 269e5906328a6606c893caa8451ecd5b672b0733
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jun 3 12:35:51 2018 +0200

    objtool: header file sync-up
    
    When building tools/objtool/ it rightly complains about a number of
    files being out of sync.  Fix this up by syncing them properly with the
    relevant in-kernel versions.
    
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c310c7b2697d446b81543646fbe7cbb2a085bda2
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jun 3 12:36:14 2018 +0200

    perf/tools: header file sync up
    
    When building tools/perf/ it rightly complains about a number of .h
    files being out of sync.  Fix this up by syncing them properly with the
    relevant in-kernel versions.
    
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 935893a17a99e8ce5ff2e3a7cd1bcd0e79d30872
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Wed Jun 28 10:11:06 2017 -0500

    objtool, x86: Add several functions and files to the objtool whitelist
    
    commit c207aee48037abca71c669cbec407b9891965c34 upstream.
    
    In preparation for an objtool rewrite which will have broader checks,
    whitelist functions and files which cause problems because they do
    unusual things with the stack.
    
    These whitelists serve as a TODO list for which functions and files
    don't yet have undwarf unwinder coverage.  Eventually most of the
    whitelists can be removed in favor of manual CFI hint annotations or
    objtool improvements.
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Jiri Slaby <jslaby@suse.cz>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/7f934a5d707a574bda33ea282e9478e627fb1829.1498659915.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9aebb3d3a03843d6e7810bacac72caeb53904a70
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Wed May 9 22:39:14 2018 -0500

    objtool: Fix "noreturn" detection for recursive sibling calls
    
    commit 0afd0d9e0e7879d666c1df2fa1bea4d8716909fe upstream.
    
    Objtool has some crude logic for detecting static "noreturn" functions
    (aka "dead ends").  This is necessary for being able to correctly follow
    GCC code flow when such functions are called.
    
    It's remotely possible for two functions to call each other via sibling
    calls.  If they don't have RET instructions, objtool's noreturn
    detection logic goes into a recursive loop:
    
      drivers/char/ipmi/ipmi_ssif.o: warning: objtool: return_hosed_msg()+0x0: infinite recursion (objtool bug!)
      drivers/char/ipmi/ipmi_ssif.o: warning: objtool: deliver_recv_msg()+0x0: infinite recursion (objtool bug!)
    
    Instead of reporting an error in this case, consider the functions to be
    non-dead-ends.
    
    Reported-and-tested-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: David Laight <David.Laight@ACULAB.COM>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: damian <damian.tometzki@icloud.com>
    Link: http://lkml.kernel.org/r/7cc156408c5781a1f62085d352ced1fe39fe2f91.1525923412.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 603a2cdf1066d6bd45c0ed5d1adb7bb437213958
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Fri May 18 15:10:34 2018 -0500

    objtool: Detect RIP-relative switch table references, part 2
    
    commit 7dec80ccbe310fb7e225bf21c48c672bb780ce7b upstream.
    
    With the following commit:
    
      fd35c88b7417 ("objtool: Support GCC 8 switch tables")
    
    I added a "can't find switch jump table" warning, to stop covering up
    silent failures if add_switch_table() can't find anything.
    
    That warning found yet another bug in the objtool switch table detection
    logic.  For cases 1 and 2 (as described in the comments of
    find_switch_table()), the find_symbol_containing() check doesn't adjust
    the offset for RIP-relative switch jumps.
    
    Incidentally, this bug was already fixed for case 3 with:
    
      6f5ec2993b1f ("objtool: Detect RIP-relative switch table references")
    
    However, that commit missed the fix for cases 1 and 2.
    
    The different cases are now starting to look more and more alike.  So
    fix the bug by consolidating them into a single case, by checking the
    original dynamic jump instruction in the case 3 loop.
    
    This also simplifies the code and makes it more robust against future
    switch table detection issues -- of which I'm sure there will be many...
    
    Switch table detection has been the most fragile area of objtool, by
    far.  I long for the day when we'll have a GCC plugin for annotating
    switch tables.  Linus asked me to delay such a plugin due to the
    flakiness of the plugin infrastructure in older versions of GCC, so this
    rickety code is what we're stuck with for now.  At least the code is now
    a little simpler than it was.
    
    Reported-by: kbuild test robot <lkp@intel.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/f400541613d45689086329432f3095119ffbc328.1526674218.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 48dc537b22bc5e29964038b83dfedec72f34612c
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Mon May 14 08:53:24 2018 -0500

    objtool: Detect RIP-relative switch table references
    
    commit 6f5ec2993b1f39aed12fa6fd56e8dc2272ee8a33 upstream.
    
    Typically a switch table can be found by detecting a .rodata access
    followed an indirect jump:
    
        1969:       4a 8b 0c e5 00 00 00    mov    0x0(,%r12,8),%rcx
        1970:       00
                            196d: R_X86_64_32S      .rodata+0x438
        1971:       e9 00 00 00 00          jmpq   1976 <dispc_runtime_suspend+0xb6a>
                            1972: R_X86_64_PC32     __x86_indirect_thunk_rcx-0x4
    
    Randy Dunlap reported a case (seen with GCC 4.8) where the .rodata
    access uses RIP-relative addressing:
    
        19bd:       48 8b 3d 00 00 00 00    mov    0x0(%rip),%rdi        # 19c4 <dispc_runtime_suspend+0xbb8>
                            19c0: R_X86_64_PC32     .rodata+0x45c
        19c4:       e9 00 00 00 00          jmpq   19c9 <dispc_runtime_suspend+0xbbd>
                            19c5: R_X86_64_PC32     __x86_indirect_thunk_rdi-0x4
    
    In this case the relocation addend needs to be adjusted accordingly in
    order to find the location of the switch table.
    
    The fix is for case 3 (as described in the comments), but also make the
    existing case 1 & 2 checks more precise by only adjusting the addend for
    R_X86_64_PC32 relocations.
    
    This fixes the following warnings:
    
      drivers/video/fbdev/omap2/omapfb/dss/dispc.o: warning: objtool: dispc_runtime_suspend()+0xbb8: sibling call from callable instruction with modified stack frame
      drivers/video/fbdev/omap2/omapfb/dss/dispc.o: warning: objtool: dispc_runtime_resume()+0xcc5: sibling call from callable instruction with modified stack frame
    
    Reported-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/b6098294fd67afb69af8c47c9883d7a68bf0f8ea.1526305958.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7cd91856f5c5fe3586f0764b4b3e57ca4da5b40f
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Thu May 10 17:48:49 2018 -0500

    objtool: Support GCC 8 switch tables
    
    commit fd35c88b74170d9335530d9abf271d5d73eb5401 upstream.
    
    With GCC 8, some issues were found with the objtool switch table
    detection.
    
    1) In the .rodata section, immediately after the switch table, there can
       be another object which contains a pointer to the function which had
       the switch statement.  In this case objtool wrongly considers the
       function pointer to be part of the switch table.  Fix it by:
    
       a) making sure there are no pointers to the beginning of the
          function; and
    
       b) making sure there are no gaps in the switch table.
    
       Only the former was needed, the latter adds additional protection for
       future optimizations.
    
    2) In find_switch_table(), case 1 and case 2 are missing the check to
       ensure that the .rodata switch table data is anonymous, i.e. that it
       isn't already associated with an ELF symbol.  Fix it by adding the
       same find_symbol_containing() check which is used for case 3.
    
    This fixes the following warnings with GCC 8:
    
      drivers/block/virtio_blk.o: warning: objtool: virtio_queue_rq()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+72
      net/ipv6/icmp.o: warning: objtool: icmpv6_rcv()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+64
      drivers/usb/core/quirks.o: warning: objtool: quirks_param_set()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+48
      drivers/mtd/nand/raw/nand_hynix.o: warning: objtool: hynix_nand_decode_id()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+24
      drivers/mtd/nand/raw/nand_samsung.o: warning: objtool: samsung_nand_decode_id()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+32
      drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.o: warning: objtool: gk104_top_oneinit()+0x0: stack state mismatch: cfa1=7+8 cfa2=7+64
    
    Reported-by: Arnd Bergmann <arnd@arndb.de>
    Reported-by: kbuild test robot <lkp@intel.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: David Laight <David.Laight@ACULAB.COM>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: damian <damian.tometzki@icloud.com>
    Link: http://lkml.kernel.org/r/20180510224849.xwi34d6tzheb5wgw@treble
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1f7f88aa4df593db34dd1d6345213f20888687fb
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Wed May 9 22:39:15 2018 -0500

    objtool: Support GCC 8's cold subfunctions
    
    commit 13810435b9a7014fb92eb715f77da488f3b65b99 upstream.
    
    GCC 8 moves a lot of unlikely code out of line to "cold" subfunctions in
    .text.unlikely.  Properly detect the new subfunctions and treat them as
    extensions of the original functions.
    
    This fixes a bunch of warnings like:
    
      kernel/cgroup/cgroup.o: warning: objtool: parse_cgroup_root_flags()+0x33: sibling call from callable instruction with modified stack frame
      kernel/cgroup/cgroup.o: warning: objtool: cgroup_addrm_files()+0x290: sibling call from callable instruction with modified stack frame
      kernel/cgroup/cgroup.o: warning: objtool: cgroup_apply_control_enable()+0x25b: sibling call from callable instruction with modified stack frame
      kernel/cgroup/cgroup.o: warning: objtool: rebind_subsystems()+0x325: sibling call from callable instruction with modified stack frame
    
    Reported-and-tested-by: damian <damian.tometzki@icloud.com>
    Reported-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: David Laight <David.Laight@ACULAB.COM>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/0965e7fcfc5f31a276f0c7f298ff770c19b68706.1525923412.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b790b4f22a165e85f0b53a3231764034e42c7ea6
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jun 3 12:35:15 2018 +0200

    objtool: sync up with the 4.14.47 version of objtool
    
    There are pros and cons of dealing with tools in the kernel directory.
    The pros are the fact that development happens fast, and new features
    can be added to the kernel and the tools at the same times.  The cons
    are when dealing with backported kernel patches, it can be necessary to
    backport parts of the tool changes as well.
    
    For 4.9.y so far, we have backported individual patches.  That quickly
    breaks down when there are minor differences between how backports were
    handled, so grabbing 40+ patch long series can be difficult, not
    impossible, but really frustrating to attempt.
    
    To help mitigate this mess, here's a single big patch to sync up the
    objtool logic to the 4.14.47 version of the tool.  From this point
    forward (after some other minor header file patches are applied), the
    tool should be in sync and much easier to maintain over time.
    
    This has survivied my limited testing, and as the codebase is identical
    to 4.14.47, I'm pretty comfortable dropping this big change in here in
    4.9.y.  Hopefully all goes well...
    
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b6e7b985f8c5b7a1fe098bc6f31af2eea4d9b1ad
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 17 16:22:30 2017 -0300

    tools include: Include missing headers for fls() and types in linux/log2.h
    
    commit a12a4e023a55f058178afea1ada3ce7bf4db94c3 upstream.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-7wj865zidu5ylf87i6i7v6z7@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c5e64da62affbd9796ca801e92bfabe3a03fdccc
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 17 12:01:36 2017 -0300

    tools include: Drop ARRAY_SIZE() definition from linux/hashtable.h
    
    commit 68289cbd83eaa20faef7cc818121bc8e769065de upstream.
    
    As tools/include/linux/kernel.h has it now, with the goodies present in
    the kernel.h counterpart, i.e. checking that the parameter is an array
    at build time.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-v0b41ivu6z6dyugbq9ffa9ez@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 110cf308d24a6b7ec27852a4d0933bfe00f551c9
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 17 11:29:26 2017 -0300

    tools include: Move ARRAY_SIZE() to linux/kernel.h
    
    commit 8607c1ee734d12f62c6a46abef13a510e25a1839 upstream.
    
    To match the kernel, then look for places redefining it to make it use
    this version, which checks that its parameter is an array at build time.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-txlcf1im83bcbj6kh0wxmyy8@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d45e1f06a18644d18c0280c0a1091d22f7fa8b83
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 17 11:25:00 2017 -0300

    tools include: Adopt __same_type() and __must_be_array() from the kernel
    
    commit f6441aff8946f7fd6ab730d7eb9eba18a9ebeba4 upstream.
    
    Will be used to adopt the more stringent version of ARRAY_SIZE(), the
    one in the kernel sources.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-d85dpvay1hoqscpezlntyd8x@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 86ff378c684e906d067d18c656e74278c32b7896
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Mon Apr 17 11:23:41 2017 -0300

    tools include: Introduce linux/bug.h, from the kernel sources
    
    commit 379d61b1c7d42512cded04d372f15a7e725db9e1 upstream.
    
    With just what we will need in the upcoming changesets, the
    BUILD_BUG_ON_ZERO() definition.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-lw8zg7x6ttwcvqhp90mwe3vo@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c0d447524c11f5d431f05db68e02e286caa3e01
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Thu Mar 30 11:16:59 2017 -0300

    tools include uapi: Grab copies of stat.h and fcntl.h
    
    commit 67ef28794d7e30f33936d655f2951e8dcae7cd5a upstream.
    
    We will need it to build tools/perf/trace/beauty/statx.h.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-nin41ve2fa63lrfbdr6x57yr@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f8d0cad4a459aec8bd01486cf53fc5cd34ff92d1
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Dec 6 14:18:51 2016 +0100

    perf tools: Move headers check into bash script
    
    commit aeafd623f866c429307e3a4a39998f5f06b4f00e upstream.
    
    To make it nicer and easily maintainable.
    
    Also moving the check into fixdep sub make, so its output is not
    scattered around the build output.
    
    Removing extra $$ from mman*.h checks.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1481030331-31944-5-git-send-email-jolsa@kernel.org
    [ Use /bin/sh, and 'function check() {' -> 'check () {' to make it work with busybox, in Alpine Linux, for instance ]
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8307d019973c272af2ef8524397ba24476fd5b60
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Tue Dec 6 14:18:49 2016 +0100

    perf tools: Force fixdep compilation at the start of the build
    
    commit abb26210a39522a6645bce3f438ed9a26bedb11b upstream.
    
    The fixdep tool needs to be built before everything else, because it fixes
    every object dependency file.
    
    We handle this currently by making all objects to depend on fixdep, which is
    error prone and is easily forgotten when new object is added.
    
    Instead of this, this patch force fixdep tool to be built as the first target
    in the separate make session. This way we don't need to handle extra fixdep
    dependencies and we are certain there's no fixdep race with any parallel make
    job.
    
    Committer notes:
    
    Testing it:
    
    Before:
    
      $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
      make: Entering directory '/home/acme/git/linux/tools/perf'
        BUILD:   Doing 'make -j4' parallel build
    
      Auto-detecting system features:
      ...                         dwarf: [ on  ]
      ...            dwarf_getlocations: [ on  ]
      ...                         glibc: [ on  ]
      ...                          gtk2: [ on  ]
      ...                      libaudit: [ on  ]
      ...                        libbfd: [ on  ]
      ...                        libelf: [ on  ]
      ...                       libnuma: [ on  ]
      ...        numa_num_possible_cpus: [ on  ]
      ...                       libperl: [ on  ]
      ...                     libpython: [ on  ]
      ...                      libslang: [ on  ]
      ...                     libcrypto: [ on  ]
      ...                     libunwind: [ on  ]
      ...            libdw-dwarf-unwind: [ on  ]
      ...                          zlib: [ on  ]
      ...                          lzma: [ on  ]
      ...                     get_cpuid: [ on  ]
      ...                           bpf: [ on  ]
    
        GEN      /tmp/build/perf/common-cmds.h
        HOSTCC   /tmp/build/perf/fixdep.o
        HOSTLD   /tmp/build/perf/fixdep-in.o
        LINK     /tmp/build/perf/fixdep
        MKDIR    /tmp/build/perf/pmu-events/
        HOSTCC   /tmp/build/perf/pmu-events/json.o
        MKDIR    /tmp/build/perf/pmu-events/
        HOSTCC   /tmp/build/perf/pmu-events/jsmn.o
        HOSTCC   /tmp/build/perf/pmu-events/jevents.o
        HOSTLD   /tmp/build/perf/pmu-events/jevents-in.o
        PERF_VERSION = 4.9.rc8.g868cd5
        CC       /tmp/build/perf/perf-read-vdso32
      <SNIP>
    
    After:
    
      $ rm -rf /tmp/build/perf/ ; mkdir -p /tmp/build/perf ; make -k O=/tmp/build/perf -C tools/perf install-bin
      make: Entering directory '/home/acme/git/linux/tools/perf'
        BUILD:   Doing 'make -j4' parallel build
        HOSTCC   /tmp/build/perf/fixdep.o
        HOSTLD   /tmp/build/perf/fixdep-in.o
        LINK     /tmp/build/perf/fixdep
    
      Auto-detecting system features:
      ...                         dwarf: [ on  ]
      ...            dwarf_getlocations: [ on  ]
      ...                         glibc: [ on  ]
      ...                          gtk2: [ on  ]
      ...                      libaudit: [ on  ]
      ...                        libbfd: [ on  ]
      ...                        libelf: [ on  ]
      ...                       libnuma: [ on  ]
      ...        numa_num_possible_cpus: [ on  ]
      ...                       libperl: [ on  ]
      ...                     libpython: [ on  ]
      ...                      libslang: [ on  ]
      ...                     libcrypto: [ on  ]
      ...                     libunwind: [ on  ]
      ...            libdw-dwarf-unwind: [ on  ]
      ...                          zlib: [ on  ]
      ...                          lzma: [ on  ]
      ...                     get_cpuid: [ on  ]
      ...                           bpf: [ on  ]
    
        GEN      /tmp/build/perf/common-cmds.h
        MKDIR    /tmp/build/perf/fd/
        CC       /tmp/build/perf/fd/array.o
        LD       /tmp/build/perf/fd/libapi-in.o
        MKDIR    /tmp/build/perf/fs/
        CC       /tmp/build/perf/event-parse.o
        CC       /tmp/build/perf/fs/fs.o
        PERF_VERSION = 4.9.rc8.g57a92f
        CC       /tmp/build/perf/event-plugin.o
        MKDIR    /tmp/build/perf/fs/
        CC       /tmp/build/perf/fs/tracing_path.o
      <SNIP>
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1481030331-31944-3-git-send-email-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9340289c479f72594c90c98dcf1f2b3db927e5fb
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Wed Feb 22 17:00:53 2017 -0300

    tools include: Adopt kernel's refcount.h
    
    commit 73a9bf95ed1c05698ecabe2f28c47aedfa61b52b upstream.
    
    To aid in catching bugs when using atomics as a reference count.
    
    This is a trimmed down version with just what is used by tools/ at
    this point.
    
    After this, the patches submitted by Elena for tools/ doing the
    conversion from atomic_ to recount_ methods can be applied and tested.
    
    To activate it, buint perf with:
    
      make DEBUG=1 -C tools/perf
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Elena Reshetova <elena.reshetova@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-dqtxsumns9ov0l9r5x398f19@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 935e5af3ac37269b81dc331965e283da57d579f3
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Wed Feb 22 17:42:40 2017 -0300

    tools include: Add UINT_MAX def to kernel.h
    
    commit eaa75b5117d52adf1efd3c6c3fb4bd8f97de648b upstream.
    
    The kernel has it and some files we got from there would require us
    including the userland header for that, so add it conditionally.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Elena Reshetova <elena.reshetova@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-gmwyal7c9vzzttlyk6u59rzn@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 461d111ee5d2dfe19af59ce2d7be7f2a48b4fee5
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Wed Feb 22 16:57:53 2017 -0300

    tools include: Introduce atomic_cmpxchg_{relaxed,release}()
    
    commit 2bcdeadbc094b4f6511aedea1e5b8052bf0cc89c upstream.
    
    Will be used by refcnt.h
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Elena Reshetova <elena.reshetova@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-jszriruqfqpez1bkivwfj6qb@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c204537d5a47a4873d0860a8bd7adc3f3fe58091
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Wed Feb 22 16:48:24 2017 -0300

    tools include: Adopt __compiletime_error
    
    commit 4900653829175f60356efc279695bb23c59483c3 upstream.
    
    From the kernel, get the gcc one and provide the fallback so that we can
    continue build with other compilers, such as with clang.
    
    Will be used by tools/arch/x86/include/asm/cmpxchg.h.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Elena Reshetova <elena.reshetova@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-pecgz6efai4a9euuk4rxuotr@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 09aaaa609ea4f9eb28382b22ee9a30489daf82ee
Author: Matthew Wilcox <mawilcox@microsoft.com>
Date:   Fri Dec 16 14:53:45 2016 -0500

    radix tree test suite: Remove types.h
    
    commit 12ea65390bd5a46f8a70f068eb0d48922576a781 upstream.
    
    Move the pieces we still need to tools/include and update a few implicit
    includes.
    
    Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
    [ Just take the tools/include/linux/* portions of this patch - gregkh]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea2313bfce7901d166e4bef26b943bb5e5dd29eb
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
Date:   Fri Feb 10 11:41:11 2017 -0300

    tools include: Introduce linux/compiler-gcc.h
    
    commit 192614010a5052fe92611c7076ef664fd9bb60e8 upstream.
    
    To match the kernel headers structure, setting up things that are
    specific to gcc or to some specific version of gcc.
    
    It gets included by linux/compiler.h when gcc is the compiler being
    used.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Joe Perches <joe@perches.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-fabcqfq4asodq9t158hcs8t3@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 22210278dcc0042955036671625b5771b01e5dc3
Author: Michael S. Tsirkin <mst@redhat.com>
Date:   Sun Dec 11 06:27:21 2016 +0200

    tools: enable endian checks for all sparse builds
    
    commit 376a5fb34b04524af501a0c5979c5920be940e05 upstream.
    
    We dropped need for __CHECK_ENDIAN__ for linux,
    this mirrors this for tools.
    
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5828462fea805ed1c6666ab827cb9cdb88209990
Author: Matthew Wilcox <willy@linux.intel.com>
Date:   Wed Dec 14 15:08:26 2016 -0800

    tools: add more bitmap functions
    
    commit b328daf3b7130098b105c18bdae694ddaad5b6e3 upstream.
    
    I need the following functions for the radix tree:
    
      bitmap_fill
      bitmap_empty
      bitmap_full
    
    Copy the implementations from include/linux/bitmap.h
    
    Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
    Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Cc: Konstantin Khlebnikov <koct9i@gmail.com>
    Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
    Cc: Matthew Wilcox <mawilcox@microsoft.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 856bc9a0cb3a13c5dfd11f8a73ff1cd221778174
Author: Jiri Olsa <jolsa@kernel.org>
Date:   Mon Oct 10 09:26:33 2016 +0200

    tools lib: Add for_each_clear_bit macro
    
    commit 02bc11de567273da8ab25c54336ddbb71986f38f upstream.
    
    Adding for_each_clear_bit macro plus all its the necessary backbone
    functions. Taken from related kernel code. It will be used in following
    patch.
    
    Signed-off-by: Jiri Olsa <jolsa@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: http://lkml.kernel.org/n/tip-cayv2zbqi0nlmg5sjjxs1775@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 24ac7a44f7201fdecb2b4068de1ac808f265ede4
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Wed Jun 28 10:11:05 2017 -0500

    objtool: Move checking code to check.c
    
    commit dcc914f44f065ef73685b37e59877a5bb3cb7358 upstream.
    
    In preparation for the new 'objtool undwarf generate' command, which
    will rely on 'objtool check', move the checking code from
    builtin-check.c to check.c where it can be used by other commands.
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Reviewed-by: Jiri Slaby <jslaby@suse.cz>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: live-patching@vger.kernel.org
    Link: http://lkml.kernel.org/r/294c5c695fd73c1a5000bbe5960a7c9bec4ee6b4.1498659915.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    [backported by hand to 4.9, this was a pain... - gregkh]
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit add0ff1791c6a3867329f14a003b7177ce5fd878
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Tue Feb 21 15:35:32 2017 -0600

    objtool: Improve detection of BUG() and other dead ends
    
    commit d1091c7fa3d52ebce4dd3f15d04155b3469b2f90 upstream.
    
    The BUG() macro's use of __builtin_unreachable() via the unreachable()
    macro tells gcc that the instruction is a dead end, and that it's safe
    to assume the current code path will not execute past the previous
    instruction.
    
    On x86, the BUG() macro is implemented with the 'ud2' instruction.  When
    objtool's branch analysis sees that instruction, it knows the current
    code path has come to a dead end.
    
    Peter Zijlstra has been working on a patch to change the WARN macros to
    use 'ud2'.  That patch will break objtool's assumption that 'ud2' is
    always a dead end.
    
    Generally it's best for objtool to avoid making those kinds of
    assumptions anyway.  The more ignorant it is of kernel code internals,
    the better.
    
    So create a more generic way for objtool to detect dead ends by adding
    an annotation to the unreachable() macro.  The annotation stores a
    pointer to the end of the unreachable code path in an '__unreachable'
    section.  Objtool can read that section to find the dead ends.
    
    Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/41a6d33971462ebd944a1c60ad4bf5be86c17b77.1487712920.git.jpoimboe@redhat.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>