]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: pm-cps: Drop manual cache-line alignment of ready_count
authorPaul Burton <paul.burton@imgtec.com>
Thu, 2 Mar 2017 22:02:40 +0000 (14:02 -0800)
committerRalf Baechle <ralf@linux-mips.org>
Fri, 30 Jun 2017 02:38:55 +0000 (04:38 +0200)
commit161c51ccb7a6faf45ffe09aa5cf1ad85ccdad503
tree2fdcdcb84cdab3befe0a7a8d18d795135dc15b5f
parentddbfff7429a75d954bf5bdff9f2222bceb4c236a
MIPS: pm-cps: Drop manual cache-line alignment of ready_count

We allocate memory for a ready_count variable per-CPU, which is accessed
via a cached non-coherent TLB mapping to perform synchronisation between
threads within the core using LL/SC instructions. In order to ensure
that the variable is contained within its own data cache line we
allocate 2 lines worth of memory & align the resulting pointer to a line
boundary. This is however unnecessary, since kmalloc is guaranteed to
return memory which is at least cache-line aligned (see
ARCH_DMA_MINALIGN). Stop the redundant manual alignment.

Besides cleaning up the code & avoiding needless work, this has the side
effect of avoiding an arithmetic error found by Bryan on 64 bit systems
due to the 32 bit size of the former dlinesz. This led the ready_count
variable to have its upper 32b cleared erroneously for MIPS64 kernels,
causing problems when ready_count was later used on MIPS64 via cpuidle.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 3179d37ee1ed ("MIPS: pm-cps: add PM state entry code for CPS systems")
Reported-by: Bryan O'Donoghue <bryan.odonoghue@imgtec.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@imgtec.com>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: stable <stable@vger.kernel.org> # v3.16+
Patchwork: https://patchwork.linux-mips.org/patch/15383/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/pm-cps.c