From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org, Rusty Russell <rusty@rustcorp.com.au>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] [PATCH RFC] virtio: put last seen used index into ring itself
Date: Sun, 23 May 2010 20:28:21 +0300 [thread overview]
Message-ID: <20100523172821.GA14948@redhat.com> (raw)
In-Reply-To: <4BF951BE.1010402@redhat.com>
On Sun, May 23, 2010 at 07:03:10PM +0300, Avi Kivity wrote:
> On 05/23/2010 06:51 PM, Michael S. Tsirkin wrote:
>>>
>>>> So locked version seems to be faster than unlocked,
>>>> and share/unshare not to matter?
>>>>
>>>>
>>> May be due to the processor using the LOCK operation as a hint to
>>> reserve the cacheline for a bit.
>>>
>> Maybe we should use atomics on index then?
>>
>
> This should only be helpful if you access the cacheline several times in
> a row. That's not the case in virtio (or here).
>
> I think the problem is that LOCKSHARE and SHARE are not symmetric, so
> they can't be directly compared.
>
>> OK, after adding mb in code patch will be sent separately,
>> the test works for my workstation. locked is still fastest,
>> unshared sometimes shows wins and sometimes loses over shared.
>>
>> [root@qus19 ~]# ./cachebounce share 0 1
>> CPU 0: share cacheline: 6638521 usec
>> CPU 1: share cacheline: 6638478 usec
>>
>
> 66 ns? nice.
>
>> [root@qus19 ~]# ./cachebounce share 0 2
>> CPU 0: share cacheline: 14529198 usec
>> CPU 2: share cacheline: 14529156 usec
>>
>
> 140 ns, not too bad. I hope I'm not misinterpreting the results.
>
> --
> error compiling committee.c: too many arguments to function
Here's another box: here the fastest option
is shared, slowest unshared, lock is in the middle.
[root@virtlab16 testring]# sh run 0 2
CPU 2: share cacheline: 3304728 usec
CPU 0: share cacheline: 3304784 usec
CPU 0: unshare cacheline: 6283248 usec
CPU 2: unshare cacheline: 6283224 usec
CPU 2: lockshare cacheline: 4018567 usec
CPU 0: lockshare cacheline: 4018609 usec
CPU 2: lockunshare cacheline: 4041791 usec
CPU 0: lockunshare cacheline: 4041832 usec
[root@virtlab16 testring]#
[root@virtlab16 testring]#
[root@virtlab16 testring]#
[root@virtlab16 testring]# sh run 0 1
CPU 1: share cacheline: 8306326 usec
CPU 0: share cacheline: 8306324 usec
CPU 0: unshare cacheline: 19571697 usec
CPU 1: unshare cacheline: 19571578 usec
CPU 0: lockshare cacheline: 11281566 usec
CPU 1: lockshare cacheline: 11281424 usec
CPU 0: lockunshare cacheline: 11276093 usec
CPU 1: lockunshare cacheline: 11275957 usec
[root@virtlab16 testring]# sh run 0 3
CPU 0: share cacheline: 8288335 usec
CPU 3: share cacheline: 8288334 usec
CPU 0: unshare cacheline: 19107202 usec
CPU 3: unshare cacheline: 19107139 usec
CPU 0: lockshare cacheline: 11238915 usec
CPU 3: lockshare cacheline: 11238848 usec
CPU 3: lockunshare cacheline: 11132134 usec
CPU 0: lockunshare cacheline: 11132249 usec
next prev parent reply other threads:[~2010-05-23 17:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-05 20:58 [Qemu-devel] [PATCH RFC] virtio: put last seen used index into ring itself Michael S. Tsirkin
2010-05-05 21:18 ` [Qemu-devel] " Dor Laor
2010-05-06 2:31 ` Rusty Russell
2010-05-06 6:19 ` Michael S. Tsirkin
2010-05-07 3:33 ` Rusty Russell
2010-05-09 21:06 ` Michael S. Tsirkin
2010-05-06 10:00 ` [Qemu-devel] " Avi Kivity
2010-05-07 3:23 ` Rusty Russell
2010-05-11 19:27 ` Avi Kivity
2010-05-11 19:52 ` Michael S. Tsirkin
2010-05-19 7:39 ` Rusty Russell
2010-05-19 8:06 ` Avi Kivity
2010-05-19 22:33 ` Michael S. Tsirkin
2010-05-20 6:04 ` Avi Kivity
2010-05-20 5:01 ` Rusty Russell
2010-05-20 5:08 ` Rusty Russell
2010-05-23 15:31 ` Michael S. Tsirkin
2010-05-23 15:41 ` Avi Kivity
2010-05-23 15:51 ` Michael S. Tsirkin
2010-05-23 16:03 ` Avi Kivity
2010-05-23 16:30 ` Michael S. Tsirkin
2010-05-24 6:37 ` Avi Kivity
2010-05-24 8:05 ` Michael S. Tsirkin
2010-05-24 11:00 ` Avi Kivity
2010-05-23 17:28 ` Michael S. Tsirkin [this message]
2010-05-23 15:56 ` Michael S. Tsirkin
2010-05-20 7:00 ` Avi Kivity
2010-05-20 14:34 ` Rusty Russell
2010-05-20 15:46 ` Avi Kivity
2010-05-20 10:04 ` Michael S. Tsirkin
2010-05-11 18:46 ` [Qemu-devel] " Ryan Harper
2010-05-11 19:48 ` 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=20100523172821.GA14948@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
--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).