From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: keir@xen.org, xen-devel@lists.xen.org
Subject: Re: [PATCH v2 for 4.5] x86/VPMU: Clear last_vcpu when destroying VPMU
Date: Tue, 16 Dec 2014 10:12:01 -0500 [thread overview]
Message-ID: <54904BC1.10604@oracle.com> (raw)
In-Reply-To: <549009F9020000780004FCB3@mail.emea.novell.com>
On 12/16/2014 04:31 AM, Jan Beulich wrote:
>>>> On 15.12.14 at 23:24, <boris.ostrovsky@oracle.com> wrote:
>> We need to make sure that last_vcpu is not pointing to VCPU whose
>> VPMU is being destroyed. Otherwise we may try to dereference it in
>> the future, when VCPU is gone.
>>
>> We have to do this via IPI since otherwise there is a (somewheat
>> theoretical) chance that between test and subsequent clearing
>> of last_vcpu the remote processor (i.e. vpmu->last_pcpu) might do
>> both load_vpmu() and then save_vpmu() for another VCPU. The former
>> will clear last_vcpu and the latter will set it to something else.
> Apart from the question of using cmpxchg instead of the IPI (I can
> see with the current model that using an IPI is the only clean way,
> i.e. the alternative - if usable - would mean altering existing logic
> too),
You mean something like
struct vcpu **last = &per_cpu(last_vcpu, vpmu->last_pcpu);
cmpxchg(last, v, NULL);
Yes, that could work.
-boris
prev parent reply other threads:[~2014-12-16 15:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-15 22:24 [PATCH v2 for 4.5] x86/VPMU: Clear last_vcpu when destroying VPMU Boris Ostrovsky
2014-12-16 9:31 ` Jan Beulich
2014-12-16 15:12 ` Boris Ostrovsky [this message]
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=54904BC1.10604@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=JBeulich@suse.com \
--cc=keir@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.