All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@minantech.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Avi Kivity <avi@cloudius-systems.com>,
	"Zhanghaoyu (A)" <haoyu.zhang@huawei.com>,
	Gleb Natapov <gleb@redhat.com>, Avi Kivity <avi.kivity@gmail.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	KVM <kvm@vger.kernel.org>, "Michael S. Tsirkin" <mst@redhat.com>,
	"Jinxin (F)" <jinxin712@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Zanghongyong <zanghongyong@huawei.com>
Subject: Re: [Qemu-devel] [RFC] create a single workqueue for each vm to update vm irq routing table
Date: Thu, 28 Nov 2013 13:09:15 +0200	[thread overview]
Message-ID: <20131128110915.GD5822@minantech.com> (raw)
In-Reply-To: <52971D86.60601@redhat.com>

On Thu, Nov 28, 2013 at 11:40:06AM +0100, Paolo Bonzini wrote:
> Il 28/11/2013 11:16, Avi Kivity ha scritto:
> >> The QRCU I linked would work great latency-wise (it has roughly the same
> >> latency of an rwsem but readers are lock-free).  However, the locked
> >> operations in the read path would hurt because of cache misses, so it's
> >> not good either.
> > 
> > I guess srcu would work.  Do you know what's the typical write-side
> > latency there? (in terms of what it waits for, not nanoseconds).
> 
> If there's no concurrent reader, it's zero if I read the code right.
> Otherwise it depends:
> 
> - if there are many callbacks, only 10 of them are processed per
> millisecond.  But unless there are concurrent synchronize_srcu calls
> there should not be any callback at all.  If all VCPUs were to furiously
> change the MSIs, the latency could go up to #vcpu/10 milliseconds.
> 
> - if there are no callbacks, but there are readers, synchronize_srcu
> busy-loops for some time checking if the readers complete.  After a
> while (20 us for synchronize_srcu, 120 us for
> synchronize_srcu_expedited) it gives up and starts using a workqueue to
> poll every millisecond.  This should never happen unless
> 
Unless what ? :) Unless reader is scheduled out?

> So, given the very restricted usage this SRCU would have, we probably
> can expect synchronize_srcu_expedited to finish its job in the
> busy-looping phase, and 120 us should be the expected maximum
> latency---more likely to be an order of magnitude smaller, and in very
> rare cases higher.
> 
> Paolo

--
			Gleb.

WARNING: multiple messages have this Message-ID (diff)
From: Gleb Natapov <gleb@minantech.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Avi Kivity <avi@cloudius-systems.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	Gleb Natapov <gleb@redhat.com>, KVM <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Zhanghaoyu (A)" <haoyu.zhang@huawei.com>,
	Luonengjun <luonengjun@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Zanghongyong <zanghongyong@huawei.com>,
	Avi Kivity <avi.kivity@gmail.com>,
	"Jinxin (F)" <jinxin712@huawei.com>
Subject: Re: [Qemu-devel] [RFC] create a single workqueue for each vm to update vm irq routing table
Date: Thu, 28 Nov 2013 13:09:15 +0200	[thread overview]
Message-ID: <20131128110915.GD5822@minantech.com> (raw)
In-Reply-To: <52971D86.60601@redhat.com>

On Thu, Nov 28, 2013 at 11:40:06AM +0100, Paolo Bonzini wrote:
> Il 28/11/2013 11:16, Avi Kivity ha scritto:
> >> The QRCU I linked would work great latency-wise (it has roughly the same
> >> latency of an rwsem but readers are lock-free).  However, the locked
> >> operations in the read path would hurt because of cache misses, so it's
> >> not good either.
> > 
> > I guess srcu would work.  Do you know what's the typical write-side
> > latency there? (in terms of what it waits for, not nanoseconds).
> 
> If there's no concurrent reader, it's zero if I read the code right.
> Otherwise it depends:
> 
> - if there are many callbacks, only 10 of them are processed per
> millisecond.  But unless there are concurrent synchronize_srcu calls
> there should not be any callback at all.  If all VCPUs were to furiously
> change the MSIs, the latency could go up to #vcpu/10 milliseconds.
> 
> - if there are no callbacks, but there are readers, synchronize_srcu
> busy-loops for some time checking if the readers complete.  After a
> while (20 us for synchronize_srcu, 120 us for
> synchronize_srcu_expedited) it gives up and starts using a workqueue to
> poll every millisecond.  This should never happen unless
> 
Unless what ? :) Unless reader is scheduled out?

> So, given the very restricted usage this SRCU would have, we probably
> can expect synchronize_srcu_expedited to finish its job in the
> busy-looping phase, and 120 us should be the expected maximum
> latency---more likely to be an order of magnitude smaller, and in very
> rare cases higher.
> 
> Paolo

--
			Gleb.

  parent reply	other threads:[~2013-11-28 11:09 UTC|newest]

Thread overview: 120+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 12:40 [RFC] create a single workqueue for each vm to update vm irq routing table Zhanghaoyu (A)
2013-11-26 12:40 ` [Qemu-devel] " Zhanghaoyu (A)
2013-11-26 12:47 ` Paolo Bonzini
2013-11-26 12:47   ` [Qemu-devel] " Paolo Bonzini
2013-11-26 12:56   ` Gleb Natapov
2013-11-26 12:56     ` [Qemu-devel] " Gleb Natapov
2013-11-26 13:13     ` Paolo Bonzini
2013-11-26 13:13       ` [Qemu-devel] " Paolo Bonzini
2013-11-28  3:46       ` Zhanghaoyu (A)
2013-11-28  3:46         ` [Qemu-devel] " Zhanghaoyu (A)
2013-11-26 16:05     ` Michael S. Tsirkin
2013-11-26 16:05       ` [Qemu-devel] " Michael S. Tsirkin
2013-11-26 16:14       ` Gleb Natapov
2013-11-26 16:14         ` [Qemu-devel] " Gleb Natapov
2013-11-26 16:24         ` Michael S. Tsirkin
2013-11-26 16:24           ` [Qemu-devel] " Michael S. Tsirkin
2013-11-30  2:46           ` Zhanghaoyu (A)
2013-11-30  2:46             ` [Qemu-devel] " Zhanghaoyu (A)
2013-11-26 13:18   ` Avi Kivity
2013-11-26 13:18     ` [Qemu-devel] " Avi Kivity
2013-11-26 13:47     ` Paolo Bonzini
2013-11-26 13:47       ` [Qemu-devel] " Paolo Bonzini
2013-11-26 14:36       ` Avi Kivity
2013-11-26 14:36         ` [Qemu-devel] " Avi Kivity
2013-11-26 14:46         ` Paolo Bonzini
2013-11-26 14:46           ` Paolo Bonzini
2013-11-26 14:54           ` Avi Kivity
2013-11-26 14:54             ` Avi Kivity
2013-11-26 15:03             ` Gleb Natapov
2013-11-26 15:03               ` Gleb Natapov
2013-11-26 15:20               ` Paolo Bonzini
2013-11-26 15:20                 ` Paolo Bonzini
2013-11-26 15:25                 ` Avi Kivity
2013-11-26 15:25                   ` Avi Kivity
2013-11-26 15:28                   ` Paolo Bonzini
2013-11-26 15:28                     ` Paolo Bonzini
2013-11-26 15:35                     ` Avi Kivity
2013-11-26 15:35                       ` Avi Kivity
2013-11-26 15:58                       ` Paolo Bonzini
2013-11-26 15:58                         ` Paolo Bonzini
2013-11-26 16:06                         ` Avi Kivity
2013-11-26 16:06                           ` Avi Kivity
2013-11-26 16:11                           ` Michael S. Tsirkin
2013-11-26 16:11                             ` Michael S. Tsirkin
2013-11-26 16:21                             ` Avi Kivity
2013-11-26 16:21                               ` Avi Kivity
2013-11-26 16:42                               ` Paolo Bonzini
2013-11-26 16:42                                 ` Paolo Bonzini
2013-11-26 16:08                         ` Michael S. Tsirkin
2013-11-26 16:08                           ` Michael S. Tsirkin
2013-11-26 16:24                 ` Gleb Natapov
2013-11-26 16:24                   ` Gleb Natapov
2013-11-26 16:27                   ` Avi Kivity
2013-11-26 16:27                     ` Avi Kivity
2013-11-26 16:38                     ` Gleb Natapov
2013-11-26 16:38                       ` Gleb Natapov
2013-11-26 16:28                   ` Paolo Bonzini
2013-11-26 16:28                     ` Paolo Bonzini
2013-11-26 16:29                     ` Avi Kivity
2013-11-26 16:29                       ` Avi Kivity
2013-11-26 16:37                     ` Gleb Natapov
2013-11-26 16:37                       ` Gleb Natapov
2013-11-28  6:27                 ` Zhanghaoyu (A)
2013-11-28  6:27                   ` Zhanghaoyu (A)
2013-11-28  8:55                   ` Paolo Bonzini
2013-11-28  8:55                     ` Paolo Bonzini
2013-11-28  9:19                     ` Gleb Natapov
2013-11-28  9:19                       ` Gleb Natapov
2013-11-28  9:29                       ` Paolo Bonzini
2013-11-28  9:29                         ` Paolo Bonzini
2013-11-28  9:43                         ` Gleb Natapov
2013-11-28  9:43                           ` Gleb Natapov
2013-11-28  9:49                       ` Avi Kivity
2013-11-28  9:49                         ` Avi Kivity
2013-11-28  9:53                         ` Paolo Bonzini
2013-11-28  9:53                           ` Paolo Bonzini
2013-11-28 10:16                           ` Avi Kivity
2013-11-28 10:16                             ` Avi Kivity
2013-11-28 10:40                             ` Paolo Bonzini
2013-11-28 10:40                               ` Paolo Bonzini
2013-11-28 10:47                               ` Avi Kivity
2013-11-28 10:47                                 ` Avi Kivity
2013-11-28 11:09                               ` Gleb Natapov [this message]
2013-11-28 11:09                                 ` Gleb Natapov
2013-11-28 11:10                                 ` Paolo Bonzini
2013-11-28 11:10                                   ` Paolo Bonzini
2013-11-28 11:16                                   ` Avi Kivity
2013-11-28 11:16                                     ` Avi Kivity
2013-11-28 11:23                                   ` Gleb Natapov
2013-11-28 11:23                                     ` Gleb Natapov
2013-11-28 11:31                                     ` Paolo Bonzini
2013-11-28 11:31                                       ` Paolo Bonzini
2013-11-28 11:33                                       ` Avi Kivity
2013-11-28 11:33                                         ` Avi Kivity
2013-11-28 10:11                         ` Gleb Natapov
2013-11-28 10:11                           ` Gleb Natapov
2013-11-28 10:12                           ` Avi Kivity
2013-11-28 10:12                             ` Avi Kivity
2013-11-28 11:02                             ` Gleb Natapov
2013-11-28 11:02                               ` Gleb Natapov
2013-11-28 11:18                               ` Avi Kivity
2013-11-28 11:18                                 ` Avi Kivity
2013-11-28 11:22                                 ` Gleb Natapov
2013-11-28 11:22                                   ` Gleb Natapov
2013-11-28 11:30                                   ` Avi Kivity
2013-11-28 11:30                                     ` [Qemu-devel] " Avi Kivity
2013-11-28 11:33                                   ` Michael S. Tsirkin
2013-11-28 11:33                                     ` Michael S. Tsirkin
2013-11-28 11:33                                     ` Gleb Natapov
2013-11-28 11:33                                       ` Gleb Natapov
2013-11-26 15:24               ` Avi Kivity
2013-11-26 15:24                 ` Avi Kivity
2013-11-28  9:14                 ` Zhanghaoyu (A)
2013-11-28  9:14                   ` Zhanghaoyu (A)
2013-11-28  9:20                   ` Gleb Natapov
2013-11-28  9:20                     ` Gleb Natapov
2013-11-26 12:48 ` Gleb Natapov
2013-11-26 12:48   ` [Qemu-devel] " Gleb Natapov
2013-11-26 12:50   ` Gleb Natapov
2013-11-26 12:50     ` [Qemu-devel] " Gleb Natapov

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=20131128110915.GD5822@minantech.com \
    --to=gleb@minantech.com \
    --cc=avi.kivity@gmail.com \
    --cc=avi@cloudius-systems.com \
    --cc=gleb@redhat.com \
    --cc=haoyu.zhang@huawei.com \
    --cc=jinxin712@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=weidong.huang@huawei.com \
    --cc=zanghongyong@huawei.com \
    /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.