qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Glauber Costa" <glommer@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/4] VGA optimization
Date: Mon, 10 Nov 2008 18:17:02 -0200	[thread overview]
Message-ID: <5d6222a80811101217q6fb85c69oe013563107420ad3@mail.gmail.com> (raw)
In-Reply-To: <49187FC8.60107@codemonkey.ws>

On Mon, Nov 10, 2008 at 4:39 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> Glauber Costa wrote:
>>
>> hey guys,
>>
>
> I gave you some bad advice that I think is causing the breakage I'm seeing
> now.  I suggested that you simply do a lookup to find the slot given a
> target_phys_addr_t but that isn't correct.  Let me explain why.
>
> ram_addr_t represents a guest physical address.  From a ram_addr_t you can
> get a target_phys_addr_t.  Sometimes these are the same but they aren't
> always.
>
> You can have multiple ram_addr_t's pointing to the same target_phys_addr_t.
>  This is ram aliasing and it happens for a variety of reasons.  In general,
> it's pretty expensive to map a ram_addr_t to a target_phys_addr_t because,
> among other things, for a range of (ram_addr_t, size_t), you may have many
> (target_phys_addr_t, size) tuples that you have to deal with.
>
> vga_common_init() takes a target_phys_addr_t (well, it really takes an
> unsigned long, but that's a bug).  It takes this as an optimization.  It
> avoids having to do the conversion and ensures that it's one big linear
> region.
>
> For dirty tracking, we have a bitmap indexed by target_phys_addr_t in QEMU.
>  This means that we can happily set dirty bits based on
> target_phys_addr_t's.  We don't have to worry about what ram_addr_t it came
> from because they all map to the same bits.
>
> Since KVM uses a slot API, and that API is indexed in ram_addr_t's, we need
> to enable dirty tracking on the ram_addr_t's.  We don't have a ram_addr_t in
> the VGA code.
>
> The solution is pretty simple.  We need to keep track of the ram_addr_t's in
> the VGA code and enable dirty tracking on the appropriate ram_addr_ts.
>
> Regards,

My proposal is to let kvm interface to be:
void kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
target_phys_addr_t end_addr,
                                    ram_addr_t phys_offset)

to match, qemu then becomes:
void cpu_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
target_phys_addr_t end_addr,
                                    ram_addr_t phys_offset)

the caller does:

cpu_physical_sync_dirty_bitmap(s->map_addr, s->map_end, s->vram_offset);

This way, we tell kvm which particular area of the phys_ram_bitmap to
fill. I liked this
interface, because then we can have the behaviour of not synchronizing
back those bits
into qemu, by passing NULL as the third parameter.

I have a working version of it, will send shortly.




> Anthony Liguori
>
>> I hope this is the last version (Of course, once this is merged,
>> the optimizations of the optimization can start ;-) )
>>
>> I split it in 4 patches. The first two ones are just moving
>> things out of the way, and then #3 and #4 do the real thing.
>> #3 kvm-side, #4 overall qemu.
>>
>> They merge most of the suggestion Anthony and Stefano's sent
>> on last iteration.
>>
>> Hope you like it.
>>
>>
>>
>>
>
>
>
>



-- 
Glauber  Costa.
"Free as in Freedom"
http://glommer.net

"The less confident you are, the more serious you have to act."

  parent reply	other threads:[~2008-11-10 20:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-10 18:37 [Qemu-devel] [PATCH 0/4] VGA optimization Glauber Costa
2008-11-10 16:44 ` Glauber Costa
2008-11-10 18:37 ` [Qemu-devel] [PATCH] move vga_io_address to VGA State Glauber Costa
2008-11-10 18:37   ` [Qemu-devel] [PATCH] de-register mem region for MMIO Glauber Costa
2008-11-10 18:37     ` [Qemu-devel] [PATCH] Introduce kvm logging interface Glauber Costa
2008-11-10 17:15       ` Anthony Liguori
2008-11-10 17:24       ` Anthony Liguori
2008-11-10 18:37       ` [Qemu-devel] [PATCH] vga optimization Glauber Costa
2008-11-10 18:39 ` [Qemu-devel] [PATCH 0/4] VGA optimization Anthony Liguori
2008-11-10 18:47   ` Anthony Liguori
2008-11-10 18:50     ` Glauber Costa
2008-11-10 20:17   ` Glauber Costa [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-11-24 18:17 Glauber Costa
2008-11-24 20:02 ` 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=5d6222a80811101217q6fb85c69oe013563107420ad3@mail.gmail.com \
    --to=glommer@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 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).