All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>, Muli Ben-Yehuda <muli@il.ibm.com>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	qemu-devel@nongnu.org, aliguori@us.ibm.com, kvm@vger.kernel.org,
	jan.kiszka@siemens.com, agraf@suse.de, agl@us.ibm.com,
	Nadav Amit <nadav.amit@gmail.com>,
	Ben-Ami Yassour1 <benami@il.ibm.com>
Subject: Re: [Qemu-devel] Ideas wiki for GSoC 2010
Date: Mon, 15 Mar 2010 20:21:54 -0500	[thread overview]
Message-ID: <4B9EDD32.10505@codemonkey.ws> (raw)
In-Reply-To: <4B9E4D11.70402@redhat.com>

On 03/15/2010 10:06 AM, Avi Kivity wrote:
> On 03/15/2010 03:23 PM, Anthony Liguori wrote:
>> On 03/15/2010 08:11 AM, Avi Kivity wrote:
>>> On 03/15/2010 03:03 PM, Joerg Roedel wrote:
>>>>
>>>>>> I will add another project - iommu emulation.  Could be very useful
>>>>>> for doing device assignment to nested guests, which could make
>>>>>> testing a lot easier.
>>>>> Our experiments show that nested device assignment is pretty much
>>>>> required for I/O performance in nested scenarios.
>>>> Really? I did a small test with virtio-blk in a nested guest (disk 
>>>> read
>>>> with dd, so not a real benchmark) and got a reasonable 
>>>> read-performance
>>>> of around 25MB/s from the disk in the l2-guest.
>>>>
>>>
>>> Your guest wasn't doing a zillion VMREADs and VMWRITEs every exit.
>>>
>>> I plan to reduce VMREAD/VMWRITE overhead for kvm, but not much we 
>>> can do for other guests.
>>
>> VMREAD/VMWRITEs are generally optimized by hypervisors as they tend 
>> to be costly.  KVM is a bit unusual in terms of how many times the 
>> instructions are executed per exit.
>
> Do you know offhand of any unnecessary read/writes?  There's 
> update_cr8_intercept(), but on normal exits, I don't see what else we 
> can remove.

Yeah, there are a number of examples.

vmcs_clear_bits() and vmcs_set_bits() read a field of the VMCS and then 
immediately writes it.  This is unnecessary as the same information 
could be kept in a shadow variable.  In vmx_fpu_activate, we call 
vmcs_clear_bits() followed immediately by vmcs_set_bits(). which means 
we're reading GUEST_CR0 twice and writing it twice.

vmx_get_rflags() reads from the VMCS and we frequently call get_rflags() 
followed by a set_rflags() to update a bit.  We also don't cache the 
value between calls and there's a few spots in the code that make 
multiple calls.

Regards,

Anthony Liguori


WARNING: multiple messages have this Message-ID (diff)
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>,
	agraf@suse.de, aliguori@us.ibm.com, kvm@vger.kernel.org,
	jan.kiszka@siemens.com, Joerg Roedel <joro@8bytes.org>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	agl@us.ibm.com, Nadav Amit <nadav.amit@gmail.com>,
	Ben-Ami Yassour1 <benami@il.ibm.com>
Subject: Re: [Qemu-devel] Ideas wiki for GSoC 2010
Date: Mon, 15 Mar 2010 20:21:54 -0500	[thread overview]
Message-ID: <4B9EDD32.10505@codemonkey.ws> (raw)
In-Reply-To: <4B9E4D11.70402@redhat.com>

On 03/15/2010 10:06 AM, Avi Kivity wrote:
> On 03/15/2010 03:23 PM, Anthony Liguori wrote:
>> On 03/15/2010 08:11 AM, Avi Kivity wrote:
>>> On 03/15/2010 03:03 PM, Joerg Roedel wrote:
>>>>
>>>>>> I will add another project - iommu emulation.  Could be very useful
>>>>>> for doing device assignment to nested guests, which could make
>>>>>> testing a lot easier.
>>>>> Our experiments show that nested device assignment is pretty much
>>>>> required for I/O performance in nested scenarios.
>>>> Really? I did a small test with virtio-blk in a nested guest (disk 
>>>> read
>>>> with dd, so not a real benchmark) and got a reasonable 
>>>> read-performance
>>>> of around 25MB/s from the disk in the l2-guest.
>>>>
>>>
>>> Your guest wasn't doing a zillion VMREADs and VMWRITEs every exit.
>>>
>>> I plan to reduce VMREAD/VMWRITE overhead for kvm, but not much we 
>>> can do for other guests.
>>
>> VMREAD/VMWRITEs are generally optimized by hypervisors as they tend 
>> to be costly.  KVM is a bit unusual in terms of how many times the 
>> instructions are executed per exit.
>
> Do you know offhand of any unnecessary read/writes?  There's 
> update_cr8_intercept(), but on normal exits, I don't see what else we 
> can remove.

Yeah, there are a number of examples.

vmcs_clear_bits() and vmcs_set_bits() read a field of the VMCS and then 
immediately writes it.  This is unnecessary as the same information 
could be kept in a shadow variable.  In vmx_fpu_activate, we call 
vmcs_clear_bits() followed immediately by vmcs_set_bits(). which means 
we're reading GUEST_CR0 twice and writing it twice.

vmx_get_rflags() reads from the VMCS and we frequently call get_rflags() 
followed by a set_rflags() to update a bit.  We also don't cache the 
value between calls and there's a few spots in the code that make 
multiple calls.

Regards,

Anthony Liguori

  parent reply	other threads:[~2010-03-16  1:21 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 21:30 Ideas wiki for GSoC 2010 Luiz Capitulino
2010-03-10 21:30 ` [Qemu-devel] " Luiz Capitulino
2010-03-11  7:55 ` Avi Kivity
2010-03-11  7:55   ` [Qemu-devel] " Avi Kivity
2010-03-11  9:43   ` Paolo Bonzini
2010-03-11  9:43     ` [Qemu-devel] " Paolo Bonzini
2010-03-11 11:25     ` Alexander Graf
2010-03-11 11:25       ` [Qemu-devel] " Alexander Graf
2010-03-11 11:54       ` Avi Kivity
2010-03-11 11:54         ` [Qemu-devel] " Avi Kivity
2010-03-11 11:56         ` Alexander Graf
2010-03-11 11:56           ` [Qemu-devel] " Alexander Graf
2010-03-11 11:58           ` Avi Kivity
2010-03-11 11:58             ` [Qemu-devel] " Avi Kivity
2010-03-11 12:03             ` Alexander Graf
2010-03-11 12:03               ` [Qemu-devel] " Alexander Graf
2010-03-11 12:15               ` Avi Kivity
2010-03-11 12:15                 ` [Qemu-devel] " Avi Kivity
2010-03-12 10:49                 ` [Android-virt] " Christoffer Dall
2010-03-12 10:49                   ` [Qemu-devel] " Christoffer Dall
2010-03-12 12:32                   ` Luiz Capitulino
2010-03-12 12:32                     ` [Qemu-devel] " Luiz Capitulino
2010-03-11 19:06               ` [Qemu-devel] " Cam Macdonell
2010-03-11 19:06                 ` Cam Macdonell
2010-03-11 12:09       ` Paolo Bonzini
2010-03-11 12:09         ` [Qemu-devel] " Paolo Bonzini
2010-03-11 13:19         ` Luiz Capitulino
2010-03-11 13:19           ` [Qemu-devel] " Luiz Capitulino
2010-03-13  3:13           ` Edgar E. Iglesias
2010-03-13  3:13             ` Edgar E. Iglesias
2010-03-11 13:16       ` Luiz Capitulino
2010-03-11 13:16         ` [Qemu-devel] " Luiz Capitulino
2010-03-12 10:47       ` Jes Sorensen
2010-03-12 10:47         ` Jes Sorensen
2010-03-11 12:59     ` Luiz Capitulino
2010-03-11 12:59       ` [Qemu-devel] " Luiz Capitulino
2010-03-11 13:00       ` Alexander Graf
2010-03-11 13:00         ` [Qemu-devel] " Alexander Graf
2010-03-11 13:21         ` Luiz Capitulino
2010-03-11 13:21           ` [Qemu-devel] " Luiz Capitulino
2010-03-11 22:59   ` Jamie Lokier
2010-03-11 22:59     ` Jamie Lokier
2010-03-12  9:48     ` Paolo Bonzini
2010-03-12  9:48       ` Paolo Bonzini
2010-03-12  9:59       ` Gleb Natapov
2010-03-12  9:59         ` Gleb Natapov
2010-03-11 12:26 ` Avi Kivity
2010-03-11 12:26   ` [Qemu-devel] " Avi Kivity
2010-03-11 13:09 ` [Qemu-devel] " Lucas Meneghel Rodrigues
2010-03-11 13:09   ` Lucas Meneghel Rodrigues
2010-03-12 15:11 ` Adam Litke
2010-03-12 15:11   ` Adam Litke
2010-03-12 15:22   ` Luiz Capitulino
2010-03-12 15:22     ` Luiz Capitulino
2010-03-12 15:38     ` Adam Litke
2010-03-12 15:56       ` Luiz Capitulino
2010-03-12 16:36         ` Anthony Liguori
2010-03-12 16:36           ` Anthony Liguori
2010-03-12 17:35           ` Luiz Capitulino
2010-03-12 17:35             ` Luiz Capitulino
2010-03-15 12:25 ` Avi Kivity
2010-03-15 12:25   ` Avi Kivity
2010-03-15 12:38   ` Joerg Roedel
2010-03-15 12:38     ` Joerg Roedel
2010-03-15 12:42     ` Avi Kivity
2010-03-15 12:42       ` Avi Kivity
2010-03-15 13:14       ` Anthony Liguori
2010-03-15 13:14         ` Anthony Liguori
2010-03-15 15:59         ` Joerg Roedel
2010-03-15 15:59           ` Joerg Roedel
2010-03-15 12:53   ` Muli Ben-Yehuda
2010-03-15 12:53     ` Muli Ben-Yehuda
2010-03-15 13:03     ` Joerg Roedel
2010-03-15 13:03       ` Joerg Roedel
2010-03-15 13:11       ` Avi Kivity
2010-03-15 13:11         ` Avi Kivity
2010-03-15 13:23         ` Anthony Liguori
2010-03-15 13:23           ` Anthony Liguori
2010-03-15 15:06           ` Avi Kivity
2010-03-15 15:06             ` Avi Kivity
2010-03-16  0:20             ` Jason
2010-03-16  6:12               ` Avi Kivity
2010-03-16 16:33                 ` Jason
2010-03-16 16:46                   ` Avi Kivity
2010-03-16  1:21             ` Anthony Liguori [this message]
2010-03-16  1:21               ` Anthony Liguori
2010-03-16  5:50               ` Avi Kivity
2010-03-16  5:50                 ` Avi Kivity
2010-03-15 13:24         ` Joerg Roedel
2010-03-15 13:24           ` Joerg Roedel
2010-03-15 13:55           ` Anthony Liguori
2010-03-15 13:55             ` Anthony Liguori
2010-03-15 14:18       ` Muli Ben-Yehuda
2010-03-15 14:18         ` Muli Ben-Yehuda

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=4B9EDD32.10505@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=agl@us.ibm.com \
    --cc=agraf@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=benami@il.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=lcapitulino@redhat.com \
    --cc=muli@il.ibm.com \
    --cc=nadav.amit@gmail.com \
    --cc=qemu-devel@nongnu.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.