From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxMC8-0001eW-95 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxMC6-0001dn-Cv for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:43 -0500 Received: from [199.232.76.173] (port=50115 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxMC6-0001dY-7a for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:42 -0500 Received: from wf-out-1314.google.com ([209.85.200.168]:56399) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KxMC5-0001Ac-N3 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 08:43:42 -0500 Received: by wf-out-1314.google.com with SMTP id 27so3206209wfd.4 for ; Tue, 04 Nov 2008 05:43:39 -0800 (PST) Message-ID: <5d6222a80811040543w64567ce8ub33e911943679b26@mail.gmail.com> Date: Tue, 4 Nov 2008 11:43:38 -0200 From: "Glauber Costa" Subject: Re: [Qemu-devel] vga optmization In-Reply-To: <491034BC.2050806@eu.citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20081103173111.GC30410@poweredge.glommer> <491034BC.2050806@eu.citrix.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Glauber Costa , aliguori@us.ibm.com On Tue, Nov 4, 2008 at 9:40 AM, Stefano Stabellini wrote: > andrzej zaborowski wrote: > >> Hi, >> >> 2008/11/3 Glauber Costa : >> [...] >>> diff --git a/cpu-all.h b/cpu-all.h >>> index cdd79bc..9118f4d 100644 >>> --- a/cpu-all.h >>> +++ b/cpu-all.h >>> @@ -46,6 +46,8 @@ >>> >>> #ifdef BSWAP_NEEDED >>> >>> +#include "kvm.h" >>> + >>> static inline uint16_t tswap16(uint16_t s) >>> { >>> return bswap16(s); >>> @@ -909,17 +911,10 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr, >>> #define KQEMU_DIRTY_FLAG 0x04 >>> #define MIGRATION_DIRTY_FLAG 0x08 >>> >>> -/* read dirty bit (return 0 or 1) */ >>> -static inline int cpu_physical_memory_is_dirty(ram_addr_t addr) >>> -{ >>> - return phys_ram_dirty[addr >> TARGET_PAGE_BITS] == 0xff; >>> -} >>> +int cpu_physical_memory_get_dirty(ram_addr_t addr, int dirty_flags); >>> +int cpu_physical_memory_is_dirty(ram_addr_t addr); >>> >>> -static inline int cpu_physical_memory_get_dirty(ram_addr_t addr, >>> - int dirty_flags) >>> -{ >>> - return phys_ram_dirty[addr >> TARGET_PAGE_BITS] & dirty_flags; >>> -} >>> +void qemu_physical_sync_dirty_bitmap(ram_addr_t start_addr); >> >> This will prevent the functions from being inlined even if KVM is >> disabled (e.g. on other archs) and I think it could be easily >> retained. >> > > > I agree on this. > >> void qemu_physical_sync_dirty_bitmap(ram_addr_t start_addr) >> { >> if (kvm_enabled()) >> kvm_physical_sync_dirty_bitmap(start_addr); >> } >> > > > Why don't you make qemu_physical_sync_dirty_bitmap take also and end > address, and you merge the two bitmaps in this address range in this > function, so you don't have to change cpu_physical_memory_get_dirty at > all? > > I am saying to do something like: > > void qemu_physical_sync_dirty_bitmap(ram_addr_t start_addr, ram_addr_t end_addr) > { > /* sync and merge the two bitmaps between start_addr and end_addr */ > } > > then leave cpu_physical_memory_get_dirty untouched. > I would prefer this approch, it also leaves more space to other > optimizations. Either way works for me. I'm fine with your suggestion. > > > -- Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."