Skip to content
  1. Mar 05, 2015
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Shrink code in 'paranoid_exit' · 0d550836
      Denys Vlasenko authored
      
      
      RESTORE_EXTRA_REGS + RESTORE_C_REGS looks small, but it's
      a lot of instructions (fourteen). Let's reuse them.
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      [ Cleaned up the labels. ]
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1421272101-16847-2-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/59d71848cee3ec9eb48c0252e602efd6bd560e3c.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0d550836
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Fix comments · e90e147c
      Denys Vlasenko authored
      
      
       - Misleading and slightly incorrect comments in "struct pt_regs" are
         fixed (four instances).
      
       - Fix incorrect comment atop EMPTY_FRAME macro.
      
       - Explain in more detail what we do with stack layout during hw interrupt.
      
       - Correct comments about "partial stack frame" which are no longer
         true.
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1423778052-21038-3-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/e1f4429c491fe6ceeddb879dea2786e0f8920f9c.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e90e147c
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Always allocate a complete "struct pt_regs" on the kernel stack · 76f5df43
      Denys Vlasenko authored
      
      
      The 64-bit entry code was using six stack slots less by not
      saving/restoring registers which are callee-preserved according
      to the C ABI, and was not allocating space for them.
      
      Only when syscalls needed a complete "struct pt_regs" was
      the complete area allocated and filled in.
      
      As an additional twist, on interrupt entry a "slightly less
      truncated pt_regs" trick is used, to make nested interrupt
      stacks easier to unwind.
      
      This proved to be a source of significant obfuscation and subtle
      bugs. For example, 'stub_fork' had to pop the return address,
      extend the struct, save registers, and push return address back.
      Ugly. 'ia32_ptregs_common' pops return address and "returns" via
      jmp insn, throwing a wrench into CPU return stack cache.
      
      This patch changes the code to always allocate a complete
      "struct pt_regs" on the kernel stack. The saving of registers
      is still done lazily.
      
      "Partial pt_regs" trick on interrupt stack is retained.
      
      Macros which manipulate "struct pt_regs" on stack are reworked:
      
       - ALLOC_PT_GPREGS_ON_STACK allocates the structure.
      
       - SAVE_C_REGS saves to it those registers which are clobbered
         by C code.
      
       - SAVE_EXTRA_REGS saves to it all other registers.
      
       - Corresponding RESTORE_* and REMOVE_PT_GPREGS_FROM_STACK macros
         reverse it.
      
      'ia32_ptregs_common', 'stub_fork' and friends lost their ugly dance
      with the return pointer.
      
      LOAD_ARGS32 in ia32entry.S now uses symbolic stack offsets
      instead of magic numbers.
      
      'error_entry' and 'save_paranoid' now use SAVE_C_REGS +
      SAVE_EXTRA_REGS instead of having it open-coded yet again.
      
      Patch was run-tested: 64-bit executables, 32-bit executables,
      strace works.
      
      Timing tests did not show measurable difference in 32-bit
      and 64-bit syscalls.
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1423778052-21038-2-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/b89763d354aa23e670b9bdf3a40ae320320a7c2e.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      76f5df43
    • Denys Vlasenko's avatar
      x86/asm/entry/64: Fix incorrect symbolic constant usage: R11->ARGOFFSET · 6e1327bd
      Denys Vlasenko authored
      
      
      Since the last fix of this nature, a few more instances have crept
      in. Fix them up. No object code changes (constants have the same
      value).
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1423778052-21038-1-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/f5e1c4084319a42e5f14d41e2d638949ce66bc08.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6e1327bd
    • Denys Vlasenko's avatar
      x86/asm: Introduce push/pop macros which generate CFI_REL_OFFSET and CFI_RESTORE · 49db46a6
      Denys Vlasenko authored
      
      
      Sequences:
      
              pushl_cfi %reg
              CFI_REL_OFFSET reg, 0
      
      and:
      
              popl_cfi %reg
              CFI_RESTORE reg
      
      happen quite often. This patch adds macros which generate them.
      
      No assembly changes (verified with objdump -dr vmlinux.o).
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1421017655-25561-1-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/2202eb90f175cf45d1b2d1c64dbb5676a8ad07ad.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      49db46a6
    • Denys Vlasenko's avatar
      x86/asm/64: Open-code register save/restore in trace_hardirqs*() thunks · 69e8544c
      Denys Vlasenko authored
      
      
      This is a preparatory patch for change in "struct pt_regs"
      handling in entry_64.S.
      
      trace_hardirqs*() thunks were (ab)using a part of the
      'pt_regs' handling code, namely the SAVE_ARGS/RESTORE_ARGS
      macros, to save/restore registers across C function calls.
      
      Since SAVE_ARGS is going to be changed, open-code
      register saving/restoring here.
      
      Incidentally, this removes a bit of dead code:
      one SAVE_ARGS was used just to emit a CFI annotation,
      but it also generated unreachable assembly instructions.
      
      Take a page from thunk_32.S and use push/pop instructions
      instead of movq, they are far shorter:
      1 or 2 bytes versus 5, and no need for instructions to adjust %rsp:
      
         text	   data	    bss	    dec	    hex	filename
          333	     40	      0	    373	    175	thunk_64_movq.o
          104	     40	      0	    144	     90	thunk_64_push_pop.o
      
      [ This is ugly as sin, but we'll fix up the ugliness in the next
        patch. I see no point in reordering patches just to avoid an
        ugly intermediate state.  --Andy ]
      
      Signed-off-by: default avatarDenys Vlasenko <dvlasenk@redhat.com>
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      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: Will Drewry <wad@chromium.org>
      Link: http://lkml.kernel.org/r/1420927210-19738-4-git-send-email-dvlasenk@redhat.com
      Link: http://lkml.kernel.org/r/4c979ad604f0f02c5ade3b3da308b53eabd5e198.1424989793.git.luto@amacapital.net
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      69e8544c
  2. Mar 04, 2015
    • Ingo Molnar's avatar
      Merge tag 'alternatives_padding' of... · f8e92fb4
      Ingo Molnar authored
      
      Merge tag 'alternatives_padding' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp into x86/asm
      
      Pull alternative instructions framework improvements from Borislav Petkov:
      
       "A more involved rework of the alternatives framework to be able to
        pad instructions and thus make using the alternatives macros more
        straightforward and without having to figure out old and new instruction
        sizes but have the toolchain figure that out for us.
      
        Furthermore, it optimizes JMPs used so that fetch and decode can be
        relieved with smaller versions of the JMPs, where possible.
      
        Some stats:
      
          x86_64 defconfig:
      
          Alternatives sites total:               2478
          Total padding added (in Bytes):         6051
      
        The padding is currently done for:
      
          X86_FEATURE_ALWAYS
          X86_FEATURE_ERMS
          X86_FEATURE_LFENCE_RDTSC
          X86_FEATURE_MFENCE_RDTSC
          X86_FEATURE_SMAP
      
        This is with the latest version of the patchset. Of course, on each
        machine the alternatives sites actually being patched are a proper
        subset of the total number."
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f8e92fb4
    • Ingo Molnar's avatar
      d2c032e3
    • Brian Gerst's avatar
      x86/compat: Remove sys32_vm86_warning · 7e8e385a
      Brian Gerst authored
      
      
      The check against lastcomm is racy, and the message it produces
      isn't necessary.  vm86 support can be disabled on a 32-bit
      kernel also, and doesn't have this message.  Switch to
      sys_ni_syscall instead.
      
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1425439896-8322-4-git-send-email-brgerst@gmail.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      7e8e385a
    • Brian Gerst's avatar
      x86/compat: Merge native and compat 32-bit syscall tables · 2aa4a710
      Brian Gerst authored
      
      
      Combine the 32-bit syscall tables into one file.
      
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1425439896-8322-3-git-send-email-brgerst@gmail.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2aa4a710
    • Brian Gerst's avatar
      x86/compat: Remove compat_ni_syscall() · 29a5ff97
      Brian Gerst authored
      
      
      compat_ni_syscall() does the same thing as sys_ni_syscall().
      
      Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1425439896-8322-2-git-send-email-brgerst@gmail.com
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      29a5ff97
    • Linus Torvalds's avatar
      Linux 4.0-rc2 · 13a7a6ac
      Linus Torvalds authored
      v4.0-rc2
      13a7a6ac
    • Daniel Vetter's avatar
      drm/i915: Fix modeset state confusion in the load detect code · 9128b040
      Daniel Vetter authored
      This is a tricky story of the new atomic state handling and the legacy
      code fighting over each another. The bug at hand is an underrun of the
      framebuffer reference with subsequent hilarity caused by the load
      detect code. Which is peculiar since the the exact same code works
      fine as the implementation of the legacy setcrtc ioctl.
      
      Let's look at the ingredients:
      
      - Currently our code is a crazy mix of legacy modeset interfaces to
        set the parameters and half-baked atomic state tracking underneath.
        While this transition is going we're using the transitional plane
        helpers to update the atomic side (drm_plane_helper_disable/update
        and friends), i.e. plane->state->fb. Since the state structure owns
        the fb those functions take care of that themselves.
      
        The legacy state (specifically crtc->primary->fb) is still managed
        by the old code (and mostly by the drm core), with the fb reference
        counting done by callers (core drm for the ioctl or the i915 load
        detect code). The relevant commit is
      
        commit ea2c67bb
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Tue Dec 23 10:41:52 2014 -0800
      
            drm/i915: Move to atomic plane helpers (v9)
      
      - drm_plane_helper_disable has special code to handle multiple calls
        in a row - it checks plane->crtc == NULL and bails out. This is to
        match the proper atomic implementation which needs the crtc to get
        at the implied locking context atomic updates always need. See
      
        commit acf24a39
        Author: Daniel Vetter <daniel.vetter@ffwll.ch>
        Date:   Tue Jul 29 15:33:05 2014 +0200
      
            drm/plane-helper: transitional atomic plane helpers
      
      - The universal plane code split out the implicit primary plane from
        the CRTC into it's own full-blown drm_plane object. As part of that
        the setcrtc ioctl (which updated both the crtc mode and primary
        plane) learned to set crtc->primary->crtc on modeset to make sure
        the plane->crtc assignments statate up to date in
      
        commit e13161af
      
      
        Author: Matt Roper <matthew.d.roper@intel.com>
        Date:   Tue Apr 1 15:22:38 2014 -0700
      
            drm: Add drm_crtc_init_with_planes() (v2)
      
        Unfortunately we've forgotten to update the load detect code. Which
        wasn't a problem since the load detect modeset is temporary and
        always undone before we drop the locks.
      
      - Finally there is a organically grown history (i.e. don't ask) around
        who sets the legacy plane->fb for the various driver entry points.
        Originally updating that was the drivers duty, but for almost all
        places we've moved that (plus updating the refcounts) into the core.
        Again the exception is the load detect code.
      
      Taking all together the following happens:
      - The load detect code doesn't set crtc->primary->crtc. This is only
        really an issue on crtcs never before used or when userspace
        explicitly disabled the primary plane.
      
      - The plane helper glue code short-circuits because of that and leaves
        a non-NULL fb behind in plane->state->fb and plane->fb. The state
        fb isn't a real problem (it's properly refcounted on its own), it's
        just the canary.
      
      - Load detect code drops the reference for that fb, but doesn't set
        plane->fb = NULL. This is ok since it's still living in that old
        world where drivers had to clear the pointer but the core/callers
        handled the refcounting.
      
      - On the next modeset the drm core notices plane->fb and takes care of
        refcounting it properly by doing another unref. This drops the
        refcount to zero, leaving state->plane now pointing at freed memory.
      
      - intel_plane_duplicate_state still assume it owns a reference to that
        very state->fb and bad things start to happen.
      
      Fix this all by applying the same duct-tape as for the legacy setcrtc
      ioctl code and set crtc->primary->crtc properly.
      
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Cc: Paul Bolle <pebolle@tiscali.nl>
      Cc: Rob Clark <robdclark@gmail.com>
      Cc: Paulo Zanoni <przanoni@gmail.com>
      Cc: Sean Paul <seanpaul@chromium.org>
      Cc: Matt Roper <matthew.d.roper@intel.com>
      Reported-and-tested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9128b040
    • Borislav Petkov's avatar
      perf/bench: Add -r all so that you can run all mem* routines · dfecb95c
      Borislav Petkov authored
      
      
      perf bench mem mem{set,cpy} -r all thus runs all available mem
      benchmarking routines.
      
      Reviewed-by: default avatarHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      dfecb95c
    • Borislav Petkov's avatar
      perf/bench: Carve out mem routine benchmarking · 515e23f0
      Borislav Petkov authored
      
      
      ... so that we can call it multiple times. See next patch.
      
      Reviewed-by: default avatarHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      515e23f0
    • Borislav Petkov's avatar
      perf/bench: Fix mem* routines usage after alternatives change · 0cf55934
      Borislav Petkov authored
      
      
      Adjust perf bench to the new changes in the alternatives code for
      memcpy/memset.
      
      Reviewed-by: default avatarHitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      0cf55934
  3. Mar 03, 2015
    • Linus Torvalds's avatar
      Merge tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · 023a6007
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
       "Two GPIO fixes:
      
         - Fix a translation problem in of_get_named_gpiod_flags()
      
         - Fix a long standing container_of() mistake in the TPS65912 driver"
      
      * tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        gpio: tps65912: fix wrong container_of arguments
        gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node
      023a6007
    • Linus Torvalds's avatar
      Merge branch 'fixes-for-4.0-rc2' of... · 10d6dfc1
      Linus Torvalds authored
      Merge branch 'fixes-for-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
      
      Pull thermal management fixes from Eduardo Valentin:
       "Specifics:
      
         - Several fixes in tmon tool.
      
         - Fixes in intel int340x for _ART and _TRT tables.
      
         - Add id for Avoton SoC into powerclamp driver.
      
         - Fixes in RCAR thermal driver to remove race conditions and fix fail
           path
      
         - Fixes in TI thermal driver: removal of unnecessary code and build
           fix if !CONFIG_PM_SLEEP
      
         - Cleanups in exynos thermal driver
      
         - Add stubs for include/linux/thermal.h.  Now drivers using thermal
           calls but that also work without CONFIG_THERMAL will be able to
           compile for systems that don't care about thermal.
      
        Note: I am sending this pull on Rui's behalf while he fixes issues in
        his Linux box"
      
      * 'fixes-for-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
        thermal: int340x_thermal: Ignore missing _ART, _TRT tables
        thermal/intel_powerclamp: add id for Avoton SoC
        tools/thermal: tmon: silence 'set but not used' warnings
        tools/thermal: tmon: use pkg-config to determine library dependencies
        tools/thermal: tmon: support cross-compiling
        tools/thermal: tmon: add .gitignore
        tools/thermal: tmon: fixup tui windowing calculations
        tools/thermal: tmon: tui: don't hard-code dialog window size assumptions
        tools/thermal: tmon: add min/max macros
        tools/thermal: tmon: add --target-temp parameter
        thermal: exynos: Clean-up code to use oneline entry for exynos compatible table
        thermal: rcar: Make error and remove paths symmetrical with init
        thermal: rcar: Fix race condition between init and interrupt
        thermal: Introduce dummy functions when thermal is not defined
        ti-soc-thermal: Delete an unnecessary check before the function call "cpufreq_cooling_unregister"
        thermal: ti-soc-thermal: bandgap: Fix build warning if !CONFIG_PM_SLEEP
      10d6dfc1
    • Linus Torvalds's avatar
      Merge tag 'md/4.0-fixes' of git://neil.brown.name/md · 1a6f77ab
      Linus Torvalds authored
      Pull md fixes from Neil Brown:
       "Three md fixes:
      
         - fix a read-balance problem that was reported 2 years ago, but that
           I never noticed the report :-(
      
         - fix for rare RAID6 problem causing incorrect bitmap updates when
           two devices fail.
      
         - add __ATTR_PREALLOC annotation now that it is possible"
      
      * tag 'md/4.0-fixes' of git://neil.brown.name/md:
        md: mark some attributes as pre-alloc
        raid5: check faulty flag for array status during recovery.
        md/raid1: fix read balance when a drive is write-mostly.
      1a6f77ab
    • Linus Torvalds's avatar
      Merge tag 'metag-fixes-v4.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag · 49db1f0e
      Linus Torvalds authored
      Pull arch/metag fix from James Hogan:
       "This is just a single patch to fix the KSTK_EIP() and KSTK_ESP()
        macros for metag which have always been erronously returning the PC
        and stack pointer of the task's kernel context rather than from its
        user context saved at entry from userland into the kernel, which
        affects the contents of /proc/<pid>/maps and /proc/<pid>/stat"
      
      * tag 'metag-fixes-v4.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag:
        metag: Fix KSTK_EIP() and KSTK_ESP() macros
      49db1f0e
  4. Mar 02, 2015
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a38ecbbd
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "A CR4-shadow 32-bit init fix, plus two typo fixes"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86: Init per-cpu shadow copy of CR4 on 32-bit CPUs too
        x86/platform/intel-mid: Fix trivial printk message typo in intel_mid_arch_setup()
        x86/cpu/intel: Fix trivial typo in intel_tlb_table[]
      a38ecbbd
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 640c0f5c
      Linus Torvalds authored
      Pull timer fixes from Ingo Molnar:
       "Three clockevents/clocksource driver fixes"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource: pxa: Fix section mismatch
        clocksource: mtk: Fix race conditions in probe code
        clockevents: asm9260: Fix compilation error with sparc/sparc64 allyesconfig
      640c0f5c
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d7b48fec
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Two kprobes fixes and a handful of tooling fixes"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf tools: Make sparc64 arch point to sparc
        perf symbols: Define EM_AARCH64 for older OSes
        perf top: Fix SIGBUS on sparc64
        perf tools: Fix probing for PERF_FLAG_FD_CLOEXEC flag
        perf tools: Fix pthread_attr_setaffinity_np build error
        perf tools: Define _GNU_SOURCE on pthread_attr_setaffinity_np feature check
        perf bench: Fix order of arguments to memcpy_alloc_mem
        kprobes/x86: Check for invalid ftrace location in __recover_probed_insn()
        kprobes/x86: Use 5-byte NOP when the code might be modified by ftrace
      d7b48fec
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2ea51b88
      Linus Torvalds authored
      Pull locking fix from Ingo Molnar:
       "An rtmutex deadlock path fixlet"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rtmutex: Set state back to running on error
      2ea51b88
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo' of... · 021f5f12
      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:
      
        - pthread_attr_setaffinity_np() feature detection build fixes (Adrian Hunter, Josh Boyer)
      
        - Fix probing for PERF_FLAG_FD_CLOEXEC flag (Adrian Hunter)
      
        - Fix order of arguments to memcpy_alloc_mem in 'perf bench' (Bruce Merry)
      
        - Sparc64 and Aarch64 build and segfault fixes (David Ahern)
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      021f5f12
  5. Mar 01, 2015
    • Sebastian Andrzej Siewior's avatar
      locking/rtmutex: Set state back to running on error · 9d3e2d02
      Sebastian Andrzej Siewior authored
      
      
      The "usual" path is:
      
       - rt_mutex_slowlock()
       - set_current_state()
       - task_blocks_on_rt_mutex() (ret 0)
       - __rt_mutex_slowlock()
         - sleep or not but do return with __set_current_state(TASK_RUNNING)
       - back to caller.
      
      In the early error case where task_blocks_on_rt_mutex() return
      -EDEADLK we never change the task's state back to RUNNING. I
      assume this is intended. Without this change after ww_mutex
      using rt_mutex the selftest passes but later I get plenty of:
      
        | bad: scheduling from the idle thread!
      
      backtraces.
      
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Acked-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: afffc6c1 ("locking/rtmutex: Optimize setting task running after being blocked")
      Link: http://lkml.kernel.org/r/1425056229-2232...
      9d3e2d02
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · ae1aa797
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Just general fixes: radeon, i915, atmel, tegra, amdkfd and one core
        fix"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (28 commits)
        drm: atmel-hlcdc: remove clock polarity from crtc driver
        drm/radeon: only enable DP audio if the monitor supports it
        drm/radeon: fix atom aux payload size check for writes (v2)
        drm/radeon: fix 1 RB harvest config setup for TN/RL
        drm/radeon: enable SRBM timeout interrupt on EG/NI
        drm/radeon: enable SRBM timeout interrupt on SI
        drm/radeon: enable SRBM timeout interrupt on CIK v2
        drm/radeon: dump full IB if we hit a packet error
        drm/radeon: disable mclk switching with 120hz+ monitors
        drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh
        drm/radeon: enable native backlight control on old macs
        drm/i915: Fix frontbuffer false positve.
        drm/i915: Align initial plane backing objects correctly
        drm/i915: avoid processing spurious/shared interrupts in low-power states
        drm/i915: Check obj->vma_list under the struct_mutex
        drm/i915: Fix a use after free, and unbalanced refcounting
        drm: atmel-hlcdc: remove useless pm_runtime_put_sync in probe
        drm: atmel-hlcdc: reset layer A2Q and UPDATE bits when disabling it
        drm: Fix deadlock due to getconnector locking changes
        drm/i915: Dell Chromebook 11 has PWM backlight
        ...
      ae1aa797
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · a015d33c
      Linus Torvalds authored
      Pull block layer fixes from Jens Axboe:
       "Two smaller fixes for this cycle:
      
         - A fixup from Keith so that NVMe compiles without BLK_INTEGRITY,
           basically just moving the code around appropriately.
      
         - A fixup for shm, fixing an oops in shmem_mapping() for mapping with
           no inode.  From Sasha"
      
      [ The shmem fix doesn't look block-layer-related, but fixes a bug that
        happened due to the backing_dev_info removal..  - Linus ]
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        mm: shmem: check for mapping owner before dereferencing
        NVMe: Fix for BLK_DEV_INTEGRITY not set
      a015d33c
    • Linus Torvalds's avatar
      Merge tag 'xfs-for-linus-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs · 2aaeb784
      Linus Torvalds authored
      Pull xfs fixes from Dave Chinner:
       "These are fixes for regressions/bugs introduced in the 4.0 merge cycle
        and problems discovered during the merge window that need to be pushed
        back to stable kernels ASAP.
      
        This contains:
         - ensure quota type is reset in on-disk dquots
         - fix missing partial EOF block data flush on truncate extension
         - fix transaction leak in error handling for new pnfs block layout
           support
         - add missing target_ip check to RENAME_EXCHANGE"
      
      * tag 'xfs-for-linus-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs:
        xfs: cancel failed transaction in xfs_fs_commit_blocks()
        xfs: Ensure we have target_ip for RENAME_EXCHANGE
        xfs: ensure truncate forces zeroed blocks to disk
        xfs: Fix quota type in quota structures when reusing quota file
      2aaeb784
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · e9738946
      Linus Torvalds authored
      Merge misc fixes from Andrew Morton:
       "13 fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        mm: add missing __PAGETABLE_{PUD,PMD}_FOLDED defines
        mm: page_alloc: revert inadvertent !__GFP_FS retry behavior change
        kernel/sys.c: fix UNAME26 for 4.0
        mm: memcontrol: use "max" instead of "infinity" in control knobs
        zram: use proper type to update max_used_pages
        drivers/rtc/rtc-ds1685.c: fix conditional in ds1685_rtc_sysfs_time_regs_{show,store}
        nilfs2: fix potential memory overrun on inode
        scripts/gdb: add empty package initialization script
        rtc: ds1685: remove superfluous checks for out-of-range u8 values
        rtc: ds1685: fix ds1685_rtc_alarm_irq_enable build error
        memcg: fix low limit calculation
        mm/nommu: fix memory leak
        ocfs2: update web page + git tree in documentation
      e9738946
    • Kirill A. Shutemov's avatar
      mm: add missing __PAGETABLE_{PUD,PMD}_FOLDED defines · c07af4f1
      Kirill A. Shutemov authored
      
      
      Core mm expects __PAGETABLE_{PUD,PMD}_FOLDED to be defined if these page
      table levels folded.  Usually, these defines are provided by
      <asm-generic/pgtable-nopmd.h> and <asm-generic/pgtable-nopud.h>.
      
      But some architectures fold page table levels in a custom way.  They
      need to define these macros themself.  This patch adds missing defines.
      
      The patch fixes mm->nr_pmds underflow and eliminates dead __pmd_alloc()
      and __pud_alloc() on architectures without these page table levels.
      
      Signed-off-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c07af4f1
    • Johannes Weiner's avatar
      mm: page_alloc: revert inadvertent !__GFP_FS retry behavior change · cc873177
      Johannes Weiner authored
      Historically, !__GFP_FS allocations were not allowed to invoke the OOM
      killer once reclaim had failed, but nevertheless kept looping in the
      allocator.
      
      Commit 9879de73 ("mm: page_alloc: embed OOM killing naturally into
      allocation slowpath"), which should have been a simple cleanup patch,
      accidentally changed the behavior to aborting the allocation at that
      point.  This creates problems with filesystem callers (?) that currently
      rely on the allocator waiting for other tasks to intervene.
      
      Revert the behavior as it shouldn't have been changed as part of a
      cleanup patch.
      
      Fixes: 9879de73
      
       ("mm: page_alloc: embed OOM killing naturally into allocation slowpath")
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Acked-by: default avatarMichal Hocko <mhocko@suse.cz>
      Reported-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: Dave Chinner <david@fromorbit.com>
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: <stable@vger.kernel.org>	[3.19.x]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cc873177
    • Jon DeVree's avatar
      kernel/sys.c: fix UNAME26 for 4.0 · 39afb5ee
      Jon DeVree authored
      
      
      There's a uname workaround for broken userspace which can't handle kernel
      versions of 3.x.  Update it for 4.x.
      
      Signed-off-by: default avatarJon DeVree <nuxi@vault24.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      39afb5ee
    • Johannes Weiner's avatar
      mm: memcontrol: use "max" instead of "infinity" in control knobs · d2973697
      Johannes Weiner authored
      
      
      The memcg control knobs indicate the highest possible value using the
      symbolic name "infinity", which is long and awkward to type.
      
      Switch to the string "max", which is just as descriptive but shorter and
      sweeter.
      
      This changes a user interface, so do it before the release and before
      the development flag is dropped from the default hierarchy.
      
      Signed-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vladimir Davydov <vdavydov@parallels.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d2973697
    • Joonsoo Kim's avatar
      zram: use proper type to update max_used_pages · 2ea55a2c
      Joonsoo Kim authored
      
      
      max_used_pages is defined as atomic_long_t so we need to use unsigned
      long to keep temporary value for it rather than int which is smaller
      than unsigned long in a 64 bit system.
      
      Signed-off-by: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Jerome Marchand <jmarchan@redhat.com>
      Cc: Nitin Gupta <ngupta@vflare.org>
      Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2ea55a2c
    • Joshua Kinard's avatar
      drivers/rtc/rtc-ds1685.c: fix conditional in ds1685_rtc_sysfs_time_regs_{show,store} · b00eeaed
      Joshua Kinard authored
      Fix a conditional statement checking for NULL in both
      ds1685_rtc_sysfs_time_regs_show and ds1685_rtc_sysfs_time_regs_store
      that was using a logical AND when it should be using a logical OR so
      that we fail out of the function properly if the condition ever
      evaluates to true.
      
      Fixes: aaaf5fbf
      
       ("rtc: add driver for DS1685 family of real time clocks")
      Signed-off-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b00eeaed
    • Ryusuke Konishi's avatar
      nilfs2: fix potential memory overrun on inode · 957ed60b
      Ryusuke Konishi authored
      
      
      Each inode of nilfs2 stores a root node of a b-tree, and it turned out to
      have a memory overrun issue:
      
      Each b-tree node of nilfs2 stores a set of key-value pairs and the number
      of them (in "bn_nchildren" member of nilfs_btree_node struct), as well as
      a few other "bn_*" members.
      
      Since the value of "bn_nchildren" is used for operations on the key-values
      within the b-tree node, it can cause memory access overrun if a large
      number is incorrectly set to "bn_nchildren".
      
      For instance, nilfs_btree_node_lookup() function determines the range of
      binary search with it, and too large "bn_nchildren" leads
      nilfs_btree_node_get_key() in that function to overrun.
      
      As for intermediate b-tree nodes, this is prevented by a sanity check
      performed when each node is read from a drive, however, no sanity check
      has been done for root nodes stored in inodes.
      
      This patch fixes the issue by adding missing sanity check against b-tree
      root nodes so that it's called when on-memory inodes are read from ifile,
      inode metadata file.
      
      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>
      957ed60b
    • Jan Kiszka's avatar
      scripts/gdb: add empty package initialization script · 586a1a12
      Jan Kiszka authored
      
      
      This got lost during the initial merge process: Python requires an
      __init__.py script, even if empty, in order to accept a directory as
      package.  Add it, this time as a non-empty file.
      
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      586a1a12
    • Geert Uytterhoeven's avatar
      rtc: ds1685: remove superfluous checks for out-of-range u8 values · 39ea34cc
      Geert Uytterhoeven authored
      
      
      drivers/rtc/rtc-ds1685.c: In function `ds1685_rtc_read_alarm':
      drivers/rtc/rtc-ds1685.c:402: warning: comparison is always true due to limited range of data type
      drivers/rtc/rtc-ds1685.c:409: warning: comparison is always true due to limited range of data type
      drivers/rtc/rtc-ds1685.c:416: warning: comparison is always true due to limited range of data type
      drivers/rtc/rtc-ds1685.c: In function `ds1685_rtc_set_alarm':
      drivers/rtc/rtc-ds1685.c:475: warning: comparison is always true due to limited range of data type
      drivers/rtc/rtc-ds1685.c:478: warning: comparison is always true due to limited range of data type
      drivers/rtc/rtc-ds1685.c:481: warning: comparison is always true due to limited range of data type
      
      u8 cannot contain a value larger than 0xff, hence drop the checks.
      Wrapping the checks in unlikely() indicated some sense of humor, though ;-)
      
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      39ea34cc
    • Arnd Bergmann's avatar
      rtc: ds1685: fix ds1685_rtc_alarm_irq_enable build error · 682354d4
      Arnd Bergmann authored
      The newly added ds1685 driver causes a build error when enabled without
      CONFIG_RTC_INTF_DEV:
      
        drivers/rtc/rtc-ds1685.c:919:22: error: 'ds1685_rtc_alarm_irq_enable' undeclared here (not in a function)
          .alarm_irq_enable = ds1685_rtc_alarm_irq_enable,
      
      Apparently the driver was incorrectly changed to reflect the interface
      change from 16380c15 ("RTC: Convert rtc drivers to use the
      alarm_irq_enable method"), which removed the respective #ifdef from all
      other rtc drivers.
      
      This does the same change that was merged for the other drivers before and
      removes the #ifdef, allowing the interrupts to be enabled through the
      in-kernel rtc interface independent of the existence of /dev/rtc.
      
      Fixes: aaaf5fbf
      
       ("rtc: add driver for DS1685 family of real time clocks")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarJoshua Kinard <kumba@gentoo.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      682354d4