public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Ming Lei <ming.lei@canonical.com>, Rusty Russell <rusty@rustcorp.com.au>
Cc: Jens Axboe <axboe@kernel.dk>,
	virtualization@lists.linux-foundation.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH] block: virtio_blk: don't hold spin lock during world switch
Date: Wed, 11 Jun 2014 16:44:31 +0200	[thread overview]
Message-ID: <53986B4F.9000106@redhat.com> (raw)
In-Reply-To: <CACVXFVN9aBrdmeAQJ6YadF_6grSjm9raiLV1=eUMAL20uUeeCw@mail.gmail.com>

Il 02/06/2014 15:06, Ming Lei ha scritto:
>> >
>> > If you're running SMP under an emulator where exits are expensive, then
>> > this wins.  Under KVM it's marginal at best.
> Both my tests on arm64 and x86 are under KVM, and looks the
> patch can improve performance a lot. IMO, even though under
> KVM, virtio-blk performance still depends how well hypervisor(
> qemu, ...) emulates the device, and basically speaking, it is
> expensive to switch from guest to host and let host handle the
> notification.

The difference is that virtio-pci supports ioeventfd and virtio-mmio 
doesn't.

With ioeventfd you can tell KVM "I don't care about the value that is 
written to a memory location, only that it is accessed".  Then when the 
write happens, KVM doesn't do an expensive userspace exit; it just 
writes 1 to an eventfd.

It then returns to the guest, userspace picks up the eventfd via its 
poll() loop and services the device.

This is already useful for throughput on UP, and the small latency cost 
(because of the cost of the event loop in the I/O thread, and possibly 
the cost of waking up the thread) is usually offset by the benefit.

But on SMP you get double benefit.  Obviously, the kernel doesn't have 
to spin while userspace does its stuff.  On top of this, there is also a 
latency improvement from ioeventfd, because QEMU processes 
virtqueue_notify under its "big QEMU lock".  With ioeventfd, serialized 
virtqueue processing can be a bottleneck, but it doesn't affect latency. 
  Without ioeventfd it affects the VCPUs' latency and negates a lot of 
the benefit of Ming Lei's patch.

You can try disabling ioeventfd with "-global 
virtio-blk-pci.ioeventfd=off" on the QEMU command line.  Performance 
will plummet. :)

Paolo

  reply	other threads:[~2014-06-11 14:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30  2:49 [PATCH] block: virtio_blk: don't hold spin lock during world switch Ming Lei
2014-05-30  3:19 ` Jens Axboe
2014-05-30  3:34   ` Ming Lei
2014-05-30  3:35     ` Jens Axboe
2014-05-30  5:58       ` Ming Lei
2014-05-30  6:10       ` Rusty Russell
2014-05-30 13:52         ` Jens Axboe
2014-06-02  1:23           ` Rusty Russell
2014-06-02 13:06             ` Ming Lei
2014-06-11 14:44               ` Paolo Bonzini [this message]
2014-06-02 14:15             ` Jens Axboe
2014-05-30  6:05 ` Rusty Russell
2014-05-30 15:27 ` 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=53986B4F.9000106@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    --cc=mst@redhat.com \
    --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