1. 08 May, 2015 8 commits
    • Denys Vlasenko's avatar
      x86/entry: Define 'cpu_current_top_of_stack' for 64-bit code · 3a23208e
      Denys Vlasenko authored
      32-bit code has PER_CPU_VAR(cpu_current_top_of_stack).
      64-bit code uses somewhat more obscure: PER_CPU_VAR(cpu_tss + TSS_sp0).
      
      Define the 'cpu_current_top_of_stack' macro on CONFIG_X86_64
      as well so that the PER_CPU_VAR(cpu_current_top_of_stack)
      expression can be used in both 32-bit and 64-bit code.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1429889495-27850-3-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      3a23208e
    • Denys Vlasenko's avatar
      x86/entry: Remove unused 'kernel_stack' per-cpu variable · fed7c3f0
      Denys Vlasenko authored
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1429889495-27850-2-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fed7c3f0
    • Denys Vlasenko's avatar
      x86/entry: Stop using PER_CPU_VAR(kernel_stack) · 63332a84
      Denys Vlasenko authored
      PER_CPU_VAR(kernel_stack) is redundant:
      
        - On the 64-bit build, we can use PER_CPU_VAR(cpu_tss + TSS_sp0).
        - On the 32-bit build, we can use PER_CPU_VAR(cpu_current_top_of_stack).
      
      PER_CPU_VAR(kernel_stack) will be deleted by a separate change.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1429889495-27850-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      63332a84
    • Andy Lutomirski's avatar
      x86, selftests: Add a test for the "sysret_ss_attrs" bug · e22438f8
      Andy Lutomirski authored
      On AMD CPUs, SYSRET can return with a valid SS descriptor with
      with the hidden attributes set to an unusable state.  Make sure
      the kernel doesn't let this happen.  This detects an
      as-yet-unfixed regression.
      
      Note that the 64-bit version of this test fails on AMD CPUs on
      all kernel versions, although the issue in the 64-bit case is
      much less severe than in the 32-bit case.
      Reported-by: default avatarBrian Gerst <brgerst@gmail.com>
      Tested-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Tests: e7d6eefa ("x86/vdso32/syscall.S: Do not load __USER32_DS to %ss")
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/resend_4d740841bac383742949e2fefb03982736595087.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e22438f8
    • Ingo Molnar's avatar
    • Denys Vlasenko's avatar
      x86: Force inlining of atomic ops · 2a4e90b1
      Denys Vlasenko authored
      With both gcc 4.7.2 and 4.9.2, sometimes gcc mysteriously
      doesn't inline very small functions we expect to be inlined:
      
      $ nm --size-sort vmlinux | grep -iF ' t ' | uniq -c | grep -v '^
      *1 ' | sort -rn     473 000000000000000b t spin_unlock_irqrestore
          449 000000000000005f t rcu_read_unlock
          355 0000000000000009 t atomic_inc                <== THIS
          353 000000000000006e t rcu_read_lock
          350 0000000000000075 t rcu_read_lock_sched_held
          291 000000000000000b t spin_unlock
          266 0000000000000019 t arch_local_irq_restore
          215 000000000000000b t spin_lock
          180 0000000000000011 t kzalloc
          165 0000000000000012 t list_add_tail
          161 0000000000000019 t arch_local_save_flags
          153 0000000000000016 t test_and_set_bit
          134 000000000000000b t spin_unlock_irq
          134 0000000000000009 t atomic_dec                <== THIS
          130 000000000000000b t spin_unlock_bh
          122 0000000000000010 t brelse
          120 0000000000000016 t test_and_clear_bit
          120 000000000000000b t spin_lock_irq
          119 000000000000001e t get_dma_ops
          117 0000000000000053 t cpumask_next
          116 0000000000000036 t kref_get
          114 000000000000001a t schedule_work
          106 000000000000000b t spin_lock_bh
          103 0000000000000019 t arch_local_irq_disable
      ...
      
      Note sizes of marked functions. They are merely 9 bytes long!
      Selecting function with 'atomic' in their names:
      
          355 0000000000000009 t atomic_inc
          134 0000000000000009 t atomic_dec
           98 0000000000000014 t atomic_dec_and_test
           31 000000000000000e t atomic_add_return
           27 000000000000000a t atomic64_inc
           26 000000000000002f t kmap_atomic
           24 0000000000000009 t atomic_add
           12 0000000000000009 t atomic_sub
           10 0000000000000021 t __atomic_add_unless
           10 000000000000000a t atomic64_add
            5 000000000000001f t __atomic_add_unless.constprop.7
            5 000000000000000a t atomic64_dec
            4 000000000000001f t __atomic_add_unless.constprop.18
            4 000000000000001f t __atomic_add_unless.constprop.12
            4 000000000000001f t __atomic_add_unless.constprop.10
            3 000000000000001f t __atomic_add_unless.constprop.13
            3 0000000000000011 t atomic64_add_return
            2 000000000000001f t __atomic_add_unless.constprop.9
            2 000000000000001f t __atomic_add_unless.constprop.8
            2 000000000000001f t __atomic_add_unless.constprop.6
            2 000000000000001f t __atomic_add_unless.constprop.5
            2 000000000000001f t __atomic_add_unless.constprop.3
            2 000000000000001f t __atomic_add_unless.constprop.22
            2 000000000000001f t __atomic_add_unless.constprop.14
            2 000000000000001f t __atomic_add_unless.constprop.11
            2 000000000000001e t atomic_dec_if_positive
            2 0000000000000014 t atomic_inc_and_test
            2 0000000000000011 t atomic_add_return.constprop.4
            2 0000000000000011 t atomic_add_return.constprop.17
            2 0000000000000011 t atomic_add_return.constprop.16
            2 000000000000000d t atomic_inc.constprop.4
            2 000000000000000c t atomic_cmpxchg
      
      This patch fixes this for x86 atomic ops via
      s/inline/__always_inline/. This decreases allyesconfig kernel by
      about 25k:
      
          text     data      bss       dec     hex filename
      82399481 22255416 20627456 125282353 777a831 vmlinux.before
      82375570 22255544 20627456 125258570 7774b4a vmlinux
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1431080762-17797-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2a4e90b1
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Clean up usage of TEST insns · 03335e95
      Denys Vlasenko authored
      By the nature of TEST operation, it is often possible
      to test a narrower part of the operand:
      
          "testl $3, mem"  -> "testb $3, mem"
      
      This results in shorter insns, because TEST insn has no
      sign-entending byte-immediate forms unlike other ALU ops.
      
         text	   data	    bss	    dec	    hex	filename
        11674	      0	      0	  11674	   2d9a	entry_64.o.before
        11658	      0	      0	  11658	   2d8a	entry_64.o
      
      Changes in object code:
      
      -	f7 84 24 88 00 00 00 03 00 00 00 	testl  $0x3,0x88(%rsp)
      +	f6 84 24 88 00 00 00 03	         	testb  $0x3,0x88(%rsp)
      -	f7 44 24 68 03 00 00 00          	testl  $0x3,0x68(%rsp)
      +	f6 44 24 68 03                  	testb  $0x3,0x68(%rsp)
      -	f7 84 24 90 00 00 00 03 00 00 00	testl  $0x3,0x90(%rsp)
      +	f6 84 24 90 00 00 00 03         	testb  $0x3,0x90(%rsp)
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1430140912-7960-2-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      03335e95
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Tidy up JZ insns after TESTs · dde74f2e
      Denys Vlasenko authored
      After TESTs, use logically correct JZ/JNZ mnemonics instead of
      JE/JNE. This doesn't change code.
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Acked-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1430140912-7960-1-git-send-email-dvlasenk@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      dde74f2e
  2. 07 May, 2015 6 commits
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 3e0283a5
      Linus Torvalds authored
      Pull power management and ACPI fixes from Rafael Wysocki:
       "These include three regression fixes (PCI resources management,
        ACPI/PNP device enumeration, ACPI SBS on MacBook) and two ACPI
        documentation fixes related to GPIO.
      
        Specifics:
      
         - Fix for a PCI resources management regression introduced during the
           4.0 cycle and related to the handling of ACPI resources'
           Producer/Consumer flags that turn out to be useless (Jiang Liu)
      
         - Fix for a MacBook regression related to the Smart Battery Subsystem
           (SBS) driver causing various problems (stalls on boot, failure to
           detect or report battery) to happen and introduced during the 3.18
           cycle (Chris Bainbridge)
      
         - Fix for an ACPI/PNP device enumeration regression introduced during
           the 3.16 cycle caused by failing to include two PNP device IDs into
           the list of IDs that PNP device objects need to be created for
           (Witold Szczeponik)
      
         - Fixes for two minor mistakes in the ACPI GPIO properties
           documentation (Antonio Ospite, Rafael J Wysocki)"
      
      * tag 'pm+acpi-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / PNP: add two IDs to list for PNPACPI device enumeration
        ACPI / documentation: Fix ambiguity in the GPIO properties document
        ACPI / documentation: fix a sentence about GPIO resources
        ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook
        x86/PCI/ACPI: Make all resources except [io 0xcf8-0xcff] available on PCI bus
      3e0283a5
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-resources', 'acpi-battery', 'acpi-doc' and 'acpi-pnp' · 9a5d9315
      Rafael J. Wysocki authored
      * acpi-resources:
        x86/PCI/ACPI: Make all resources except [io 0xcf8-0xcff] available on PCI bus
      
      * acpi-battery:
        ACPI / SBS: Add 5 us delay to fix SBS hangs on MacBook
      
      * acpi-doc:
        ACPI / documentation: Fix ambiguity in the GPIO properties document
        ACPI / documentation: fix a sentence about GPIO resources
      
      * acpi-pnp:
        ACPI / PNP: add two IDs to list for PNPACPI device enumeration
      9a5d9315
    • Linus Torvalds's avatar
      Merge tag 'for-f2fs-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 68c2f356
      Linus Torvalds authored
      Pull f2fs fixes from Jaegeuk Kim:
       "Fix a performance regression and a bug"
      
      * tag 'for-f2fs-4.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs:
        f2fs: fix wrong error hanlder in f2fs_follow_link
        Revert "f2fs: enhance multi-threads performance"
      68c2f356
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · fbb7b92f
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Here is a smallish set of pin control fixes for the v4.1 cycle,
        collected the last two weeks:
      
         - fix a real nasty legacy bug that has screwed up the protection of
           adding pinctrl maps dynamically.  Normally this didn't happen so
           much but Dough Anderson ran into it and fixed it, kudos!
      
        - minor driver fixes for Qualcomm spmi, mediatek and Marvell drivers"
      
      * tag 'pinctrl-v4.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: Don't just pretend to protect pinctrl_maps, do it for real
        pinctrl: mediatek: mtk-common: initialize unmask
        pinctrl: qcom-spmi-mpp: Fix input value report
        pinctrl: qcom-spmi: Fix pin direction configuration
        pinctrl: mvebu: Fix mapping of pin 63 (gpo -> gpio)
      fbb7b92f
    • Linus Torvalds's avatar
      Merge tag 'vfio-v4.1-rc3' of git://github.com/awilliam/linux-vfio · 7bbcd1b8
      Linus Torvalds authored
      Pull vfio fixes from Alex Williamson:
       "Fix some undesirable behavior with the vfio device request interface:
      
         - increase verbosity of device request channel (Alex Williamson)
      
         - fix runaway interruptible timeout (Alex Williamson)"
      
      * tag 'vfio-v4.1-rc3' of git://github.com/awilliam/linux-vfio:
        vfio: Fix runaway interruptible timeout
        vfio-pci: Log device requests more verbosely
      7bbcd1b8
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://github.com/dledford/linux · 8cb7c15b
      Linus Torvalds authored
      Pull infiniband updates from Doug Ledford:
       "Minor updates for 4.1-rc
      
        Most of the changes are fairly small and well confined.  The iWARP
        address reporting changes are the only ones that are a medium size.  I
        had these queued up prior to rc1, but due to the shuffle in
        maintainers, they did not get submitted when I expected.  My apologies
        for that.  I feel comfortable with them however due to the testing
        they've received, so I left them in this submission"
      
      * tag 'for-linus' of git://github.com/dledford/linux:
        MAINTAINERS: Update InfiniBand subsystem maintainer
        MAINTAINERS: add include/rdma/ to InfiniBand subsystem
        IPoIB/CM: Fix indentation level
        iw_cxgb4: Remove negative advice dmesg warnings
        IB/core: Fix unaligned accesses
        IB/core: change rdma_gid2ip into void function as it always return zero
        IB/qib: use arch_phys_wc_add()
        IB/qib: add acounting for MTRR
        IB/core: dma unmap optimizations
        IB/core: dma map/unmap locking optimizations
        RDMA/cxgb4: Report the actual address of the remote connecting peer
        RDMA/nes: Report the actual address of the remote connecting peer
        RDMA/core: Enable the iWarp Port Mapper to provide the actual address of the connecting peer to its clients
        iw_cxgb4: enforce qp/cq id requirements
        iw_cxgb4: use BAR2 GTS register for T5 kernel mode CQs
        iw_cxgb4: 32b platform fixes
        iw_cxgb4: Cleanup register defines/MACROS
        RDMA/CMA: Canonize IPv4 on IPV6 sockets properly
      8cb7c15b
  3. 06 May, 2015 26 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.1b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 0e1dc427
      Linus Torvalds authored
      Pull xen bug fixes from David Vrabel:
      
       - fix blkback regression if using persistent grants
      
       - fix various event channel related suspend/resume bugs
      
       - fix AMD x86 regression with X86_BUG_SYSRET_SS_ATTRS
      
       - SWIOTLB on ARM now uses frames <4 GiB (if available) so device only
         capable of 32-bit DMA work.
      
      * tag 'for-linus-4.1b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen: Add __GFP_DMA flag when xen_swiotlb_init gets free pages on ARM
        hypervisor/x86/xen: Unset X86_BUG_SYSRET_SS_ATTRS on Xen PV guests
        xen/events: Set irq_info->evtchn before binding the channel to CPU in __startup_pirq()
        xen/console: Update console event channel on resume
        xen/xenbus: Update xenbus event channel on resume
        xen/events: Clear cpu_evtchn_mask before resuming
        xen-pciback: Add name prefix to global 'permissive' variable
        xen: Suspend ticks on all CPUs during suspend
        xen/grant: introduce func gnttab_unmap_refs_sync()
        xen/blkback: safely unmap purge persistent grants
      0e1dc427
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3d54ac9e
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "EFI fixes, and FPU fix, a ticket spinlock boundary condition fix and
        two build fixes"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/fpu: Always restore_xinit_state() when use_eager_cpu()
        x86: Make cpu_tss available to external modules
        efi: Fix error handling in add_sysfs_runtime_map_entry()
        x86/spinlocks: Fix regression in spinlock contention detection
        x86/mm: Clean up types in xlate_dev_mem_ptr()
        x86/efi: Store upper bits of command line buffer address in ext_cmd_line_ptr
        efivarfs: Ensure VariableName is NUL-terminated
      3d54ac9e
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d8fce2db
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Mostly tooling fixes, but also an uncore PMU driver fix and an uncore
        PMU driver hardware-enablement addition"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf probe: Fix segfault if passed with ''.
        perf report: Fix -T/--threads option to work again
        perf bench numa: Fix immediate meeting of convergence condition
        perf bench numa: Fixes of --quiet argument
        perf bench futex: Fix hung wakeup tasks after requeueing
        perf probe: Fix bug with global variables handling
        perf top: Fix a segfault when kernel map is restricted.
        tools lib traceevent: Fix build failure on 32-bit arch
        perf kmem: Fix compiles on RHEL6/OL6
        tools lib api: Undefine _FORTIFY_SOURCE before setting it
        perf kmem: Consistently use PRIu64 for printing u64 values
        perf trace: Disable events and drain events when forked workload ends
        perf trace: Enable events when doing system wide tracing and starting a workload
        perf/x86/intel/uncore: Move PCI IDs for IMC to uncore driver
        perf/x86/intel/uncore: Add support for Intel Haswell ULT (lower power Mobile Processor) IMC uncore PMUs
        perf/x86/intel: Add cpu_(prepare|starting|dying) for core_pmu
      d8fce2db
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 02f0f572
      Linus Torvalds authored
      Pull RCU fix from Ingo Molnar:
       "An RCU Kconfig fix that eliminates an annoying interactive kconfig
        question for CONFIG_RCU_TORTURE_TEST_SLOW_INIT"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        rcu: Control grace-period delays directly from value
      02f0f572
    • Doug Anderson's avatar
      pinctrl: Don't just pretend to protect pinctrl_maps, do it for real · c5272a28
      Doug Anderson authored
      Way back, when the world was a simpler place and there was no war, no
      evil, and no kernel bugs, there was just a single pinctrl lock.  That
      was how the world was when (57291ce2 pinctrl: core device tree mapping
      table parsing support) was written.  In that case, there were
      instances where the pinctrl mutex was already held when
      pinctrl_register_map() was called, hence a "locked" parameter was
      passed to the function to indicate that the mutex was already locked
      (so we shouldn't lock it again).
      
      A few years ago in (42fed7ba pinctrl: move subsystem mutex to
      pinctrl_dev struct), we switched to a separate pinctrl_maps_mutex.
      ...but (oops) we forgot to re-think about the whole "locked" parameter
      for pinctrl_register_map().  Basically the "locked" parameter appears
      to still refer to whether the bigger pinctrl_dev mutex is locked, but
      we're using it to skip locks of our (now separate) pinctrl_maps_mutex.
      
      That's kind of a bad thing(TM).  Probably nobody noticed because most
      of the calls to pinctrl_register_map happen at boot time and we've got
      synchronous device probing.  ...and even cases where we're
      asynchronous don't end up actually hitting the race too often.  ...but
      after banging my head against the wall for a bug that reproduced 1 out
      of 1000 reboots and lots of looking through kgdb, I finally noticed
      this.
      
      Anyway, we can now safely remove the "locked" parameter and go back to
      a war-free, evil-free, and kernel-bug-free world.
      
      Fixes: 42fed7ba ("pinctrl: move subsystem mutex to pinctrl_dev struct")
      Signed-off-by: default avatarDoug Anderson <dianders@chromium.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      c5272a28
    • Stefano Stabellini's avatar
      xen: Add __GFP_DMA flag when xen_swiotlb_init gets free pages on ARM · 8746515d
      Stefano Stabellini authored
      Make sure that xen_swiotlb_init allocates buffers that are DMA capable
      when at least one memblock is available below 4G. Otherwise we assume
      that all devices on the SoC can cope with >4G addresses. We do this on
      ARM and ARM64, where dom0 is mapped 1:1, so pfn == mfn in this case.
      
      No functional changes on x86.
      
      From: Chen Baozi <baozich@gmail.com>
      Signed-off-by: default avatarChen Baozi <baozich@gmail.com>
      Signed-off-by: default avatarStefano Stabellini <stefano.stabellini@eu.citrix.com>
      Tested-by: default avatarChen Baozi <baozich@gmail.com>
      Acked-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      8746515d
    • Borislav Petkov's avatar
      x86/alternatives: Document macros · 5b673a48
      Borislav Petkov authored
      Add some text to the macro magic for future reference and against
      failing human memory.
      Requested-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5b673a48
    • Bobby Powers's avatar
      x86/fpu: Always restore_xinit_state() when use_eager_cpu() · c88d4748
      Bobby Powers authored
      The following commit:
      
        f893959b ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()")
      
      removed drop_init_fpu() usage from flush_thread(). This seems to break
      things for me - the Go 1.4 test suite fails all over the place with
      floating point comparision errors (offending commit found through
      bisection).
      
      The functional change was that flush_thread() after this commit
      only calls restore_init_xstate() when both use_eager_fpu() and
      !used_math() are true. drop_init_fpu() (now fpu_reset_state()) calls
      restore_init_xstate() regardless of whether current used_math() - apply
      the same logic here.
      
      Switch used_math() -> tsk_used_math(tsk) to consistently use the grabbed
      tsk instead of current, like in the rest of flush_thread().
      Tested-by: default avatarDave Hansen <dave.hansen@intel.com>
      Signed-off-by: default avatarBobby Powers <bobbypowers@gmail.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Pekka Riikonen <priikone@iki.fi>
      Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Suresh Siddha <sbsiddha@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: f893959b ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()")
      Link: http://lkml.kernel.org/r/1430147441-9820-1-git-send-email-bobbypowers@gmail.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c88d4748
    • H.J. Lu's avatar
      x86/asm: Use -mskip-rax-setup if supported · d9ee948d
      H.J. Lu authored
      GCC 5 added a compiler option, -mskip-rax-setup, for x86-64. It skips
      setting up the RAX register when SSE is disabled and there are no
      variable arguments passed in vector registers. (According to the x86_64
      ABI, %al is used as a hidden register containing the number of vector
      registers used).
      
      Since the kernel doesn't pass vector registers to functions with
      variable arguments, this option can be used to optimize the x86-64
      kernel.
      
      This GCC feature was suggested by Rasmus Villemoes <linux@rasmusvillemoes.dk>.
      This is the corresponding kernel change using it.
      
      For kernel v3.17:
      
            text   data    bss    dec       filename
        11455921 2204048 5853184 19513153   vmlinux #with -mskip-rax-setup
        11480079 2204048 5853184 19537311   vmlinux
      
      For Kernel v4.0+ - custom config:
      
            text   data    bss    dec       filename
        10231778 3479800 16617472 30329050  vmlinux-gcc5+-mskip-rax-setup
        10268797 3547448 16621568 30437813  vmlinux
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d9ee948d
    • Ingo Molnar's avatar
      Merge tag 'efi-urgent' of... · c102cb09
      Ingo Molnar authored
      Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent
      
      Pull EFI fixes from Matt Fleming:
      
       * Avoid garbage names in efivarfs due to buggy firmware by zeroing
         EFI variable name. (Ross Lagerwall)
      
       * Stop erroneously dropping upper 32 bits of boot command line pointer
         in EFI boot stub and stash them in ext_cmd_line_ptr. (Roy Franz)
      
       * Fix double-free bug in error handling code path of EFI runtime map
         code. (Dan Carpenter)
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c102cb09
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo' of... · 74f40c1f
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
        - Fix 'perf probe -a' segfault if passed with '' (Wang Nan)
      
        - Fix report -T/--threads option (Namhyung Kim)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      74f40c1f
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.1-1' of git://git.code.sf.net/p/openipmi/linux-ipmi · 5198b443
      Linus Torvalds authored
      Pull IPMI fixes from Corey Minyard:
       "Lots of minor IPMI fixes, especially ones that have have come up since
        the SSIF driver has been in the main kernel for a while"
      
      * tag 'for-linus-4.1-1' of git://git.code.sf.net/p/openipmi/linux-ipmi:
        ipmi: Fix multi-part message handling
        ipmi: Add alert handling to SSIF
        ipmi: Fix a problem that messages are not issued in run_to_completion mode
        ipmi: Report an error if ACPI _IFT doesn't exist
        ipmi: Remove unused including <linux/version.h>
        ipmi: Don't report err in the SI driver for SSIF devices
        ipmi: Remove incorrect use of seq_has_overflowed
        ipmi:ssif: Ignore spaces when comparing I2C adapter names
        ipmi_ssif: Fix the logic on user-supplied addresses
      5198b443
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 2a171aa2
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "16 patches
      
        This includes a new rtc driver for the Abracon AB x80x and isn't very
        appropriate for -rc2.  It was still being fiddled with a bit during
        the merge window and I fell asleep during -rc1"
      
      [ So I took the new driver, it seems small and won't regress anything.
        I'm a softy.   - Linus ]
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        rtc: armada38x: fix concurrency access in armada38x_rtc_set_time
        ocfs2: dlm: fix race between purge and get lock resource
        nilfs2: fix sanity check of btree level in nilfs_btree_root_broken()
        util_macros.h: have array pointer point to array of constants
        configfs: init configfs module earlier at boot time
        mm/hwpoison-inject: check PageLRU of hpage
        mm/hwpoison-inject: fix refcounting in no-injection case
        mm: soft-offline: fix num_poisoned_pages counting on concurrent events
        rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
        Documentation: bindings: add abracon,abx80x
        kasan: show gcc version requirements in Kconfig and Documentation
        mm/memory-failure: call shake_page() when error hits thp tail page
        lib: delete lib/find_last_bit.c
        MAINTAINERS: add co-maintainer for LED subsystem
        zram: add Designated Reviewer for zram in MAINTAINERS
        revert "zram: move compact_store() to sysfs functions area"
      2a171aa2
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.1-2' of... · 3ce05a4e
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v4.1-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
      
      Pull x86 platform driver fixes from Darren Hart:
       "This includes a trivial warning and adding a Lenovo laptop to an
        existing quirk.
      
        I've held off on things like the latter in the past, but I didn't feel
        it was risky enough to push out to 4.2.
      
         - thinkpad_acpi:
              Fix warning for static not at beginning
      
         - ideapad_laptop:
              Add Lenovo G40-30 to devices without radio switch"
      
      * tag 'platform-drivers-x86-v4.1-2' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86:
        thinkpad_acpi: Fix warning for static not at beginning
        ideapad_laptop: Add Lenovo G40-30 to devices without radio switch
      3ce05a4e
    • Corey Minyard's avatar
      ipmi: Fix multi-part message handling · 3d69d43b
      Corey Minyard authored
      Lots of little fixes for multi-part messages:
      
      The values was not being re-initialized, if something went wrong
      handling a multi-part message and it got left in a bad state, it
      might be an issue.
      
      The commands were not correct when issuing multi-part reads, the
      code was not passing in the proper value for commands.  Also clean
      up some minor formatting issues.
      
      Get the block number from the right location, limit the maximum send
      message size to 63 bytes and explain why, and fix some minor sylistic
      issues.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      3d69d43b
    • Corey Minyard's avatar
      ipmi: Add alert handling to SSIF · 91620521
      Corey Minyard authored
      The SSIF interface can optionally have an SMBus alert come in when
      data is ready.  Unfortunately, the IPMI spec gives wiggle room to
      the implementer to allow them to always have the alert enabled,
      even if the driver doesn't enable it.  So implement alerts.
      If you don't in this situation, the SMBus alert handling will
      constantly complain.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      91620521
    • Hidehiro Kawai's avatar
      ipmi: Fix a problem that messages are not issued in run_to_completion mode · 9f812704
      Hidehiro Kawai authored
      start_next_msg() issues a message placed in smi_info->waiting_msg
      if it is non-NULL.  However, sender() sets a message to
      smi_info->curr_msg and NULL to smi_info->waiting_msg in the context
      of run_to_completion mode.  As the result, it leads an infinite
      loop by waiting the completion of unissued message when leaving
      dying message after kernel panic.
      
      sender() should set the message to smi_info->waiting_msg not
      curr_msg.
      Signed-off-by: default avatarHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      9f812704
    • Corey Minyard's avatar
      ipmi: Report an error if ACPI _IFT doesn't exist · a182a4b2
      Corey Minyard authored
      When probing an ACPI table, report a specific error, instead of just
      returning an error, if _IFT doesn't exist.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      a182a4b2
    • Wei Yongjun's avatar
      ipmi: Remove unused including <linux/version.h> · 15c5725e
      Wei Yongjun authored
      Remove including <linux/version.h> that don't need it.
      Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      15c5725e
    • Gregory CLEMENT's avatar
      rtc: armada38x: fix concurrency access in armada38x_rtc_set_time · 489405fe
      Gregory CLEMENT authored
      While setting the time, the RTC TIME register should not be accessed.
      However due to hardware constraints, setting the RTC time involves
      sleeping during 100ms.  This sleep was done outside the critical section
      protected by the spinlock, so it was possible to read the RTC TIME
      register and get an incorrect value.  This patch introduces a mutex for
      protecting the RTC TIME access, unlike the spinlock it is allowed to
      sleep in a critical section protected by a mutex.
      
      The RTC STATUS register can still be used from the interrupt handler but
      it has no effect on setting the time.
      Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Acked-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
      Acked-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: <stable@vger.kernel.org>	[4.0]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      489405fe
    • Junxiao Bi's avatar
      ocfs2: dlm: fix race between purge and get lock resource · b1432a2a
      Junxiao Bi authored
      There is a race window in dlm_get_lock_resource(), which may return a
      lock resource which has been purged.  This will cause the process to
      hang forever in dlmlock() as the ast msg can't be handled due to its
      lock resource not existing.
      
          dlm_get_lock_resource {
              ...
              spin_lock(&dlm->spinlock);
              tmpres = __dlm_lookup_lockres_full(dlm, lockid, namelen, hash);
              if (tmpres) {
                   spin_unlock(&dlm->spinlock);
                   >>>>>>>> race window, dlm_run_purge_list() may run and purge
                                    the lock resource
                   spin_lock(&tmpres->spinlock);
                   ...
                   spin_unlock(&tmpres->spinlock);
              }
          }
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Joseph Qi <joseph.qi@huawei.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1432a2a
    • Ryusuke Konishi's avatar
      nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() · d8fd150f
      Ryusuke Konishi authored
      The range check for b-tree level parameter in nilfs_btree_root_broken()
      is wrong; it accepts the case of "level == NILFS_BTREE_LEVEL_MAX" even
      though the level is limited to values in the range of 0 to
      (NILFS_BTREE_LEVEL_MAX - 1).
      
      Since the level parameter is read from storage device and used to index
      nilfs_btree_path array whose element count is NILFS_BTREE_LEVEL_MAX, it
      can cause memory overrun during btree operations if the boundary value
      is set to the level parameter on device.
      
      This fixes the broken sanity check and adds a comment to clarify that
      the upper bound NILFS_BTREE_LEVEL_MAX is exclusive.
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d8fd150f
    • Guenter Roeck's avatar
      util_macros.h: have array pointer point to array of constants · 05836c37
      Guenter Roeck authored
      Using the new find_closest() macro can result in the following sparse
      warnings.
      
        drivers/hwmon/lm85.c:194:16: warning:
        		incorrect type in initializer (different modifiers)
        drivers/hwmon/lm85.c:194:16:    expected int *__fc_a
        drivers/hwmon/lm85.c:194:16:    got int static const [toplevel] *<noident>
        drivers/hwmon/lm85.c:210:16: warning:
        		incorrect type in initializer (different modifiers)
        drivers/hwmon/lm85.c:210:16:    expected int *__fc_a
        drivers/hwmon/lm85.c:210:16:    got int const *map
      
      This is because the array passed to find_closest() will typically be
      declared as array of constants, but the macro declares a non-constant
      pointer to it.
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      05836c37
    • Daniel Baluta's avatar
      configfs: init configfs module earlier at boot time · f5b69770
      Daniel Baluta authored
      We need this earlier in the boot process to allow various subsystems to
      use configfs (e.g Industrial IIO).
      
      Also, debugfs is at core_initcall level and configfs should be on the same
      level from infrastructure point of view.
      Signed-off-by: default avatarDaniel Baluta <daniel.baluta@intel.com>
      Suggested-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f5b69770
    • Naoya Horiguchi's avatar
      mm/hwpoison-inject: check PageLRU of hpage · e386eed8
      Naoya Horiguchi authored
      Hwpoison injector checks PageLRU of the raw target page to find out
      whether the page is an appropriate target, but current code now filters
      out thp tail pages, which prevents us from testing for such cases via this
      interface.  So let's check hpage instead of p.
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Acked-by: default avatarDean Nelson <dnelson@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e386eed8
    • Naoya Horiguchi's avatar
      mm/hwpoison-inject: fix refcounting in no-injection case · 7ea434a4
      Naoya Horiguchi authored
      Hwpoison injection via debugfs:hwpoison/corrupt-pfn takes a refcount of
      the target page.  But current code doesn't release it if the target page
      is not supposed to be injected, which results in memory leak.  This patch
      simply adds the refcount releasing code.
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Acked-by: default avatarDean Nelson <dnelson@redhat.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7ea434a4