From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] virtio: use smp_XX barriers
Date: Wed, 27 Jan 2010 11:36:10 +0200 [thread overview]
Message-ID: <20100127093610.GD3476@redhat.com> (raw)
In-Reply-To: <4B600740.3060806@redhat.com>
On Wed, Jan 27, 2010 at 11:28:32AM +0200, Avi Kivity wrote:
> On 01/21/2010 07:10 PM, Michael S. Tsirkin wrote:
>> Documentation/memory-barriers.txt says:
>> Mandatory barriers should not be used to control SMP effects, since
>> mandatory barriers unnecessarily impose overhead on UP systems.
>>
>> This rule applies to virtio, so let's do it correctly.
>>
>>
>
> This is wrong. A UP guest still runs in parallel with the virtio device.
Yes, you are right here. I forgot that these macros
are compiled out on UP guest. Rusty please ignore this patch.
> smp_mb() is used for processor-vs-processor ordering, which can't happen
> on UP systems, but for process-vs-device, we must use mb().
>
> (this shows up if running a UP guest on an SMP host).
Currently, yes. But virtio is not a real device.
Here's what I was really trying to improve: rmb() is an lfence on
x86_64, but smp_rmb() is a barrier() and this is really sufficient for
virtio because x86_64 does not reorder memory reads.
Does this mean such an optimization would need a new macro?
--
MST
next prev parent reply other threads:[~2010-01-27 9:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 17:10 [PATCH] virtio: use smp_XX barriers Michael S. Tsirkin
2010-01-27 9:28 ` Avi Kivity
2010-01-27 9:36 ` Michael S. Tsirkin [this message]
2010-01-27 9:46 ` Avi Kivity
2010-01-27 9:47 ` Michael S. Tsirkin
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=20100127093610.GD3476@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=virtualization@lists.linux-foundation.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).