qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: KQEMU code organization
Date: Mon, 02 Jun 2008 08:25:58 -0500	[thread overview]
Message-ID: <4843F4E6.1090003@codemonkey.ws> (raw)
In-Reply-To: <4843B711.7090304@bellard.org>

Fabrice Bellard wrote:
>> This is for device emulation.  KVM doesn't use l1_phys_map() for 
>> things like shadow page table accesses.
>>
>> In the device emulation, we're currently using stl_phys() and 
>> friends.  This goes through a full lookup in l1_phys_map.
>>
>> Looking at other devices, some use phys_ram_base + PA and stl_raw() 
>> which is broken but faster.  A few places call 
>> cpu_get_physical_page_desc(), then use phys_ram_base and stl_raw().  
>> This is okay but it still requires at least one l1_phys_map lookup 
>> per operation in the device (packet receive, io notification, etc.).  
>> I don't think that's going to help much because in our fast paths, 
>> we're only doing 2 or 3 stl_phys() operations.
>>
>> At least on x86, there are very few regions of RAM.  That makes it 
>> very easy to cache.  A TLB style cache seems wrong to me because 
>> there are so few RAM regions.  I don't see a better way to do this 
>> with the existing APIs.
>
> I see your point. st/ldx_phys() were never optimized in fact.
>
> A first solution would be to use a cache similar to the TLBs. It has 
> the advantage is being quite generic and fast. Another solution would 
> be to compute a few intervals with are tested before the generic case. 
> These intervals would correspond to the main RAM area and would be 
> updated each time a new device region is registered.

I currently have a patch that takes the later approach.

> Does your remark implies that KVM switches back to the QEMU process 
> for each I/O ? If so, the l1_phys_map access time should be negligible 
> compared to the SVM-VMX/kernel/user context switch !

Most MMIO/PIO cause an exit to QEMU.  We run the main loop in an 
dedicated thread though so packet delivery is handled without forcing a 
VCPU to exit.

Regards,

Anthony Liguori

> Fabrice.
>
>
>

  reply	other threads:[~2008-06-02 13:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-27 16:56 [Qemu-devel] KQEMU code organization Jan Kiszka
2008-05-27 17:20 ` Ben Taylor
2008-05-27 18:25   ` [Qemu-devel] " Jan Kiszka
2008-05-27 20:58 ` [Qemu-devel] " Fabrice Bellard
2008-05-27 21:40   ` [Qemu-devel] " Jan Kiszka
2008-05-27 22:11 ` [Qemu-devel] " Fabrice Bellard
2008-05-28 16:02   ` [Qemu-devel] " Jan Kiszka
2008-05-28 16:37     ` Fabrice Bellard
2008-05-28 16:55       ` Jan Kiszka
2008-05-28 18:34         ` Jan Kiszka
2008-05-29 12:29         ` Fabrice Bellard
2008-05-29 13:16           ` Jan Kiszka
2008-05-29 16:13           ` Jamie Lokier
2008-05-29 16:26             ` Paul Brook
2008-05-29 16:35               ` Jamie Lokier
2008-05-29 17:43                 ` Anthony Liguori
2008-05-29 21:46                   ` Fabrice Bellard
2008-05-30  3:32                     ` Mulyadi Santosa
2008-05-30  8:14                       ` Andreas Färber
2008-05-29 16:26             ` Anthony Liguori
2008-05-29 16:53               ` Jan Kiszka
2008-05-29 17:48                 ` Anthony Liguori
2008-05-31 10:18                 ` Avi Kivity
2008-06-02 16:34                   ` Jamie Lokier
2008-05-29 21:52               ` Fabrice Bellard
2008-05-31 10:06                 ` Avi Kivity
2008-06-01 22:58                 ` Anthony Liguori
2008-06-02  9:02                   ` Fabrice Bellard
2008-06-02 13:25                     ` Anthony Liguori [this message]
2008-05-29 16:48             ` Jan Kiszka
2008-05-29 17:47               ` Anthony Liguori

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=4843F4E6.1090003@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --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 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).