Skip to content

Commit

Permalink
arm64: Do not attempt to use init_mm in reset_context()
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: <stable@vger.kernel.org>
  • Loading branch information
Catalin Marinas committed Jun 12, 2015
1 parent 8a14849 commit 565630d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arch/arm64/mm/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 565630d

Please sign in to comment.