From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: sjur@brendeland.net, Linus Walleij <linus.walleij@linaro.org>,
Erwan Yvin <erwan.yvin@stericsson.com>,
virtualization@lists.linux-foundation.org,
sjur.brandeland@stericsson.com
Subject: Re: [PATCH 2/2] tools/virtio: make barriers stronger.
Date: Fri, 08 Mar 2013 10:56:05 +1100 [thread overview]
Message-ID: <87y5dywyqy.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20130307092908.GA4129@redhat.com>
"Michael S. Tsirkin" <mst@redhat.com> writes:
> On Thu, Mar 07, 2013 at 02:48:24PM +1100, Rusty Russell wrote:
>> "Michael S. Tsirkin" <mst@redhat.com> writes:
>> > On Wed, Mar 06, 2013 at 03:54:42PM +1100, Rusty Russell wrote:
>> >> In the coming vringh_test, we share an mmap with another userspace process
>> >> for testing. This requires real barriers.
>> >>
>> >> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
>> >>
>> >> diff --git a/tools/virtio/asm/barrier.h b/tools/virtio/asm/barrier.h
>> >> index aff61e1..7a63693 100644
>> >> --- a/tools/virtio/asm/barrier.h
>> >> +++ b/tools/virtio/asm/barrier.h
>> >> @@ -3,8 +3,8 @@
>> >> #define mb() __sync_synchronize()
>> >>
>> >> #define smp_mb() mb()
>> >> -# define smp_rmb() barrier()
>> >> -# define smp_wmb() barrier()
>> >> +# define smp_rmb() mb()
>> >> +# define smp_wmb() mb()
>> >> /* Weak barriers should be used. If not - it's a bug */
>> >> # define rmb() abort()
>> >> # define wmb() abort()
>> >
>> > Hmm this seems wrong on x86 which has strong order in hardware.
>> > It should not matter whether the other side is a userspace
>> > process or a kernel thread.
>>
>> Actually, this code is completely generic now, though overkill for x86 smp_wmb():
>>
>> Interestingly, when I try defining them, 32-bit x86 slows down (it seems
>> that gcc is using "lock orl $0x0,(%esp)" for __sync_synchronize()).:
>
> Well this depends on which arch you are building for.
> We saw this in qemu too, see e.g. include/qemu/atomic.h in qemu.
Hmm, I thought x86 had load reordering, but it seems that was only some
older chips, which we can consider obsolete.
I learned something... I've dropped the patch.
Thanks,
Rusty.
next prev parent reply other threads:[~2013-03-07 23:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 13:51 [PATCH vringh] virtio: Introduce vringh wrappers in virtio_config sjur.brandeland
2013-03-06 4:42 ` Rusty Russell
2013-03-06 10:50 ` Sjur Brændeland
2013-03-06 12:16 ` Ohad Ben-Cohen
2013-03-06 12:37 ` Sjur Brændeland
2013-03-06 23:28 ` Sjur Brændeland
2013-03-06 4:46 ` [FYI] vringh fixes Rusty Russell
2013-03-06 4:53 ` [PATCH 1/2] Rusty Russell
2013-03-06 4:54 ` [PATCH 2/2] tools/virtio: make barriers stronger Rusty Russell
2013-03-06 10:20 ` Michael S. Tsirkin
2013-03-07 3:48 ` Rusty Russell
2013-03-07 9:29 ` Michael S. Tsirkin
2013-03-07 23:56 ` Rusty Russell [this message]
2013-03-06 4:57 ` [PATCH 1/3] vringh: host-side implementation of virtio rings (v2) Rusty Russell
2013-03-06 4:59 ` [PATCH 2/3] vringh: don't flag already listening Rusty Russell
2013-03-06 5:02 ` [PATCH 3/3] tools/virtio: add vring_test (v2) Rusty Russell
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=87y5dywyqy.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=erwan.yvin@stericsson.com \
--cc=linus.walleij@linaro.org \
--cc=mst@redhat.com \
--cc=sjur.brandeland@stericsson.com \
--cc=sjur@brendeland.net \
--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 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.