From: Gregory Haskins <gregory.haskins@gmail.com>
To: Avi Kivity <avi@redhat.com>
Cc: Gregory Haskins <ghaskins@novell.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
"alacrityvm-devel@lists.sourceforge.net"
<alacrityvm-devel@lists.sourceforge.net>,
David Howells <dhowells@redhat.com>
Subject: Re: [PATCH v2 2/4] KVM: introduce "xinterface" API for external interaction with guests
Date: Wed, 07 Oct 2009 08:48:25 -0400 [thread overview]
Message-ID: <4ACC8E19.8070706@gmail.com> (raw)
In-Reply-To: <4ACC4D46.1090805@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]
Avi Kivity wrote:
> On 10/06/2009 09:40 PM, Gregory Haskins wrote:
>> Thinking about this some more over lunch, I think we (Avi and I) might
>> both be wrong (and David is right). Avi is right that we don't need
>> rmb() or barrier() for the reasons already stated, but I think David is
>> right that we need an smp_mb() to ensure the cpu doesn't do the
>> reordering. Otherwise a different cpu could invalidate the memory if it
>> reuses the freed memory in the meantime, iiuc. IOW: its not a compiler
>> issue but a cpu issue.
>>
>> Or am I still confused?
>>
>>
>
> The sequence of operations is:
>
> v = p->v;
> f();
> // rmb() ?
> g(v);
>
> You are worried that the compiler
No
> or cpu will fetch p->v after f() has executed?
Yes.
> The compiler may not, since it can't tell whether f() might
> change p->v.
Right, you were correct to say my barrier() suggestion was wrong.
> If f() can cause another agent to write to p (by freeing
> it to a global list, for example), then it is its responsibility to
> issue the smp_rmb(), otherwise no calculation that took place before f()
> and accessed p is safe.
>
IOW: David is right. You need a cpu-barrier one way or the other. We
can either allow ->release() to imply one (and probably document it that
way, like we did for slow-work), or we can be explicit. I chose to be
explicit since it is kind of self-documenting, and there is no need to
be worried about performance since the release is slow-path.
OTOH: If you feel strongly about it, we can take it out, knowing that
most anything the properly invalidates the memory will likely include an
implicit barrier of some kind.
Kind Regards,
-Greg
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 267 bytes --]
next prev parent reply other threads:[~2009-10-07 12:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-02 20:19 [PATCH v2 0/4] KVM: xinterface Gregory Haskins
2009-10-02 20:19 ` [PATCH v2 1/4] mm: export use_mm() and unuse_mm() to modules Gregory Haskins
2009-10-02 20:19 ` [PATCH v2 2/4] KVM: introduce "xinterface" API for external interaction with guests Gregory Haskins
2009-10-03 20:05 ` Marcelo Tosatti
2009-10-05 23:33 ` Gregory Haskins
2009-10-04 10:25 ` Avi Kivity
2009-10-05 23:57 ` Gregory Haskins
2009-10-06 9:34 ` Avi Kivity
2009-10-06 13:31 ` Gregory Haskins
2009-10-06 14:22 ` Gregory Haskins
2009-10-06 16:23 ` Avi Kivity
2009-10-06 17:00 ` Gregory Haskins
2009-10-06 17:00 ` Gregory Haskins
2009-10-06 19:40 ` Gregory Haskins
2009-10-07 8:11 ` Avi Kivity
2009-10-07 12:48 ` Gregory Haskins [this message]
2009-10-08 14:45 ` Avi Kivity
2009-10-06 16:19 ` Avi Kivity
2009-10-06 16:58 ` Gregory Haskins
2009-10-06 18:18 ` [Alacrityvm-devel] " Ira W. Snyder
2009-10-07 5:10 ` Amit Shah
2009-10-07 7:43 ` Avi Kivity
2009-10-02 20:19 ` [PATCH v2 3/4] KVM: add io services to xinterface Gregory Haskins
2009-10-04 10:26 ` Avi Kivity
2009-10-02 20:19 ` [PATCH v2 4/4] KVM: add scatterlist support " Gregory Haskins
2009-10-04 10:28 ` Avi Kivity
2009-10-05 23:57 ` Gregory Haskins
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=4ACC8E19.8070706@gmail.com \
--to=gregory.haskins@gmail.com \
--cc=alacrityvm-devel@lists.sourceforge.net \
--cc=avi@redhat.com \
--cc=dhowells@redhat.com \
--cc=ghaskins@novell.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).