Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-12 Thread Peter Lieven
Am 12.05.2014 08:09, schrieb Paolo Bonzini: > Il 10/05/2014 18:32, Peter Lieven ha scritto: >> What about XEN? >> > > You're right, Xen wouldn't work. Your original patch would not break it just > because Xen doesn't use migration (but the code would be broken). > > You would have to cache qemu_g

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-11 Thread Paolo Bonzini
Il 10/05/2014 18:32, Peter Lieven ha scritto: What about XEN? You're right, Xen wouldn't work. Your original patch would not break it just because Xen doesn't use migration (but the code would be broken). You would have to cache qemu_get_ram_block rather than qemu_get_ram_ptr, move RAMBlo

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread Peter Lieven
or even this: diff --git a/include/exec/memory.h b/include/exec/memory.h index 1d55ad9..3003875 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -161,6 +161,7 @@ struct MemoryRegion { unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; NotifierList iommu_notif

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread Peter Lieven
Am 10.05.2014 17:33, schrieb Paolo Bonzini: > Il 10/05/2014 12:51, Peter Lieven ha scritto: >> we currently look up the ram ptr for each single page. Cache >> the pointer while we operate on the same block. > > Why don't you instead cache the result in the MemoryRegion, so that > memory_region_get

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread Peter Lieven
You mean, a) extent the MemoryRegion stuct with a pointer? b) on the first call to memory_region_get_ram_ptr cache the result in the struct? Peter Am 10.05.2014 17:33, schrieb Paolo Bonzini: > Il 10/05/2014 12:51, Peter Lieven ha scritto: >> we currently look up the ram ptr for each single pag

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread Paolo Bonzini
Il 10/05/2014 12:51, Peter Lieven ha scritto: we currently look up the ram ptr for each single page. Cache the pointer while we operate on the same block. Why don't you instead cache the result in the MemoryRegion, so that memory_region_get_ram_ptr becomes a simple, inline field access? Paol

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread Peter Lieven
Am 10.05.2014 13:38, schrieb 陈梁: > Hi, > The patch is correct. There is a small improved point. >> /* In doubt sent page as normal */ >> bytes_sent = -1; >> @@ -990,16 +996,17 @@ static inline void *host_from_stream_offset(QEMUFile >> *f, >>

Re: [Qemu-devel] [PATCH] migration: cache memory region ram ptr

2014-05-10 Thread 陈梁
Hi, The patch is correct. There is a small improved point. > > /* In doubt sent page as normal */ > bytes_sent = -1; > @@ -990,16 +996,17 @@ static inline void *host_from_stream_offset(QEMUFile *f, > int flags) > { > static RA