1. 26 Aug, 2014 30 commits
    • Christoph Lameter's avatar
      avr32: Replace __get_cpu_var with __this_cpu_write · 8c23af61
      Christoph Lameter authored
      Replace the single use of __get_cpu_var in avr32 with
      __this_cpu_write.
      
      Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
      Acked-by: default avatarHans-Christian Egtvedt <egtvedt@samfundet.no>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      8c23af61
    • Christoph Lameter's avatar
      blackfin: Replace __get_cpu_var uses · 7e788ab1
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      CC: Mike Frysinger <vapier@gentoo.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      7e788ab1
    • Christoph Lameter's avatar
      81829a96
    • Christoph Lameter's avatar
      tile: Replace __get_cpu_var uses · b4f50191
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      Acked-by: default avatarChris Metcalf <cmetcalf@tilera.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      b4f50191
    • Christoph Lameter's avatar
      powerpc: Replace __get_cpu_var uses · 5828f666
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      tj: Folded a fix patch.
          http://lkml.kernel.org/g/alpine.DEB.2.11.1408172143020.9652@gentwo.org
      
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      CC: Paul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      5828f666
    • Christoph Lameter's avatar
      alpha: Replace __get_cpu_var · 2999a4b3
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Acked-by: default avatarRichard Henderson <rth@twiddle.net>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      2999a4b3
    • Christoph Lameter's avatar
      ia64: Replace __get_cpu_var uses · 6065a244
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: linux-ia64@vger.kernel.org
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      6065a244
    • Christoph Lameter's avatar
      s390: cio driver &__get_cpu_var replacements · 0bf7fcf1
      Christoph Lameter authored
      Use this_cpu_ptr() instead of &__get_cpu_var()
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      0bf7fcf1
    • Christoph Lameter's avatar
      s390: Replace __get_cpu_var uses · eb7e7d76
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	this_cpu_inc(y)
      
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      CC: linux390@de.ibm.com
      Acked-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      eb7e7d76
    • Christoph Lameter's avatar
      mips: Replace __get_cpu_var uses · 35898716
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      At the end of the patch set all uses of __get_cpu_var have been removed so
      the macro is removed too.
      
      The patch set includes passes over all arches as well. Once these operations
      are used throughout then specialized macros can be defined in non -x86
      arches as well in order to optimize per cpu access by f.e.  using a global
      register that may be set to the per cpu base.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      35898716
    • Christoph Lameter's avatar
      MIPS: Replace __get_cpu_var uses in FPU emulator. · d1cd39ad
      Christoph Lameter authored
      The use of __this_cpu_inc() requires a fundamental integer type, so
      change the type of all the counters to unsigned long, which is the
      same width they were before, but not wrapped in local_t.
      Signed-off-by: default avatarDavid Daney <david.daney@cavium.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      d1cd39ad
    • Christoph Lameter's avatar
      arm: Replace __this_cpu_ptr with raw_cpu_ptr · 06b96c8b
      Christoph Lameter authored
      __this_cpu_ptr is being phased out. So replace with raw_cpu_ptr.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      06b96c8b
    • Christoph Lameter's avatar
      uv: Replace __get_cpu_var · e1632170
      Christoph Lameter authored
      Use __this_cpu_read instead.
      
      Cc: Hedi Berriche <hedi@sgi.com>
      Cc: Mike Travis <travis@sgi.com>
      Cc: Dimitri Sivanich <sivanich@sgi.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      e1632170
    • Christoph Lameter's avatar
      x86: Replace __get_cpu_var uses · 89cbc767
      Christoph Lameter authored
      __get_cpu_var() is used for multiple purposes in the kernel source. One of
      them is address calculation via the form &__get_cpu_var(x).  This calculates
      the address for the instance of the percpu variable of the current processor
      based on an offset.
      
      Other use cases are for storing and retrieving data from the current
      processors percpu area.  __get_cpu_var() can be used as an lvalue when
      writing data or on the right side of an assignment.
      
      __get_cpu_var() is defined as :
      
      #define __get_cpu_var(var) (*this_cpu_ptr(&(var)))
      
      __get_cpu_var() always only does an address determination. However, store
      and retrieve operations could use a segment prefix (or global register on
      other platforms) to avoid the address calculation.
      
      this_cpu_write() and this_cpu_read() can directly take an offset into a
      percpu area and use optimized assembly code to read and write per cpu
      variables.
      
      This patch converts __get_cpu_var into either an explicit address
      calculation using this_cpu_ptr() or into a use of this_cpu operations that
      use the offset.  Thereby address calculations are avoided and less registers
      are used when code is generated.
      
      Transformations done to __get_cpu_var()
      
      1. Determine the address of the percpu instance of the current processor.
      
      	DEFINE_PER_CPU(int, y);
      	int *x = &__get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(&y);
      
      2. Same as #1 but this time an array structure is involved.
      
      	DEFINE_PER_CPU(int, y[20]);
      	int *x = __get_cpu_var(y);
      
          Converts to
      
      	int *x = this_cpu_ptr(y);
      
      3. Retrieve the content of the current processors instance of a per cpu
      variable.
      
      	DEFINE_PER_CPU(int, y);
      	int x = __get_cpu_var(y)
      
         Converts to
      
      	int x = __this_cpu_read(y);
      
      4. Retrieve the content of a percpu struct
      
      	DEFINE_PER_CPU(struct mystruct, y);
      	struct mystruct x = __get_cpu_var(y);
      
         Converts to
      
      	memcpy(&x, this_cpu_ptr(&y), sizeof(x));
      
      5. Assignment to a per cpu variable
      
      	DEFINE_PER_CPU(int, y)
      	__get_cpu_var(y) = x;
      
         Converts to
      
      	__this_cpu_write(y, x);
      
      6. Increment/Decrement etc of a per cpu variable
      
      	DEFINE_PER_CPU(int, y);
      	__get_cpu_var(y)++
      
         Converts to
      
      	__this_cpu_inc(y)
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: x86@kernel.org
      Acked-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      89cbc767
    • Christoph Lameter's avatar
      irqchips: Replace __this_cpu_ptr uses · 532d0d06
      Christoph Lameter authored
      [ARM specific]
      
      These are generally replaced with raw_cpu_ptr. However, in
      gic_get_percpu_base() we immediately dereference the pointer. This is
      equivalent to a raw_cpu_read. So use that operation there.
      
      Cc: nicolas.pitre@linaro.org
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      532d0d06
    • Christoph Lameter's avatar
      drivers/net/ethernet/tile: __get_cpu_var call introduced in 3.14 · eee8492d
      Christoph Lameter authored
      Another case was merged for 3.14-rc1
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      eee8492d
    • Christoph Lameter's avatar
      metag: Replace __get_cpu_var uses for address calculation · bd83e65b
      Christoph Lameter authored
      Replace __get_cpu_var uses for address calculation with this_cpu_ptr().
      Acked-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      bd83e65b
    • Christoph Lameter's avatar
      md: Replace __this_cpu_ptr with raw_cpu_ptr · 1f125e76
      Christoph Lameter authored
      __this_cpu_ptr is being phased out.
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      1f125e76
    • Christoph Lameter's avatar
      net: Replace get_cpu_var through this_cpu_ptr · 903ceff7
      Christoph Lameter authored
      Replace uses of get_cpu_var for address calculation through this_cpu_ptr.
      
      Cc: netdev@vger.kernel.org
      Cc: Eric Dumazet <edumazet@google.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      903ceff7
    • Christoph Lameter's avatar
      watchdog: Replace __raw_get_cpu_var uses · f7f66b05
      Christoph Lameter authored
      Most of these are the uses of &__raw_get_cpu_var for address calculation.
      
      touch_softlockup_watchdog_sync() uses __raw_get_cpu_var to write to
      per cpu variables. Use __this_cpu_write instead.
      
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Cc: linux-watchdog@vger.kernel.org
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      f7f66b05
    • Christoph Lameter's avatar
      70b2776a
    • Christoph Lameter's avatar
      drivers/clocksource: Replace __get_cpu_var used for address calculation · 27d05167
      Christoph Lameter authored
      Replace __get_cpu_var used for address calculation with this_cpu_ptr.
      Acked-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      27d05167
    • Christoph Lameter's avatar
      drivers/oprofile: Replace __get_cpu_var uses for address calculation · 879d9274
      Christoph Lameter authored
      Replace the uses of __get_cpu_var for address calculation with this_cpu_ptr.
      
      Cc: Robert Richter <rric@kernel.org>
      Cc: oprofile-list@lists.sf.net
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      879d9274
    • Christoph Lameter's avatar
      drivers/cpuidle: Replace __get_cpu_var uses for address calculation · 229b6863
      Christoph Lameter authored
      All of these are for address calculation. Replace with
      this_cpu_ptr().
      
      Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
      Cc: linux-pm@vger.kernel.org
      Acked-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      [cpufreq changes]
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      229b6863
    • Christoph Lameter's avatar
      drivers/char/random: Replace __get_cpu_var uses · 1b2a1a7e
      Christoph Lameter authored
      A single case of using __get_cpu_var for address calculation.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      1b2a1a7e
    • Christoph Lameter's avatar
      block: Replace __this_cpu_ptr with raw_cpu_ptr · a0b6bc63
      Christoph Lameter authored
      __this_cpu_ptr is being phased out use raw_cpu_ptr instead which was
      introduced in 3.15-rc1.
      
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      a0b6bc63
    • Christoph Lameter's avatar
      scheduler: Replace __get_cpu_var with this_cpu_ptr · 4a32fea9
      Christoph Lameter authored
      Convert all uses of __get_cpu_var for address calculation to use
      this_cpu_ptr instead.
      
      [Uses of __get_cpu_var with cpumask_var_t are no longer
      handled by this patch]
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      4a32fea9
    • Christoph Lameter's avatar
    • Christoph Lameter's avatar
      time: Replace __get_cpu_var uses · 22127e93
      Christoph Lameter authored
      Convert uses of __get_cpu_var for creating a address from a percpu
      offset to this_cpu_ptr.
      
      The two cases where get_cpu_var is used to actually access a percpu
      variable are changed to use this_cpu_read/raw_cpu_read.
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      22127e93
    • Christoph Lameter's avatar
      kernel misc: Replace __get_cpu_var uses · bb964a92
      Christoph Lameter authored
      Replace uses of __get_cpu_var for address calculation with this_cpu_ptr.
      
      Cc: akpm@linux-foundation.org
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      bb964a92
  2. 16 Aug, 2014 10 commits
    • Linus Torvalds's avatar
      Linux 3.17-rc1 · 7d1311b9
      Linus Torvalds authored
      7d1311b9
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86 · 605f884d
      Linus Torvalds authored
      Pull x86 platform driver updates from Matthew Garrett:
       "A moderate number of changes, but nothing awfully significant.
      
        A lot of const cleanups, some reworking and additions to the rfkill
        quirks in the asus driver, a new driver for generating falling laptop
        events on Toshibas and some misc fixes.
      
        Maybe vendors have stopped inventing things"
      
      * 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: (41 commits)
        platform/x86: Enable build support for toshiba_haps
        Documentation: Add file about toshiba_haps module
        platform/x86: Toshiba HDD Active Protection Sensor
        asus-nb-wmi: Add wapf4 quirk for the U32U
        alienware-wmi: make hdmi_mux enabled on case-by-case basis
        ideapad-laptop: Constify DMI table and other r/o variables
        asus-nb-wmi.c: Rename x401u quirk to wapf4
        compal-laptop: correct invalid hwmon name
        toshiba_acpi: Add Qosmio X75-A to the alt keymap dmi list
        toshiba_acpi: Add extra check to backlight code
        Fix log message about future removal of interface
        ideapad-laptop: Disable touchpad interface on Yoga models
        asus-nb-wmi: Add wapf4 quirk for the X550CC
        intel_ips: Make ips_mcp_limits variables static
        thinkpad_acpi: Mark volume_alsa_control_{vol,mute} as __initdata
        fujitsu-laptop: Mark fujitsu_dmi_table[] DMI table as __initconst
        hp-wmi: Add missing __init annotations to initialization code
        hp_accel: Constify ACPI and DMI tables
        fujitsu-tablet: Mark DMI callbacks as __init code
        dell-laptop: Mark dell_quirks[] DMI table as __initconst
        ...
      605f884d
    • Linus Torvalds's avatar
      Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux · 49899007
      Linus Torvalds authored
      Pull idle update from Len Brown:
       "Two Intel-platform-specific updates to intel_idle, and a cosmetic
        tweak to the turbostat utility"
      
      * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux:
        tools/power turbostat: tweak whitespace in output format
        intel_idle: Broadwell support
        intel_idle: Disable Baytrail Core and Module C6 auto-demotion
      49899007
    • Linus Torvalds's avatar
      Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux · 6fedb0ff
      Linus Torvalds authored
      Pull module fix from Rusty Russell:
       "Nasty potential bug if someone uses a known module param with an
        invalid value (we don't fail unknown module params any more, just
        warn)"
      
      * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux:
        module: Clean up ro/nx after early module load failures
      6fedb0ff
    • Linus Torvalds's avatar
      Merge branch 'rng-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio · 90c80969
      Linus Torvalds authored
      Pull virtio-rng update from Amit Shah:
       "Add derating factor for use by hwrng core
      
        Sending directly to you with the commit log changes Ted Ts'o pointed
        out.  Not sure if Rusty's back after his travel, but this already has
        his s-o-b"
      
      * 'rng-queue' of git://git.kernel.org/pub/scm/linux/kernel/git/amit/virtio:
        virtio: rng: add derating factor for use by hwrng core
      90c80969
    • Linus Torvalds's avatar
      Merge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · e64df3eb
      Linus Torvalds authored
      Pull btrfs updates from Chris Mason:
       "These are all fixes I'd like to get out to a broader audience.
      
        The biggest of the bunch is Mark's quota fix, which is also in the
        SUSE kernel, and makes our subvolume quotas dramatically more
        accurate.
      
        I've been running xfstests with these against your current git
        overnight, but I'm queueing up longer tests as well"
      
      * 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        btrfs: disable strict file flushes for renames and truncates
        Btrfs: fix csum tree corruption, duplicate and outdated checksums
        Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch
        Btrfs: fix compressed write corruption on enospc
        btrfs: correctly handle return from ulist_add
        btrfs: qgroup: account shared subtrees during snapshot delete
        Btrfs: read lock extent buffer while walking backrefs
        Btrfs: __btrfs_mod_ref should always use no_quota
        btrfs: adjust statfs calculations according to raid profiles
      e64df3eb
    • Linus Torvalds's avatar
      Merge tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux · 53b95d63
      Linus Torvalds authored
      Pull file locking bugfixes from Jeff Layton:
       "Most of these patches are to fix a long-standing regression that crept
        in when the BKL was removed from the file-locking code.  The code was
        converted to use a conventional spinlock, but some fl_release_private
        ops can block and you can end up sleeping inside the lock.
      
        There's also a patch to make /proc/locks show delegations as 'DELEG'"
      
      * tag 'locks-v3.17-2' of git://git.samba.org/jlayton/linux:
        locks: update Locking documentation to clarify fl_release_private behavior
        locks: move locks_free_lock calls in do_fcntl_add_lease outside spinlock
        locks: defer freeing locks in locks_delete_lock until after i_lock has been dropped
        locks: don't reuse file_lock in __posix_lock_file
        locks: don't call locks_release_private from locks_copy_lock
        locks: show delegations as "DELEG" in /proc/locks
      53b95d63
    • Linus Torvalds's avatar
      Merge git://git.kvack.org/~bcrl/aio-next · da06df54
      Linus Torvalds authored
      Pull aio updates from Ben LaHaise.
      
      * git://git.kvack.org/~bcrl/aio-next:
        aio: use iovec array rather than the single one
        aio: fix some comments
        aio: use the macro rather than the inline magic number
        aio: remove the needless registration of ring file's private_data
        aio: remove no longer needed preempt_disable()
        aio: kill the misleading rcu read locks in ioctx_add_table() and kill_ioctx()
        aio: change exit_aio() to load mm->ioctx_table once and avoid rcu_read_lock()
      da06df54
    • Azael Avalos's avatar
      platform/x86: Enable build support for toshiba_haps · 186e4e89
      Azael Avalos authored
      Makefile and Kconfig build support patch for the newly introduced
      kernel module toshiba_haps.
      Signed-off-by: default avatarAzael Avalos <coproscefalo@gmail.com>
      Signed-off-by: default avatarMatthew Garrett <matthew.garrett@nebula.com>
      186e4e89
    • Azael Avalos's avatar
      Documentation: Add file about toshiba_haps module · f369aa6d
      Azael Avalos authored
      This patch provides information about the Toshiba HDD
      Active Protection Sensor driver module toshiba_haps.
      Signed-off-by: default avatarAzael Avalos <coproscefalo@gmail.com>
      Signed-off-by: default avatarMatthew Garrett <matthew.garrett@nebula.com>
      f369aa6d