Google
  Web www.spinics.net

Re: [PATCH 2/2] Global ASID allocation on SMP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Russell,

On Fri, 2008-06-06 at 12:46 +0100, Catalin Marinas wrote:
> The current ASID allocation algorithm doesn't ensure the notification
> of the other CPUs when the ASID rolls over. This may lead to two
> processes using the same ASID (but different generation) or multiple
> threads of the same process using different ASIDs.
> 
> This patch adds the broadcasting of the ASID rollover event to the
> other CPUs. To avoid a race on multiple CPUs modifying "cpu_last_asid"
> during the handling of the broadcast, the ASID numbering now starts at
> "smp_processor_id() + 1". At rollover, the cpu_last_asid will be set
> to NR_CPUS.

Did you get a chance to look at this patch (or 5093/1 in the patch
system)? It's a bug fix and it could probably be merged after the
current window closes if you are OK with the approach.

BTW, in a specially created test (forking a lot in the initial process),
I can make it fail if I don't have the patch below. This is because
current_mm on the secondary CPUs is null until the first task schedule.
Is it a better approach to initialise current_mm to init_mm as this is
the one used by the idle task?

--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -82,6 +82,13 @@ static void reset_context(void *info)
 	unsigned int cpu = smp_processor_id();
 	struct mm_struct *mm = per_cpu(current_mm, cpu);
 
+	/*
+	 * Check if a current_mm was set on this CPU as it might still
+	 * be in the early booting stages and using the reserved ASID.
+	 */
+	if (!mm)
+		return;
+
 	smp_rmb();
 	asid = cpu_last_asid + cpu + 1;
 

-- 
Catalin


-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Linux Arm]     [Fedora ARM]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [PDAs]     [Linux]     [Linux Book List]     [Linux MIPS]     [Yosemite Campsites]     [Photos]

Add to Google Google PageRank Checking tool