1. 18 Feb, 2016 4 commits
    • Dave Hansen's avatar
      x86/mm/pkeys: Add arch-specific VMA protection bits · 8f62c883
      Dave Hansen authored
      Lots of things seem to do:
      
              vma->vm_page_prot = vm_get_page_prot(flags);
      
      and the ptes get created right from things we pull out
      of ->vm_page_prot.  So it is very convenient if we can
      store the protection key in flags and vm_page_prot, just
      like the existing permission bits (_PAGE_RW/PRESENT).  It
      greatly reduces the amount of plumbing and arch-specific
      hacking we have to do in generic code.
      
      This also takes the new PROT_PKEY{0,1,2,3} flags and
      turns *those* in to VM_ flags for vma->vm_flags.
      
      The protection key values are stored in 4 places:
      	1. "prot" argument to system calls
      	2. vma->vm_flags, filled from the mmap "prot"
      	3. vma->vm_page prot, filled from vma->vm_flags
      	4. the PTE itself.
      
      The pseudocode for these for steps are as follows:
      
      	mmap(PROT_PKEY*)
      	vma->vm_flags 	  = ... | arch_calc_vm_prot_bits(mmap_prot);
      	vma->vm_page_prot = ... | arch_vm_get_page_prot(vma->vm_flags);
      	pte = pfn | vma->vm_page_prot
      
      Note that this provides a new definitions for x86:
      
      	arch_vm_get_page_prot()
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210210.FE483A42@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8f62c883
    • Dave Hansen's avatar
      mm/core, x86/mm/pkeys: Store protection bits in high VMA flags · 63c17fb8
      Dave Hansen authored
      vma->vm_flags is an 'unsigned long', so has space for 32 flags
      on 32-bit architectures.  The high 32 bits are unused on 64-bit
      platforms.  We've steered away from using the unused high VMA
      bits for things because we would have difficulty supporting it
      on 32-bit.
      
      Protection Keys are not available in 32-bit mode, so there is
      no concern about supporting this feature in 32-bit mode or on
      32-bit CPUs.
      
      This patch carves out 4 bits from the high half of
      vma->vm_flags and allows architectures to set config option
      to make them available.
      
      Sparse complains about these constants unless we explicitly
      call them "UL".
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mel Gorman <mgorman@suse.de>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Valentin Rothberg <valentinrothberg@gmail.com>
      Cc: Vladimir Davydov <vdavydov@parallels.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Xie XiuQi <xiexiuqi@huawei.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210208.81AF00D5@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      63c17fb8
    • Dave Hansen's avatar
      x86/mm/pkeys: Add new 'PF_PK' page fault error code bit · b3ecd515
      Dave Hansen authored
      Note: "PK" is how the Intel SDM refers to this bit, so we also
      use that nomenclature.
      
      This only defines the bit, it does not plumb it anywhere to be
      handled.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210207.DA7B43E6@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b3ecd515
    • Dave Hansen's avatar
      x86/mm/pkeys: Add PTE bits for storing protection key · 5c1d90f5
      Dave Hansen authored
      Previous documentation has referred to these 4 bits as "ignored".
      That means that software could have made use of them.  But, as
      far as I know, the kernel never used them.
      
      They are still ignored when protection keys is not enabled, so
      they could theoretically still get used for software purposes.
      
      We also implement "empty" versions so that code that references
      to them can be optimized away by the compiler when the config
      option is not enabled.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210205.81E33ED6@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5c1d90f5
  2. 16 Feb, 2016 10 commits
    • Dave Hansen's avatar
      x86/fpu, x86/mm/pkeys: Add PKRU xsave fields and data structures · c8df4009
      Dave Hansen authored
      The protection keys register (PKRU) is saved and restored using
      xsave.  Define the data structure that we will use to access it
      inside the xsave buffer.
      
      Note that we also have to widen the printk of the xsave feature
      masks since this is feature 0x200 and we only did two characters
      before.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210204.56DF8F7B@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c8df4009
    • Dave Hansen's avatar
      x86/cpu, x86/mm/pkeys: Define new CR4 bit · f28b49d2
      Dave Hansen authored
      There is a new bit in CR4 for enabling protection keys.  We
      will actually enable it later in the series.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210202.3CFC3DB2@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f28b49d2
    • Dave Hansen's avatar
      x86/cpufeature, x86/mm/pkeys: Add protection keys related CPUID definitions · dfb4a70f
      Dave Hansen authored
      There are two CPUID bits for protection keys.  One is for whether
      the CPU contains the feature, and the other will appear set once
      the OS enables protection keys.  Specifically:
      
      	Bit 04: OSPKE. If 1, OS has set CR4.PKE to enable
      	Protection keys (and the RDPKRU/WRPKRU instructions)
      
      This is because userspace can not see CR4 contents, but it can
      see CPUID contents.
      
      X86_FEATURE_PKU is referred to as "PKU" in the hardware documentation:
      
      	CPUID.(EAX=07H,ECX=0H):ECX.PKU [bit 3]
      
      X86_FEATURE_OSPKE is "OSPKU":
      
      	CPUID.(EAX=07H,ECX=0H):ECX.OSPKE [bit 4]
      
      These are the first CPU features which need to look at the
      ECX word in CPUID leaf 0x7, so this patch also includes
      fetching that word in to the cpuinfo->x86_capability[] array.
      
      Add it to the disabled-features mask when its config option is
      off.  Even though we are not using it here, we also extend the
      REQUIRED_MASK_BIT_SET() macro to keep it mirroring the
      DISABLED_MASK_BIT_SET() version.
      
      This means that in almost all code, you should use:
      
      	cpu_has(c, X86_FEATURE_PKU)
      
      and *not* the CONFIG option.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210201.7714C250@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      dfb4a70f
    • Dave Hansen's avatar
      x86/mm/pkeys: Add Kconfig option · 35e97790
      Dave Hansen authored
      I don't have a strong opinion on whether we need a Kconfig prompt
      or not.  Protection Keys has relatively little code associated
      with it, and it is not a heavyweight feature to keep enabled.
      However, I can imagine that folks would still appreciate being
      able to disable it.
      
      Note that, with disabled-features.h, the checks in the code
      for protection keys are always the same:
      
      	cpu_has(c, X86_FEATURE_PKU)
      
      With the config option disabled, this essentially turns into an
      
      We will hide the prompt for now.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210200.DB7055E8@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      35e97790
    • Dave Hansen's avatar
      x86/fpu: Add placeholder for 'Processor Trace' XSAVE state · 1f96b1ef
      Dave Hansen authored
      There is an XSAVE state component for Intel Processor Trace (PT).
      But, we do not currently use it.
      
      We add a placeholder in the code for it so it is not a mystery and
      also so we do not need an explicit enum initialization for Protection
      Keys in a moment.
      
      Why don't we use it?
      
      We might end up using this at _some_ point in the future.  But,
      this is a "system" state which requires using the currently
      unsupported XSAVES feature.  Unlike all the other XSAVE states,
      PT state is also not directly tied to a thread.  You might
      context-switch between threads, but not want to change any of the
      PT state.  Or, you might switch between threads, and *do* want to
      change PT state, all depending on what is being traced.
      
      We currently just manually set some MSRs to do this PT context
      switching, and it is unclear whether replacing our direct MSR use
      with XSAVE will be a net win or loss, both in code complexity and
      performance.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: fenghua.yu@intel.com
      Cc: linux-mm@kvack.org
      Cc: yu-cheng.yu@intel.com
      Link: http://lkml.kernel.org/r/20160212210158.5E4BCAE2@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1f96b1ef
    • Dave Hansen's avatar
      mm/gup: Switch all callers of get_user_pages() to not pass tsk/mm · d4edcf0d
      Dave Hansen authored
      We will soon modify the vanilla get_user_pages() so it can no
      longer be used on mm/tasks other than 'current/current->mm',
      which is by far the most common way it is called.  For now,
      we allow the old-style calls, but warn when they are used.
      (implemented in previous patch)
      
      This patch switches all callers of:
      
      	get_user_pages()
      	get_user_pages_unlocked()
      	get_user_pages_locked()
      
      to stop passing tsk/mm so they will no longer see the warnings.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: jack@suse.cz
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210156.113E9407@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d4edcf0d
    • Dave Hansen's avatar
      mm/gup: Overload get_user_pages() functions · cde70140
      Dave Hansen authored
      The concept here was a suggestion from Ingo.  The implementation
      horrors are all mine.
      
      This allows get_user_pages(), get_user_pages_unlocked(), and
      get_user_pages_locked() to be called with or without the
      leading tsk/mm arguments.  We will give a compile-time warning
      about the old style being __deprecated and we will also
      WARN_ON() if the non-remote version is used for a remote-style
      access.
      
      Doing this, folks will get nice warnings and will not break the
      build.  This should be nice for -next and will hopefully let
      developers fix up their own code instead of maintainers needing
      to do it at merge time.
      
      The way we do this is hideous.  It uses the __VA_ARGS__ macro
      functionality to call different functions based on the number
      of arguments passed to the macro.
      
      There's an additional hack to ensure that our EXPORT_SYMBOL()
      of the deprecated symbols doesn't trigger a warning.
      
      We should be able to remove this mess as soon as -rc1 hits in
      the release after this is merged.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Alexander Kuleshov <kuleshovmail@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Dominik Dingel <dingel@linux.vnet.ibm.com>
      Cc: Geliang Tang <geliangtang@163.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Leon Romanovsky <leon@leon.nu>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Mateusz Guzik <mguzik@redhat.com>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Xie XiuQi <xiexiuqi@huawei.com>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210155.73222EE1@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      cde70140
    • Dave Hansen's avatar
      mm/gup: Introduce get_user_pages_remote() · 1e987790
      Dave Hansen authored
      For protection keys, we need to understand whether protections
      should be enforced in software or not.  In general, we enforce
      protections when working on our own task, but not when on others.
      We call these "current" and "remote" operations.
      
      This patch introduces a new get_user_pages() variant:
      
              get_user_pages_remote()
      
      Which is a replacement for when get_user_pages() is called on
      non-current tsk/mm.
      
      We also introduce a new gup flag: FOLL_REMOTE which can be used
      for the "__" gup variants to get this new behavior.
      
      The uprobes is_trap_at_addr() location holds mmap_sem and
      calls get_user_pages(current->mm) on an instruction address.  This
      makes it a pretty unique gup caller.  Being an instruction access
      and also really originating from the kernel (vs. the app), I opted
      to consider this a 'remote' access where protection keys will not
      be enforced.
      
      Without protection keys, this patch should not change any behavior.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave@sr71.net>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: jack@suse.cz
      Cc: linux-mm@kvack.org
      Link: http://lkml.kernel.org/r/20160212210154.3F0E51EA@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1e987790
    • Ingo Molnar's avatar
      Merge branches 'x86/fpu', 'x86/mm' and 'x86/asm' into x86/pkeys · 1fe3f29e
      Ingo Molnar authored
      Provide a stable basis for the pkeys patches, which touches various
      x86 details.
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1fe3f29e
    • Borislav Petkov's avatar
      x86/cpufeature: Speed up cpu_feature_enabled() · f2cc8e07
      Borislav Petkov authored
      When GCC cannot do constant folding for this macro, it falls back to
      cpu_has(). But static_cpu_has() is optimal and it works at all times
      now. So use it and speedup the fallback case.
      
      Before we had this:
      
        mov    0x99d674(%rip),%rdx        # ffffffff81b0d9f4 <boot_cpu_data+0x34>
        shr    $0x2e,%rdx
        and    $0x1,%edx
        jne    ffffffff811704e9 <do_munmap+0x3f9>
      
      After alternatives patching, it turns into:
      
      		  jmp    0xffffffff81170390
      		  nopl   (%rax)
      		  ...
      		  callq  ffffffff81056e00 <mpx_notify_unmap>
      ffffffff81170390: mov    0x170(%r12),%rdi
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Joerg Roedel <joro@8bytes.org>
      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/1455578358-28347-1-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f2cc8e07
  3. 15 Feb, 2016 2 commits
    • Simon Horman's avatar
      MAINTAINERS: Update mailing list for Renesas ARM64 SoC Development · 1926e54f
      Simon Horman authored
      Update the mailing list used for development of support for ARM64
      Renesas SoCs.
      
      This is a follow-up for a similar change for other Renesas SoCs and
      drivers uses by Renesas SoCs.  The ARM64 SoC entry was not updated in
      that patch as it was not yet present in mainline.
      
      The motivation for the mailing list update is that Renesas SoCs are now
      much wider than the SH architecture and there is some desire from some
      for the linux-sh list to refocus on discussion of the work on the SH
      architecture.
      Acked-by: default avatarMagnus Damm <damm@opensource.se>
      Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarSimon Horman <horms+renesas@verge.net.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1926e54f
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 631c0e84
      Linus Torvalds authored
      Pull i915 drm fixes from Dave Airlie:
       "Jani sent a bunch of i915 display fixes as my weekend started, but
        hopefully you can fit them in"
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/i915: fix error path in intel_setup_gmbus()
        drm/i915/skl: Fix typo in DPLL_CFGCR1 definition
        drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
        drm/i915: Pretend cursor is always on for ILK-style WM calculations (v2)
        drm/i915/dp: reduce missing TPS3 support errors to debug logging
        drm/i915/dp: abstract training pattern selection
        drm/i915/dsi: skip gpio element execution when not supported
        drm/i915/dsi: don't pass arbitrary data to sideband
        drm/i915/dsi: defend gpio table against out of bounds access
        drm/i915/bxt: Don't save/restore eDP panel power during suspend (v3)
        drm/i915: Allow i915_gem_object_get_page() on userptr as well
      631c0e84
  4. 14 Feb, 2016 17 commits
    • Linus Torvalds's avatar
      Linux 4.5-rc4 · 18558cae
      Linus Torvalds authored
      18558cae
    • Dave Airlie's avatar
      Merge tag 'drm-intel-fixes-2016-02-12' of git://anongit.freedesktop.org/drm-intel into drm-fixes · bdbe58e6
      Dave Airlie authored
      i915 display fixes mostly.
      
      * tag 'drm-intel-fixes-2016-02-12' of git://anongit.freedesktop.org/drm-intel:
        drm/i915: fix error path in intel_setup_gmbus()
        drm/i915/skl: Fix typo in DPLL_CFGCR1 definition
        drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
        drm/i915: Pretend cursor is always on for ILK-style WM calculations (v2)
        drm/i915/dp: reduce missing TPS3 support errors to debug logging
        drm/i915/dp: abstract training pattern selection
        drm/i915/dsi: skip gpio element execution when not supported
        drm/i915/dsi: don't pass arbitrary data to sideband
        drm/i915/dsi: defend gpio table against out of bounds access
        drm/i915/bxt: Don't save/restore eDP panel power during suspend (v3)
        drm/i915: Allow i915_gem_object_get_page() on userptr as well
      bdbe58e6
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 58dd2b5b
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are 3 fixes for some reported issues.  Two nvmem driver fixes,
        and one mei fix.  All have been in linux-next just fine"
      
      * tag 'char-misc-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        nvmem: qfprom: Specify LE device endianness
        nvmem: core: return error for non word aligned access
        mei: validate request value in client notify request ioctl
      58dd2b5b
    • Linus Torvalds's avatar
      Merge tag 'driver-core-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core · 60f40585
      Linus Torvalds authored
      Pull driver core fix from Greg KH:
       "Here is one driver core, well klist, fix for 4.5-rc4.
      
        It fixes a problem found in the scsi device list traversal that
        probably also could be triggered by other subsystems.
      
        The fix has been in linux-next for a while with no reported problems"
      
      * tag 'driver-core-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        klist: fix starting point removed bug in klist iterators
      60f40585
    • Linus Torvalds's avatar
      Merge tag 'tty-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 779ee19d
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are a number of small tty and serial driver fixes for 4.5-rc4
        that resolve some reported issues.
      
        One of them got reverted as it wasn't correct based on testing, and
        all have been in linux-next for a while"
      
      * tag 'tty-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        Revert "8250: uniphier: allow modular build with 8250 console"
        pty: make sure super_block is still valid in final /dev/tty close
        pty: fix possible use after free of tty->driver_data
        tty: Add support for PCIe WCH382 2S multi-IO card
        serial/omap: mark wait_for_xmitr as __maybe_unused
        serial: omap: Prevent DoS using unprivileged ioctl(TIOCSRS485)
        8250: uniphier: allow modular build with 8250 console
        tty: Drop krefs for interrupted tty lock
      779ee19d
    • Linus Torvalds's avatar
      Merge tag 'usb-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 9db8cc1a
      Linus Torvalds authored
      Pull PHY fixes from Greg KH:
       "Here are a couple of PHY driver fixes for 4.5-rc4.
      
        A few small phy issues.  All have been in linux-next with no reported
        issues"
      
      * tag 'usb-4.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        phy: twl4030-usb: Fix unbalanced pm_runtime_enable on module reload
        phy: twl4030-usb: Relase usb phy on unload
        phy: core: fix wrong err handle for phy_power_on
        phy: Restrict phy-hi6220-usb to HiSilicon arm64
      9db8cc1a
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 102a92ce
      Linus Torvalds authored
      Pull perf tooling fixes from Thomas Gleixner:
       "Another round of fixes for the perf tooling side:
      
         - Prevent a NULL pointer dereference in tracepoint error handling
      
         - Fix a thread handling bug in the intel_pt error handling code
      
         - Search both .eh_frame and .debug_frame sections as toolchains seem
           to have random choices of storing the CFI information
      
         - Fix the perf state interval output values, which got broken when
           fixing the overall output"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf stat: Fix interval output values
        perf probe: Search both .eh_frame and .debug_frame sections for probe location
        perf tools: Fix thread lifetime related segfaut in intel_pt
        perf tools: tracepoint_error() can receive e=NULL, robustify it
      102a92ce
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · cb490d63
      Linus Torvalds authored
      Pull lockdep fix from Thomas Gleixner:
       "A single fix for the stack trace caching logic in lockdep, where the
        duplicate avoidance managed to store no back trace at all"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/lockdep: Fix stack trace caching logic
      cb490d63
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 6a810945
      Linus Torvalds authored
      Pull timer fix from Thomas Gleixner:
       "A single fix preventing a 32bit overflow in timespec/val to cputime
        conversions on 32bit machines"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
      6a810945
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8ab54ed6
      Linus Torvalds authored
      Pull irqchip fixes from Thomas Gleixner:
       "Another set of ARM SoC related irqchip fixes:
         - Plug a memory leak in gicv3-its
         - Limit features to the root gic interrupt controller
         - Add a missing barrier in the gic-v3 IAR access
         - Another compile test fix for sun4i"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Make sure read from ICC_IAR1_EL1 is visible on redestributor
        irqchip/gic: Only set the EOImodeNS bit for the root controller
        irqchip/gic: Only populate set_affinity for the root controller
        irqchip/gicv3-its: Fix memory leak in its_free_tables()
        irqchip/sun4i: Fix compilation outside of arch/arm
      8ab54ed6
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2d23e61f
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Two small fixlets for x86:
      
         - Prevent a KASAN false positive in thread_saved_pc()
      
         - Fix a 32-bit truncation problem in the x86 numa code"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm/numa: Fix 32-bit memblock range truncation bug on 32-bit NUMA kernels
        x86: Fix KASAN false positives in thread_saved_pc()
      2d23e61f
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · ab57a611
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
       "Here's the first round of MIPS fixes after the merge window:
      
         - Detect Octeon III's PCI correctly.
         - Fix return value of the MT7620 probing function.
         - Wire up the copy_file_range syscall.
         - Fix 64k page support on 32 bit kernels.
         - Fix the early Coherency Manager probe.
         - Allow only hardware-supported page sizes to be selected for R6000.
         - Fix corner cases for the RDHWR nstruction emulation on old hardware.
         - Fix FPU handling corner cases.
         - Remove stale entry for BCM33xx from the MAINTAINERS file.
         - 32 and 64 bit ELF headers are different, handle them correctly"
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        mips: Differentiate between 32 and 64 bit ELF header
        MIPS: Octeon: Update OCTEON_FEATURE_PCIE for Octeon III
        MIPS: pci-mt7620: Fix return value check in mt7620_pci_probe()
        MIPS: Fix early CM probing
        MIPS: Wire up copy_file_range syscall.
        MIPS: Fix 64k page support for 32 bit kernels.
        MIPS: R6000: Don't allow 64k pages for R6000.
        MIPS: traps.c: Correct microMIPS RDHWR emulation
        MIPS: traps.c: Don't emulate RDHWR in the CpU #0 exception handler
        MAINTAINERS: Remove stale entry for BCM33xx chips
        MIPS: Fix FPU disable with preemption
        MIPS: Properly disable FPU in start_thread()
        MIPS: Fix buffer overflow in syscall_get_arguments()
      ab57a611
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm · be3f4e0f
      Linus Torvalds authored
      Pull ARM fixes from Russell King:
       "A couple of ARM fixes from Linus for the ICST clock generator code"
      
      [ "Linus" here is Linus Walleij.  Name-stealer.
      
             Linus "there can be only one" Torvalds ]
      
      * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
        ARM: 8519/1: ICST: try other dividends than 1
        ARM: 8517/1: ICST: avoid arithmetic overflow in icst_hz()
      be3f4e0f
    • Linus Torvalds's avatar
      Merge branch 'component' of git://ftp.arm.linux.org.uk/~rmk/linux-arm · 8b9f9ebe
      Linus Torvalds authored
      Pull component helper fixes from Russell King:
       "A few fixes for problems people have encountered with the recent
        update to the component helpers"
      
      * 'component' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
        component: remove device from master match list on failed add
        component: Detach components when deleting master struct
        component: fix crash on x86_64 with hda audio drivers
      8b9f9ebe
    • Borislav Petkov's avatar
      x86/mm: Fix INVPCID asm constraint · e2c7698c
      Borislav Petkov authored
      So we want to specify the dependency on both @pcid and @addr so that the
      compiler doesn't reorder accesses to them *before* the TLB flush. But
      for that to work, we need to express this properly in the inline asm and
      deref the whole desc array, not the pointer to it. See clwb() for an
      example.
      
      This fixes the build error on 32-bit:
      
        arch/x86/include/asm/tlbflush.h: In function ‘__invpcid’:
        arch/x86/include/asm/tlbflush.h:26:18: error: memory input 0 is not directly addressable
      
      which gcc4.7 caught but 5.x didn't. Which is strange. :-\
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luis R. Rodriguez <mcgrof@suse.com>
      Cc: Michael Matz <matz@suse.de>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Toshi Kani <toshi.kani@hp.com>
      Cc: linux-mm@kvack.org
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e2c7698c
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma · 7686e3c1
      Linus Torvalds authored
      Pull more rdma fixes from Doug Ledford:
       "I think we are getting pretty close to done now.  There are four
        one-off fixes in this update:
      
         - fix ipoib multicast joins
         - fix mlx4 error handling
         - fix mlx5 size computation
         - fix a thinko in core code"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
        IB/mlx5: Fix RC transport send queue overhead computation
        IB/ipoib: fix for rare multicast join race condition
        IB/core: Fix reading capability mask of the port info class
        net/mlx4: fix some error handling in mlx4_multi_func_init()
      7686e3c1
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · 2f2e9f2d
      Linus Torvalds authored
      Pull SCSI target fixes from Nicholas Bellinger:
       "This includes the long awaited series to address a set of bugs around
        active I/O remote-port LUN_RESET, as well as properly handling this
        same case with concurrent fabric driver session disconnect ->
        reconnect.
      
        Note this set of LUN_RESET bug-fixes has been surviving extended
        testing on both v4.5-rc1 and v3.14.y code over the last weeks, and is
        CC'ed for stable as it's something folks using multiple ESX connected
        hosts with slow backends can certainly trigger.
      
        The highlights also include:
      
         - Fix WRITE_SAME/DISCARD emulation 4k sector conversion in
           target/iblock (Mike Christie)
      
         - Fix TMR abort interaction and AIO type TMR response in qla2xxx
           target (Quinn Tran + Swapnil Nagle)
      
         - Fix >= v3.17 stale descriptor pointer regression in qla2xxx target
           (Quinn Tran)
      
         - Fix >= v4.5-rc1 return regression with unmap_zeros_data_store new
           configfs store handler (nab)
      
         - Add CPU affinity flag + convert qla2xxx to use bit (Quinn + HCH +
           Bart)"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending:
        qla2xxx: use TARGET_SCF_USE_CPUID flag to indiate CPU Affinity
        target/transport: add flag to indicate CPU Affinity is observed
        target: Fix incorrect unmap_zeroes_data_store return
        qla2xxx: Use ATIO type to send correct tmr response
        qla2xxx: Fix stale pointer access.
        target/user: Fix cast from pointer to phys_addr_t
        target: Drop legacy se_cmd->task_stop_comp + REQUEST_STOP usage
        target: Fix race with SCF_SEND_DELAYED_TAS handling
        target: Fix remote-port TMR ABORT + se_cmd fabric stop
        target: Fix TAS handling for multi-session se_node_acls
        target: Fix LUN_RESET active TMR descriptor handling
        target: Fix LUN_RESET active I/O handling for ACK_KREF
        qla2xxx: Fix TMR ABORT interaction issue between qla2xxx and TCM
        qla2xxx: Fix warning reported by static checker
        target: Fix WRITE_SAME/DISCARD conversion to linux 512b sectors
      2f2e9f2d
  5. 13 Feb, 2016 4 commits
  6. 12 Feb, 2016 3 commits
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.5-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · 0cbb0b92
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
       "These are some Renesas binding updates for PCI host controllers, a
        Broadcom fix for a regression we added in v4.5-rc1, and a fix for an
        AER use-after-free problem that can cause memory corruption.
      
        Summary:
      
        AER:
          Flush workqueue on device remove to avoid use-after-free (Sebastian Andrzej Siewior)
      
        Broadcom iProc host bridge driver:
          Allow multiple devices except on PAXC (Ray Jui)
      
        Renesas R-Car host bridge driver:
          Add gen2 device tree support for r8a7793 (Simon Horman)
          Add device tree support for r8a7793 (Simon Horman)"
      
      * tag 'pci-v4.5-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: rcar: Add device tree support for r8a7793
        PCI: rcar: Add gen2 device tree support for r8a7793
        PCI: iproc: Allow multiple devices except on PAXC
        PCI/AER: Flush workqueue on device remove to avoid use-after-free
      0cbb0b92
    • Linus Torvalds's avatar
      Merge branch 'akpm'(patches from Andrew) · 29f1bf34
      Linus Torvalds authored
      Merge fixes from Andrew Morton:
       "10 fixes"
      
      The lockdep hlist conversion is in the locking tree too, waiting for the
      next merge window.  Andrew thought it should go in now.  I'll take it,
      since it fixes a real problem and looks trivially correct (famous last
      words).
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        arch/x86/Kconfig: CONFIG_X86_UV should depend on CONFIG_EFI
        mm: fix pfn_t vs highmem
        kernel/locking/lockdep.c: convert hash tables to hlists
        mm,thp: fix spellos in describing __HAVE_ARCH_FLUSH_PMD_TLB_RANGE
        mm,thp: khugepaged: call pte flush at the time of collapse
        mm/backing-dev.c: fix error path in wb_init()
        mm, dax: check for pmd_none() after split_huge_pmd()
        vsprintf: kptr_restrict is okay in IRQ when 2
        mm: fix filemap.c kernel doc warning
        ubsan: cosmetic fix to Kconfig text
      29f1bf34
    • Leon Romanovsky's avatar
      IB/mlx5: Fix RC transport send queue overhead computation · 75c1657e
      Leon Romanovsky authored
      Fix the RC QPs send queue overhead computation to take into account
      two additional segments in the WQE which are needed for registration
      operations.
      
      The ATOMIC and UMR segments can't coexist together, so chose maximum out
      of them.
      
      The commit 9e65dc37 ("IB/mlx5: Fix RC transport send queue overhead
      computation") was intended to update RC transport as commit messages
      states, but added the code to UC transport.
      
      Fixes: 9e65dc37 ("IB/mlx5: Fix RC transport send queue overhead computation")
      Signed-off-by: default avatarKamal Heib <kamalh@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      75c1657e