]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
MIPS: HTW: Prevent accidental HTW start due to nested htw_{start, stop}
authorMarkos Chandras <markos.chandras@imgtec.com>
Mon, 26 Jan 2015 13:04:33 +0000 (13:04 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:53:01 +0000 (14:53 -0800)
commit09f2e748e02e8133c3effdba371b1dd20a16015d
treeb933e11a510a7e4cae475f6a90421fd565cb01a5
parentb3b345af596984d082e2eaef8607c718d80aca6c
MIPS: HTW: Prevent accidental HTW start due to nested htw_{start, stop}

commit ed4cbc81addbc076b016c5b979fd1a02f0897f0a upstream.

activate_mm() and switch_mm() call get_new_mmu_context() which in turn
can enable the HTW before the entryhi is changed with the new ASID.
Since the latter will enable the HTW in local_flush_tlb_all(),
then there is a small timing window where the HTW is running with the
new ASID but with an old pgd since the TLBMISS_HANDLER_SETUP_PGD
hasn't assigned a new one yet. In order to prevent that, we introduce a
simple htw counter to avoid starting HTW accidentally due to nested
htw_{start,stop}() sequences. Moreover, since various IPI calls can
enforce TLB flushing operations on a different core, such an operation
may interrupt another htw_{stop,start} in progress leading inconsistent
updates of the htw_seq variable. In order to avoid that, we disable the
interrupts whenever we update that variable.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9118/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/mips/include/asm/cpu-info.h
arch/mips/include/asm/mmu_context.h
arch/mips/include/asm/pgtable.h
arch/mips/kernel/cpu-probe.c