1. 20 Sep, 2015 3 commits
  2. 15 Sep, 2015 1 commit
  3. 14 Sep, 2015 15 commits
    • Dave Hansen's avatar
      x86/fpu: Check CPU-provided sizes against struct declarations · ef78f2a4
      Dave Hansen authored
      We now have C structures defined for each of the XSAVE state
      components that we support.  This patch adds checks during our
      verification pass to ensure that the CPU-provided data
      enumerated in CPUID leaves matches our C structures.
      
      If not, we warn and dump all the XSAVE CPUID leaves.
      
      Note: this *actually* found an inconsistency with the MPX
      'bndcsr' state.  The hardware pads it out differently from
      our C structures.  This patch caught it and warned.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233131.A8DB36DA@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ef78f2a4
    • Dave Hansen's avatar
      x86/fpu: Check to ensure increasing-offset xstate offsets · e6e888f9
      Dave Hansen authored
      The xstate CPUID leaves enumerate where each state component is
      inside the XSAVE buffer, along with the size of the entire
      buffer.  Our new XSAVE sanity-checking code extrapolates an
      expected _total_ buffer size by looking at the last component
      that it encounters.
      
      That method requires that the highest-numbered component also
      be the one with the highest offset.  This is a pretty safe
      assumption, but let's add some code to ensure it stays true.
      
      To make this check work correctly, we also need to ensure we
      only consider the offsets from enabled features because the
      offset register (ebx) will return 0 on unsupported features.
      
      This also means that we will preserve the -1's that we
      initialized xstate_offsets/sizes[] with.  That will help
      find bugs.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233130.0843AB15@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e6e888f9
    • Dave Hansen's avatar
      x86/fpu: Correct and check XSAVE xstate size calculations · 65ac2e9b
      Dave Hansen authored
      Note: our xsaves support is currently broken and disabled.  This
      patch does not fix it, but it is an incremental improvement.
      
      This might be useful to someone backporting the entire set of
      XSAVES patches at some point, but it should not be backported
      alone.
      
      Ingo said he wanted something like this (bullets 2 and 3):
      
        http://lkml.kernel.org/r/20150808091508.GB32641@gmail.com
      
      There are currently two xsave buffer formats: standard and
      compacted.  The standard format is waht 'XSAVE' and 'XSAVEOPT'
      produce while 'XSAVES' and 'XSAVEC' produce a compacted-formet
      buffer.  (The kernel never uses XSAVEC)
      
      But, the XSAVES buffer *ALSO* contains "system state components"
      which are never saved by a plain XSAVE.  So, XSAVES has two
      things that might make its buffer differently-sized from an
      XSAVE-produced one.
      
      The current code assumes that an XSAVES buffer's size is simply
      the sum of the sizes of the (user) states which are supported.
      This seems to work in most cases, but it is not consistent with
      what the SDM says, and it breaks if we 'align' a component in
      the buffer.  The calculation is also unnecessary work since the
      CPU *tells* us the size of the buffer directly.
      
      This patch just reads the size of the buffer right out of the
      CPUID leaf instead of trying to derive it.
      
      But, blindly trusting the CPU like this is dangerous.  We add
      a verification pass in do_extra_xstate_size_checks() to ensure
      that the size we calculate matches with what we see from the
      hardware.  When it comes down to it, we trust but verify the
      CPU.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233130.234FE1EC@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      65ac2e9b
    • Dave Hansen's avatar
      x86/fpu: Add C structures for AVX-512 state components · 060dd0f7
      Dave Hansen authored
      AVX-512 has 3 separate state components:
      
        1. opmask registers
        2. zmm upper half of registers 0-15
        3. new zmm registers (16-31)
      
      This patch adds C structures for the three components along with
      a few comments mostly lifted from the SDM to explain what they
      do.  This will allow us to check our structures against what the
      hardware tells us about the sizes of the components.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233129.F2433B98@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      060dd0f7
    • Dave Hansen's avatar
      x86/fpu: Rework YMM definition · 83aa3c45
      Dave Hansen authored
      We are about to rework all of the "extended state" definitions.
      This makes the 'ymm' naming consistent with the AVX-512 types
      we will introduce later.
      
      We also add a convenience type: "reg_128_bit" so that we do
      not have to spell out our arithmetic.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233129.B4EB045F@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      83aa3c45
    • Dave Hansen's avatar
      x86/fpu/mpx: Rework MPX 'xstate' types · 1126cb45
      Dave Hansen authored
      MPX includes two separate "extended state components".  There is
      no real need to have an 'mpx_struct' because we never really
      manage the states together.
      
      We also separate out the actual data in 'mpx_bndcsr_state' from
      the padding.  We will shortly be checking the state sizes
      against our structures and need them to match.  For consistency,
      we also ensure to prefix these types with 'mpx_'.
      
      Lastly, we add some comments to mirror some of the descriptions
      in the Intel documents (SDM) of the various state components.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233129.384B73EB@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1126cb45
    • Dave Hansen's avatar
      x86/fpu: Add xfeature_enabled() helper instead of test_bit() · 633d54c4
      Dave Hansen authored
      We currently use test_bit() in a few places to see if an
      xfeature is enabled.  It ends up being a bit ugly because
      'xfeatures_mask' is a u64 and test_bit wants an 'unsigned long'
      so it requires a cast.  The *_bit() functions are also
      techincally atomic, which we have no need for here.
      
      So, remove the test_bit()s and replace with the new
      xfeature_enabled() helper.
      
      This also provides a central place to add a comment about the
      future need to support 'system xstates'.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233129.B1534F86@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      633d54c4
    • Dave Hansen's avatar
      x86/fpu: Remove 'xfeature_nr' · ee9ae257
      Dave Hansen authored
      xfeature_nr ended up being initialized too late for me to
      use it in the "xsave size sanity check" patch which is
      later in the series.  I tried to move around its initialization
      but realized that it was just as easy to get rid of it.
      
      We only have 9 XFEATURES.  Instead of dynamically calculating
      and storing the last feature, just use the compile-time max:
      XFEATURES_NR_MAX.  Note that even with 'xfeatures_nr' we can
      had "holes" in the xfeatures_mask that we had to deal with.
      
      We also change a 'leaf' variable to be a plain 'i'.  Although
      it is used to grab a cpuid leaf in this one loop, all of the
      other loops just use an 'i' and I find it much more obvious
      to keep the naming consistent across all the similar loops.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233128.3F30DF5A@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ee9ae257
    • Dave Hansen's avatar
      x86/fpu: Rework XSTATE_* macros to remove magic '2' · 8a93c9e0
      Dave Hansen authored
      The 'xstate.c' code has a bunch of references to '2'.  This
      is because we have a lot more work to do for the "extended"
      xstates than the "legacy" ones and state component 2 is the
      first "extended" state.
      
      This patch replaces all of the instances of '2' with
      FIRST_EXTENDED_XFEATURE, which clearly explains what is
      going on.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233128.A8C0BF51@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8a93c9e0
    • Dave Hansen's avatar
      x86/fpu: Rename XFEATURES_NR_MAX · dad8c4fe
      Dave Hansen authored
      This is a logcal followon to the last patch.  It makes the
      XFEATURE_MAX naming consistent with the other enum values.
      This is what Ingo suggested.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233127.A541448F@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      dad8c4fe
    • Dave Hansen's avatar
      x86/fpu: Rename XSAVE macros · d91cab78
      Dave Hansen authored
      There are two concepts that have some confusing naming:
       1. Extended State Component numbers (currently called
          XFEATURE_BIT_*)
       2. Extended State Component masks (currently called XSTATE_*)
      
      The numbers are (currently) from 0-9.  State component 3 is the
      bounds registers for MPX, for instance.
      
      But when we want to enable "state component 3", we go set a bit
      in XCR0.  The bit we set is 1<<3.  We can check to see if a
      state component feature is enabled by looking at its bit.
      
      The current 'xfeature_bit's are at best xfeature bit _numbers_.
      Calling them bits is at best inconsistent with ending the enum
      list with 'XFEATURES_NR_MAX'.
      
      This patch renames the enum to be 'xfeature'.  These also
      happen to be what the Intel documentation calls a "state
      component".
      
      We also want to differentiate these from the "XSTATE_*" macros.
      The "XSTATE_*" macros are a mask, and we rename them to match.
      
      These macros are reasonably widely used so this patch is a
      wee bit big, but this really is just a rename.
      
      The only non-mechanical part of this is the
      
      	s/XSTATE_EXTEND_MASK/XFEATURE_MASK_EXTEND/
      
      We need a better name for it, but that's another patch.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233126.38653250@viggo.jf.intel.com
      [ Ported to v4.3-rc1. ]
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      d91cab78
    • Dave Hansen's avatar
      x86/fpu: Remove partial LWP support definitions · 75933433
      Dave Hansen authored
      LightWeight Profiling was evidently an AMD profiling feature
      that we never got around to implementing.  Remove the references
      to it.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233125.7E602284@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      75933433
    • Dave Hansen's avatar
      x86/fpu: Remove XSTATE_RESERVE · 4109ca06
      Dave Hansen authored
      The original purpose of XSTATE_RESERVE was to carve out space
      to store all of the possible extended state components that
      get saved with the XSAVE instruction(s).
      
      However, we are now almost entirely dynamically allocating
      the buffers we use for XSAVE by placing them at the end of
      the task_struct and them sizing them at boot.  The one
      exception for that is the init_task.
      
      The maximum extended state component size that we have today
      is on systems with space for AVX-512 and Memory Protection
      Keys: 2696 bytes.  We have reserved a PAGE_SIZE buffer in
      the init_task via fpregs_state->__padding.
      
      This check ensures that even if the component sizes or
      layout were changed (which we do not expect), that we will
      still not overflow the init_task's buffer.
      
      In the case that we detect we might overflow the buffer,
      we completely disable XSAVE support in the kernel and try
      to boot as if we had 'legacy x87 FPU' support in place.
      This is a crippled state without any of the XSAVE-enabled
      features (MPX, AVX, etc...).  But, it at least let us
      boot safely.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233125.D948D475@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      4109ca06
    • Dave Hansen's avatar
      x86/fpu: Move XSAVE-disabling code to a helper · 0a265375
      Dave Hansen authored
      When we want to _completely_ disable XSAVE support as far as
      the kernel is concerned, we have a big set of feature flags
      to clear.  We currently only do this in cases where the user
      asks for it to be disabled, but we are about to expand the
      places where we do it to handle errors too.
      
      Move the code in to xstate.c, and put it in the xstate.h
      header.  We will use it in the next patch too.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233124.EA9A70E5@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      0a265375
    • Dave Hansen's avatar
      x86/fpu: Print xfeature buffer size in decimal · b0815359
      Dave Hansen authored
      This is utterly a personal taste thing, but I find it way easier
      to read structure sizes in decimal than in hex.
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      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: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tim Chen <tim.c.chen@linux.intel.com>
      Cc: dave@sr71.net
      Cc: linux-kernel@vger.kernel.org
      Link: http://lkml.kernel.org/r/20150902233124.1A8B04A8@viggo.jf.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b0815359
  4. 12 Sep, 2015 13 commits
    • Linus Torvalds's avatar
      Linux 4.3-rc1 · 6ff33f39
      Linus Torvalds authored
      6ff33f39
    • Linus Torvalds's avatar
      Merge tag 'cris-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris · 6917b51d
      Linus Torvalds authored
      Pull CRIS updates from Jesper Nilsson:
       "Mostly removal of old cruft of which we can use a generic version, or
        fixes for code not commonly run in the cris port, but also additions
        to enable some good debug"
      
      * tag 'cris-for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris: (25 commits)
        CRISv10: delete unused lib/dmacopy.c
        CRISv10: delete unused lib/old_checksum.c
        CRIS: fix switch_mm() lockdep splat
        CRISv32: enable LOCKDEP_SUPPORT
        CRIS: add STACKTRACE_SUPPORT
        CRISv32: annotate irq enable in idle loop
        CRISv32: add support for irqflags tracing
        CRIS: UAPI: use generic types.h
        CRIS: UAPI: use generic shmbuf.h
        CRIS: UAPI: use generic msgbuf.h
        CRIS: UAPI: use generic socket.h
        CRIS: UAPI: use generic sembuf.h
        CRIS: UAPI: use generic sockios.h
        CRIS: UAPI: use generic auxvec.h
        CRIS: UAPI: use generic headers via Kbuild
        CRIS: UAPI: fix elf.h export
        CRIS: don't make asm/elf.h depend on asm/user.h
        CRIS: UAPI: fix ptrace.h
        CRISv32: Squash compile warnings for axisflashmap
        CRISv32: Add GPIO driver to the default configs
        ...
      6917b51d
    • Linus Torvalds's avatar
      blk: rq_data_dir() should not return a boolean · 10fbd36e
      Linus Torvalds authored
      rq_data_dir() returns either READ or WRITE (0 == READ, 1 == WRITE), not
      a boolean value.
      
      Now, admittedly the "!= 0" doesn't really change the value (0 stays as
      zero, 1 stays as one), but it's not only redundant, it confuses gcc, and
      causes gcc to warn about the construct
      
          switch (rq_data_dir(req)) {
              case READ:
                  ...
              case WRITE:
                  ...
      
      that we have in a few drivers.
      
      Now, the gcc warning is silly and stupid (it seems to warn not about the
      switch value having a different type from the case statements, but about
      _any_ boolean switch value), but in this case the code itself is silly
      and stupid too, so let's just change it, and get rid of warnings like
      this:
      
        drivers/block/hd.c: In function ‘hd_request’:
        drivers/block/hd.c:630:11: warning: switch condition has boolean value [-Wswitch-bool]
           switch (rq_data_dir(req)) {
      
      The odd '!= 0' came in when "cmd_flags" got turned into a "u64" in
      commit 5953316d ("block: make rq->cmd_flags be 64-bit") and is
      presumably because the old code (that just did a logical 'and' with 1)
      would then end up making the type of rq_data_dir() be u64 too.
      
      But if we want to retain the old regular integer type, let's just cast
      the result to 'int' rather than use that rather odd '!= 0'.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      10fbd36e
    • Linus Torvalds's avatar
      Merge branch 'writeback-plugging' · e1df8b0a
      Linus Torvalds authored
      Fix up the writeback plugging introduced in commit d353d758
      ("writeback: plug writeback at a high level") that then caused problems
      due to the unplug happening with a spinlock held.
      
      * writeback-plugging:
        writeback: plug writeback in wb_writeback() and writeback_inodes_wb()
        Revert "writeback: plug writeback at a high level"
      e1df8b0a
    • Linus Torvalds's avatar
      writeback: plug writeback in wb_writeback() and writeback_inodes_wb() · 505a666e
      Linus Torvalds authored
      We had to revert the pluggin in writeback_sb_inodes() because the
      wb->list_lock is held, but we could easily plug at a higher level before
      taking that lock, and unplug after releasing it.  This does that.
      
      Chris will run performance numbers, just to verify that this approach is
      comparable to the alternative (we could just drop and re-take the lock
      around the blk_finish_plug() rather than these two commits.
      
      I'd have preferred waiting for actual performance numbers before picking
      one approach over the other, but I don't want to release rc1 with the
      known "sleeping function called from invalid context" issue, so I'll
      pick this cleanup version for now.  But if the numbers show that we
      really want to plug just at the writeback_sb_inodes() level, and we
      should just play ugly games with the spinlock, we'll switch to that.
      
      Cc: Chris Mason <clm@fb.com>
      Cc: Josef Bacik <jbacik@fb.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Neil Brown <neilb@suse.de>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      505a666e
    • Linus Torvalds's avatar
      thermal: fix intel PCH thermal driver mismerge · dfb22fc5
      Linus Torvalds authored
      I didn't notice this when merging the thermal code from Zhang, but his
      merge (commit 5a924a07: "Merge branches 'thermal-core' and
      'thermal-intel' of .git into next") of the thermal-core and
      thermal-intel branches was wrong.
      
      In thermal-core, commit 17e8351a ("thermal: consistently use int for
      temperatures") converted the thermal layer to use "int" for
      temperatures.
      
      But in parallel, in the thermal-intel branch commit d0a12625
      ("thermal: Add Intel PCH thermal driver") added support for the intel
      PCH thermal sensor using the old interfaces that used "unsigned long"
      pointers.
      
      This resulted in warnings like this:
      
        drivers/thermal/intel_pch_thermal.c:184:14: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
          .get_temp = pch_thermal_get_temp,
                      ^
        drivers/thermal/intel_pch_thermal.c:184:14: note: (near initialization for ‘tzd_ops.get_temp’)
        drivers/thermal/intel_pch_thermal.c:186:19: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
          .get_trip_temp = pch_get_trip_temp,
                           ^
        drivers/thermal/intel_pch_thermal.c:186:19: note: (near initialization for ‘tzd_ops.get_trip_temp’)
      
      This fixes it.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dfb22fc5
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 01b0c014
      Linus Torvalds authored
      Merge fourth patch-bomb from Andrew Morton:
      
       - sys_membarier syscall
      
       - seq_file interface changes
      
       - a few misc fixups
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        revert "ocfs2/dlm: use list_for_each_entry instead of list_for_each"
        mm/early_ioremap: add explicit #include of asm/early_ioremap.h
        fs/seq_file: convert int seq_vprint/seq_printf/etc... returns to void
        selftests: enhance membarrier syscall test
        selftests: add membarrier syscall test
        sys_membarrier(): system-wide memory barrier (generic, x86)
        MODSIGN: fix a compilation warning in extract-cert
      01b0c014
    • Vineet Gupta's avatar
      ARCv2: [axs103_smp] Reduce clk for SMP FPGA configs · 3ebb0540
      Vineet Gupta authored
      Newer bitfiles needs the reduced clk even for SMP builds
      
      Cc: <stable@vger.kernel.org>  #4.2
      Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3ebb0540
    • Linus Torvalds's avatar
      Merge tag 'ntb-4.3' of git://github.com/jonmason/ntb · ded0e250
      Linus Torvalds authored
      Pull NTB fixes from Jon Mason:
       "NTB bug and documentation fixes, new device IDs, performance
        improvements, and adding a mailing list to MAINTAINERS for NTB"
      
      * tag 'ntb-4.3' of git://github.com/jonmason/ntb:
        NTB: Fix range check on memory window index
        NTB: Improve index handling in B2B MW workaround
        NTB: Fix documentation for ntb_peer_db_clear.
        NTB: Fix documentation for ntb_link_is_up
        NTB: Use unique DMA channels for TX and RX
        NTB: Remove dma_sync_wait from ntb_async_rx
        NTB: Clean up QP stats info
        NTB: Make the transport list in order of discovery
        NTB: Add PCI Device IDs for Broadwell Xeon
        NTB: Add flow control to the ntb_netdev
        NTB: Add list to MAINTAINERS
      ded0e250
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · f0c032d8
      Linus Torvalds authored
      Pull more input updates from Dmitry Torokhov:
       "Second round of updates for the input subsystem.
      
        This introduces two brand new touchscreen drivers (Colibri and
        imx6ul_tsc), some small driver fixes, and we are no longer report
        errors from evdev_flush() as users do not really have a way of
        handling errors, error codes that we were returning were not on the
        list of errors supposed to be returned by close(), and errors were
        causing issues with one of older versions of systemd"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: imx_keypad - remove obsolete comment
        Input: touchscreen - add imx6ul_tsc driver support
        Input: Add touchscreen support for Colibri VF50
        Input: i8042 - lower log level for "no controller" message
        Input: evdev - do not report errors form flush()
        Input: elants_i2c - extend the calibration timeout to 12 seconds
        Input: sparcspkr - fix module autoload for OF platform drivers
        Input: regulator-haptic - fix module autoload for OF platform driver
        Input: pwm-beeper - fix module autoload for OF platform driver
        Input: ab8500-ponkey - Fix module autoload for OF platform driver
        Input: cyttsp - remove unnecessary MODULE_ALIAS()
        Input: elan_i2c - add ACPI ID "ELAN1000"
      f0c032d8
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · fa9a67ef
      Linus Torvalds authored
      Pull more power management and ACPI updates from Rafael Wysocki:
       "These are mostly fixes and cleanups on top of the previous PM+ACPI
        pull request (cpufreq core and drivers, cpuidle, generic power domains
        framework).  Some of them didn't make to that pull request and some
        fix issues introduced by it.
      
        The only really new thing is the support for suspend frequency in the
        cpufreq-dt driver, but it is needed to fix an issue with Exynos
        platforms.
      
        Specifics:
      
         - build fix for the new Mediatek MT8173 cpufreq driver (Guenter
           Roeck).
      
         - generic power domains framework fixes (power on error code path,
           subdomain removal) and cleanup of a deprecated API user (Geert
           Uytterhoeven, Jon Hunter, Ulf Hansson).
      
         - cpufreq-dt driver fixes including two fixes for bugs related to the
           new Operating Performance Points Device Tree bindings introduced
           recently (Viresh Kumar).
      
         - suspend frequency support for the cpufreq-dt driver (Bartlomiej
           Zolnierkiewicz, Viresh Kumar).
      
         - cpufreq core cleanups (Viresh Kumar).
      
         - intel_pstate driver fixes (Chen Yu, Kristen Carlson Accardi).
      
         - additional sanity check in the cpuidle core (Xunlei Pang).
      
         - fix for a comment related to CPU power management (Lina Iyer)"
      
      * tag 'pm+acpi-4.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        intel_pstate: fix PCT_TO_HWP macro
        intel_pstate: Fix user input of min/max to legal policy region
        PM / OPP: Return suspend_opp only if it is enabled
        cpufreq-dt: add suspend frequency support
        cpufreq: allow cpufreq_generic_suspend() to work without suspend frequency
        PM / OPP: add dev_pm_opp_get_suspend_opp() helper
        staging: board: Migrate away from __pm_genpd_name_add_device()
        cpufreq: Use __func__ to print function's name
        cpufreq: staticize cpufreq_cpu_get_raw()
        PM / Domains: Ensure subdomain is not in use before removing
        cpufreq: Add ARM_MT8173_CPUFREQ dependency on THERMAL
        cpuidle/coupled: Add sanity check for safe_state_index
        PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
        cpufreq: dt: Tolerance applies on both sides of target voltage
        cpufreq: dt: Print error on failing to mark OPPs as shared
        cpufreq: dt: Check OPP count before marking them shared
        kernel/cpu_pm: fix cpu_cluster_pm_exit comment
      fa9a67ef
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · 05c78081
      Linus Torvalds authored
      Pull SCSI target updates from Nicholas Bellinger:
       "Here are the outstanding target-pending updates for v4.3-rc1.
      
        Mostly bug-fixes and minor changes this round.  The fallout from the
        big v4.2-rc1 RCU conversion have (thus far) been minimal.
      
        The highlights this round include:
      
         - Move sense handling routines into scsi_common code (Sagi)
      
         - Return ABORTED_COMMAND sense key for PI errors (Sagi)
      
         - Add tpg_enabled_sendtargets attribute for disabled iscsi-target
           discovery (David)
      
         - Shrink target struct se_cmd by rearranging fields (Roland)
      
         - Drop iSCSI use of mutex around max_cmd_sn increment (Roland)
      
         - Replace iSCSI __kernel_sockaddr_storage with sockaddr_storage (Andy +
           Chris)
      
         - Honor fabric max_data_sg_nents I/O transfer limit (Arun + Himanshu +
           nab)
      
         - Fix EXTENDED_COPY >= v4.1 regression OOPsen (Alex + nab)"
      
      * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (37 commits)
        target: use stringify.h instead of own definition
        target/user: Fix UFLAG_UNKNOWN_OP handling
        target: Remove no-op conditional
        target/user: Remove unused variable
        target: Fix max_cmd_sn increment w/o cmdsn mutex regressions
        target: Attach EXTENDED_COPY local I/O descriptors to xcopy_pt_sess
        target/qla2xxx: Honor max_data_sg_nents I/O transfer limit
        target/iscsi: Replace __kernel_sockaddr_storage with sockaddr_storage
        target/iscsi: Replace conn->login_ip with login_sockaddr
        target/iscsi: Keep local_ip as the actual sockaddr
        target/iscsi: Fix np_ip bracket issue by removing np_ip
        target: Drop iSCSI use of mutex around max_cmd_sn increment
        qla2xxx: Update tcm_qla2xxx module description to 24xx+
        iscsi-target: Add tpg_enabled_sendtargets for disabled discovery
        drivers: target: Drop unlikely before IS_ERR(_OR_NULL)
        target: check DPO/FUA usage for COMPARE AND WRITE
        target: Shrink struct se_cmd by rearranging fields
        target: Remove cmd->se_ordered_id (unused except debug log lines)
        target: add support for START_STOP_UNIT SCSI opcode
        target: improve unsupported opcode message
        ...
      05c78081
    • Linus Torvalds's avatar
      Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 8e78b7dc
      Linus Torvalds authored
      Pull second round of SCSI updates from James Bottomley:
       "There's one late arriving patch here (added today), fixing a build
        issue which the scsi_dh patch set in here uncovered.  Other than that,
        everything has been incubated in -next and the checkers for a week.
      
        The major pieces of this patch are a set patches facilitating better
        integration between scsi and scsi_dh (the device handling layer used
        by multi-path; all the dm parts are acked by Mike Snitzer).
      
        This also includes driver updates for mp3sas, scsi_debug and an
        assortment of bug fixes"
      
      * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (50 commits)
        scsi_dh: fix randconfig build error
        scsi: fix scsi_error_handler vs. scsi_host_dev_release race
        fcoe: Convert use of __constant_htons to htons
        mpt2sas: setpci reset kernel oops fix
        pm80xx: Don't override ts->stat on IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY
        lpfc: Fix possible use-after-free and double free in lpfc_mbx_cmpl_rdp_page_a2()
        bfa: Fix incorrect de-reference of pointer
        bfa: Fix indentation
        scsi_transport_sas: Remove check for SAS expander when querying bay/enclosure IDs.
        scsi_debug: resp_request: remove unused variable
        scsi_debug: fix REPORT LUNS Well Known LU
        scsi_debug: schedule_resp fix input variable check
        scsi_debug: make dump_sector static
        scsi_debug: vfree is null safe so drop the check
        scsi_debug: use SCSI_W_LUN_REPORT_LUNS instead of SAM2_WLUN_REPORT_LUNS;
        scsi_debug: define pr_fmt() for consistent logging
        mpt2sas: Refcount fw_events and fix unsafe list usage
        mpt2sas: Refcount sas_device objects and fix unsafe list usage
        scsi_dh: return SCSI_DH_NOTCONN in scsi_dh_activate()
        scsi_dh: don't allow to detach device handlers at runtime
        ...
      8e78b7dc
  5. 11 Sep, 2015 8 commits