Subject: Re: [RFC 2/3] zImage: SMP hold

From: Geoff Levand <[email-masked]>
Date: Mon, 19 Feb 2007 07:33:00 -0800

Paul Mackerras wrote:
> Geoff Levand writes:
> 
>> +void smp_secondary_hold(unsigned int cpu_id)
>> +{
>> +	while(!smp_secondary_entry)
>> +		(void)0;
> 
> Using a barrier() here rather than making smp_secondary_entry volatile
> would be better, I think.
> 
> Also, what's the lifetime of this code after smp_secondary_entry is
> set, i.e. how do we know the kernel running on the primary cpu will
> wait for the secondary cpus to have got through this code into the
> kernel before it reuses this memory for something else?

I was thinking the most (only?) reliably way is to do it from inside the kernel.
Once inside, the primary waits for all secondaries to enter before proceeding.
That's why I didn't have anything here.  There is already a mechanism in the
kernel with __secondary_hold_acknowledge, but I don't yet know if it does
exactly what is needed.  Do you see any trouble with this?

-Geoff