From: Ian Campbell Subject: Re: [PATCH 05 of 10] arm: More SMP bringup Date: Thu, 23 Feb 2012 19:16:00 +0000 Message-ID: <1330024560.10008.6.camel@dagon.hellion.org.uk> References: <1e9c6bd7cc99d1af0107.1330018852@whitby.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1e9c6bd7cc99d1af0107.1330018852@whitby.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Tim Deegan Cc: "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 2012-02-23 at 17:40 +0000, Tim Deegan wrote: [...] > + /* Signal the next non-boot CPU to come and join us here */ > + ldr r0, =boot_gate /* VA of gate */ > + add r0, r0, r10 /* PA of gate */ > + mov r1, #0 /* (0 == unlocked) */ > + str r1, [r0] > + dsb > + isb > + sev Here we have released the next CPU from the holding pen... [...] > + /* Non-boot CPUs report that they've got this far */ > + ldr r0, =ready_cpus > + ldr r1, [r0] /* Read count of ready CPUs */ > + add r1, r1, #1 /* ++ */ > + str r1, [r0] /* Writeback */ > + dsb ... and here we do a non-atomic update of a shared variable. What prevents the following CPU from catching us up and conflicting here? Would we be better signalling the next CPU after the increment instead? Ian.