]> git.baikalelectronics.ru Git - kernel.git/commit
MIPS: tlbex: Properly fix HUGE TLB Refill exception handler
authorDavid Daney <david.daney@cavium.com>
Mon, 20 Oct 2014 22:34:23 +0000 (15:34 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 22 Oct 2014 17:29:08 +0000 (19:29 +0200)
commitde6fd6393a51464861edcef0c14fcc02d59d642e
treeb3d2fcaa7b1c301d1319d2442b5ef6d7ab78cde3
parentd64c212bcd1d3270987e94052fa4f3fc4f80e2d4
MIPS: tlbex: Properly fix HUGE TLB Refill exception handler

In commit 00e50cfe6b2a12 (MIPS: tlbex: Fix a missing statement for
HUGETLB), the TLB Refill handler was fixed so that non-OCTEON targets
would work properly with huge pages.  The change was incorrect in that
it broke the OCTEON case.

The problem is shown here:

    xxx0: df7a0000  ld k0,0(k1)
    .
    .
    .
    xxxc0: df610000  ld at,0(k1)
    xxxc4: 335a0ff0  andi k0,k0,0xff0
    xxxc8: e825ffcd  bbit1 at,0x5,0x0
    xxxcc: 003ad82d  daddu k1,at,k0
    .
    .
    .

In the non-octeon case there is a destructive test for the huge PTE
bit, and then at 0, $k0 is reloaded (that is what the 00e50cfe6b2a12
patch added).

In the octeon case, we modify k1 in the branch delay slot, but we
never need k0 again, so the new load is not needed, but since k1 is
modified, if we do the load, we load from a garbage location and then
get a nested TLB Refill, which is seen in userspace as either SIGBUS
or SIGSEGV (depending on the garbage).

The real fix is to only do this reloading if it is needed, and never
where it is harmful.

Signed-off-by: David Daney <david.daney@cavium.com>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: stable@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8151/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/mm/tlbex.c