From: Keir Fraser <keir.xen@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel List <xen-devel@lists.xen.org>,
Jan Beulich <JBeulich@suse.com>, Tim Deegan <tim@xen.org>
Subject: Re: Problems with spin_lock_irqsave() and for_each_online_cpu()
Date: Fri, 18 Oct 2013 05:57:22 +0100 [thread overview]
Message-ID: <CE867E42.60FD0%keir.xen@gmail.com> (raw)
In-Reply-To: <52603BD1.40901@citrix.com>
On 17/10/2013 20:34, "Andrew Cooper" <andrew.cooper3@citrix.com> 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
next prev parent reply other threads:[~2013-10-18 4:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-17 19:34 Problems with spin_lock_irqsave() and for_each_online_cpu() Andrew Cooper
2013-10-18 4:57 ` Keir Fraser [this message]
2013-10-18 8:19 ` Jan Beulich
2013-10-18 14:55 ` Andrew Cooper
2013-10-18 15:00 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CE867E42.60FD0%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.