qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 0/6] Bypass tcg memory functions -v1.0-2009
Date: Mon, 26 Jan 2009 14:42:39 -0600	[thread overview]
Message-ID: <497E203F.7090909@codemonkey.ws> (raw)
In-Reply-To: <200901220011.18142.paul@codesourcery.com>

Paul Brook wrote:
> On Wednesday 21 January 2009, Ian Jackson wrote:
>   
>>> In all my laziness I agree that we should not be duplicating
>>> things. Hence why, for example, I tried to commonize the I/O
>>> functions: which are the same. (and I see no benefit in changing the
>>> way KVM keeps track of I/O regions in the near future)
>>>       
>> I think the KVM and Xen approaches are probably similar enough that we
>> can share this code.  I'll have to look at it in detail at some point,
>> which I don't have time to do right now or necessarily even soon.
>>     
>
> I don't see a reason why these need to be different. They're all doing 
> basically the same thing. The low level implementation details ara a bit 
> different, but in principle kvm, xen and tcg all need to to exactly the same 
> thing: Figure out what a particular physical address is mapped to.
>   

That's a bit of a simplification.  TCG needs a fair bit more than what 
KVM and Xen needs.  TCG needs to keep track of any write operations to 
memory that could possibly be translated to flush the translation 
caches.  TCG also maintains a software TLB and therefore is going to 
have a different set of sensitivities to the performance characteristics 
of RAM lookup since the performance overhead occurs on every software 
TLB miss.

Conversely, KVM needs to only keep track of MMIO regions since the 
kernel tracks RAM regions.  There is no software TLB so the cost of a 
TLB miss is neglible.  There is no concern about icache flushing because 
the hardware will take care of this.

That said, it may be possible to develop a unified implementation.  
However, it has been expressed previously (by Fabrice, among others) 
that there is a desire to decouple the CPU execution code (be it TCG or 
KVM) from the rest of QEMU so that you could even plug-in new CPU 
emulators rather easily.  That is what this patch series is doing 
primarily, establishing that interface.

> As discussed previously, l1_phys_map is not a good solution, and needs to go 
> away. Anypatch that involves independent code paths for kvm and tcg 
> because "the tcg code doesn't work for kvm" sounds a lot like lazyness. The 
> real solution is to fix the current implementation rather than adding a new 
> one.
>   

Laziness is distinctly different from incremental development.  We know 
this code will do well for KVM, so let's use it for KVM and iron out any 
problems.  After someone has done the work of doing performance 
measurement on the TCG code and adjusting the slot code so that it can 
be hooked appropriate for TCG, we can convert TCG to using it, if 
appropriate.

At the end of the day, we're talking about 200-300 lines of code.  I'm 
not hugely concerned that we're duplicating code within QEMU.

Regards,

Anthony Liguori

> Paul
>
>
>   

  parent reply	other threads:[~2009-01-26 20:43 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 18:50 [Qemu-devel] [PATCH 0/6] Bypass tcg memory functions -v1.0-2009 Glauber Costa
2009-01-20 18:51 ` [Qemu-devel] [PATCH 1/6] remove smaller slots if registering a bigger one Glauber Costa
2009-01-20 18:51   ` [Qemu-devel] [PATCH 2/6] re-register whole area upon lfb unmap Glauber Costa
2009-01-20 18:51     ` [Qemu-devel] [PATCH 3/6] isolate io handling routine Glauber Costa
2009-01-20 18:51       ` [Qemu-devel] [PATCH 4/6] replace cpu_physical_memory_rw Glauber Costa
2009-01-20 18:51         ` [Qemu-devel] [PATCH 5/6] hook cpu_register_physical_mem Glauber Costa
2009-01-20 18:51           ` [Qemu-devel] [PATCH 6/6] cache slot lookup Glauber Costa
2009-01-20 20:24         ` [Qemu-devel] [PATCH 4/6] replace cpu_physical_memory_rw Avi Kivity
2009-01-20 20:33           ` Glauber Costa
2009-01-21  5:43 ` [Qemu-devel] [PATCH 0/6] Bypass tcg memory functions -v1.0-2009 Paul Brook
2009-01-21 11:46   ` Glauber Costa
2009-01-21 17:16     ` Ian Jackson
2009-01-21 18:40       ` Glauber Costa
2009-01-22  0:11       ` Paul Brook
2009-01-22 14:02         ` Glauber Costa
2009-01-26 20:42         ` Anthony Liguori [this message]
2009-01-21 19:26   ` 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=497E203F.7090909@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=paul@codesourcery.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).