arm64: Do not attempt to use init_mm in reset_context()
authorCatalin Marinas <catalin.marinas@arm.com>
Mon, 30 May 2016 05:57:31 +0000 (14:57 +0900)
committerInki Dae <inki.dae@samsung.com>
Mon, 30 May 2016 06:26:43 +0000 (15:26 +0900)
After secondary CPU boot or hotplug, the active_mm of the idle thread is
&init_mm. The init_mm.pgd (swapper_pg_dir) is only meant for TTBR1_EL1
and must not be set in TTBR0_EL1. Since when active_mm == &init_mm the
TTBR0_EL1 is already set to the reserved value, there is no need to
perform any context reset.

Change-Id: If37950d32cbf81f7b29bcd3e8ea2c7c1ad2d3b16
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
arch/arm64/mm/context.c

index baa758d370210ef61f36942ab98633a80a324687..76c1e6cd36fc46d42da4c39155f02897d8462da1 100644 (file)
@@ -92,6 +92,14 @@ static void reset_context(void *info)
        unsigned int cpu = smp_processor_id();
        struct mm_struct *mm = current->active_mm;
 
+       /*
+        * current->active_mm could be init_mm for the idle thread immediately
+        * after secondary CPU boot or hotplug. TTBR0_EL1 is already set to
+        * the reserved value, so no need to reset any context.
+        */
+       if (mm == &init_mm)
+               return;
+
        smp_rmb();
        asid = cpu_last_asid + cpu;