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

Re: [Xen-devel] Problems with spin_lock_irqsave() and for_each_online_cpu()



On 17/10/2013 20:34, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx> wrote:

> As for the spinlocks, while I as the programmer am fairly sure that
> "&per_cpu(t_lock, i)" is unlikely to change, coverity takes into account
> that updates to __per_cpu_offset[i] have no protection.  Because of
> RELOC_HIDE(), gcc can't hoist the per_cpu() calculation, but will run
> from register cached values of per_cpu__t_lock and __per_cpu_offset[i],
> so is guaranteed to find the same lock both times even if
> __per_cpu_offset[i] changes.
> 
> However, it occurs to me that there is no protection between
> for_each_online_cpu() finding a bit set in the cpu_online_map and safely
> using per_cpu() to poke at another cpus data.  One solution seems to be
> to make use of {get,put}_cpu_maps() but this seems overkill especially
> as the innards of a for_each_online_cpu() loop only care about one
> particular pcpu not disappearing under its feet.

CPUs are taken offline in a stop_machine_run environment, *and* the
__per_cpu_offset[i] change is done via RCU. We're safe here I'm sure.

 -- Keir



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.