"large" memory support for guests
RFC 1/1 "large" memory support for guests
The following patch applies to kvm-51 and correct all compilation warnings because of mismatching types for ram related variables and that were left behind after the changes to add support for more than 2GB of memory for 32bit guests.
a more complete patchset will be needed for doing the same changes to trunk (most of them are already identified in my ramaddr branch) but since there are 3 different types (ram_addr_t, target_ulong, uint32_t) currently in use in the code to identify memory and 2 different macro definitions (HOST_LONG_BITS, TARGET_LOG_BITS) wanted first to raise a RFC as there is most likely space to simplify the logic and make the code more consistent once the base design issues are layout.
this has been tested with 32/64bit hosts and 32/64bit guests with more than 4GB of memory (except for 32bit host with 32bit guest where the limitation is 3GB because of process vmsize)
Carlo
--
qemu/cpu-defs.h +1 -1
@@ -73,7 +73,7 @@ typedef uint64_t target_phys_addr_t;#endif /* address in the RAM (different from a physical address) */ -typedef unsigned long ram_addr_t ; +typedef target_ulong ram_addr_t ;#define HOST_LONG_SIZE (HOST_LONG_BITS / 8)
qemu/exec.c +3 -3
@@ -1986,7 +1986,7 @@ static inline void tlb_set_dirty(CPUState *env,static int subpage_register (subpage_t *mmio,uint32_t start,uint32_t end,int memory); -static void *subpage_init (target_phys_addr_t base,uint32_t *phys, +static void *subpage_init (target_phys_addr_t base,ram_addr_t *phys,int orig_memory);#define CHECK_SUBPAGE (addr, start_addr, start_addr2, end_addr, end_addr2, \ need_subpage) \
@@ -2094,7 +2094,7 @@ ram_addr_t qemu_ram_alloc(unsigned long size) {ram_addr_t addr;if ((phys_ram_alloc_offset + size) >= phys_ram_size) { -fprintf (stderr,"Not enough memory (requested_size = %u, max memory = %d)\n" , +fprintf (stderr,"Not enough memory (requested_size = %u, max memory = " TARGET_FMT_lu")\n" , size, phys_ram_size);abort (); }
@@ -2430,7 +2430,7 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,return 0 ; } -static void *subpage_init (target_phys_addr_t base,uint32_t *phys, +static void *subpage_init (target_phys_addr_t base,ram_addr_t *phys,int orig_memory) {subpage_t *mmio;
qemu/migration.c +2 -2
@@ -803,7 +803,7 @@ static int migrate_incoming_fd(int fd) size =qemu_get_be32 (f);if (size != phys_ram_size) { -fprintf (stderr,"migration: memory size mismatch: recv %u mine %u\n" , +fprintf (stderr,"migration: memory size mismatch: recv %u mine " TARGET_FMT_lu"\n" , size, phys_ram_size);return MIG_STAT_DST_MEM_SIZE_MISMATCH ; }
@@ -1058,7 +1058,7 @@ void do_info_migration(void)term_printf ("Transfer rate %3.1f mb/s\n" , (double )s->bps / (1024 *1024 ));term_printf ("Iteration %d\n" , s->iteration); -term_printf ("Transferred %d/%d pages\n" , s->updated_pages, phys_ram_size >>TARGET_PAGE_BITS ); +term_printf ("Transferred %d/" TARGET_FMT_lu" pages\n" , s->updated_pages, phys_ram_size >>TARGET_PAGE_BITS );if (s->iteration)term_printf ("Last iteration found %d dirty pages\n" , s->last_updated_pages); }else {
qemu/vl.c +6 -2
@@ -130,10 +130,14 @@ int inet_aton(const char *cp, struct in_addr *ia);//#define DEBUG_UNUSED_IOPORT //#define DEBUG_IOPORT -#if HOST_LONG_BITS <64 +#if TARGET_LONG_BITS <64 #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024)#else +#if HOST_LONG_BITS <64 #define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024ULL) +#else +#define PHYS_RAM_MAX_SIZE (2047 * 1024 * 1024 * 1024UL) +#endif #endif #ifdef TARGET_PPC
@@ -8249,7 +8253,7 @@ int main(int argc, char **argv)if (ram_size <=0 )help (1 );if (ram_size >PHYS_RAM_MAX_SIZE ) { -fprintf (stderr,"qemu: at most %d MB RAM can be simulated\n" , +fprintf (stderr,"qemu: at most " TARGET_FMT_lu" MB RAM can be simulated\n" ,PHYS_RAM_MAX_SIZE / (1024 *1024 ));exit (1 ); }
qemu/hw/pc.c +1 -1
@@ -764,7 +764,7 @@/* above 4giga memory allocation */ if (above_4g_mem_size >0 ) { ram_addr =qemu_ram_alloc (above_4g_mem_size); -cpu_register_physical_memory (0x100000000 , above_4g_mem_size, ram_addr); +cpu_register_physical_memory (0x100000000ULL , above_4g_mem_size, ram_addr); }/* setup basic memory access */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
Quoted 5 lines · Carlo Marcelo Arenas Belon
The following patch applies to kvm-51 and correct all compilation warnings because of mismatching types for ram related variables and that were left behind after the changes to add support for more than 2GB of memory for 32bit guests.
Please use correct subject lines.
Quoted 21 lines
a more complete patchset will be needed for doing the same changes to trunk (most of them are already identified in my ramaddr branch) but since there are 3 different types (
ram_addr_t,target_ulong,uint32_t) currently in use in the code to identify memory and 2 different macro definitions (HOST_LONG_BITS,TARGET_LOG_BITS) wanted first to raise a RFC as there is most likely space to simplify the logic and make the code more consistent once the base design issues are layout.this has been tested with 32/64bit hosts and 32/64bit guests with more than 4GB of memory (except for 32bit host with 32bit guest where the limitation is 3GB because of process vmsize)
Carlo
--qemu/cpu-defs.h +0
-0
qemu/cpu-defs.h typedef uint64_t target_phys_addr_t; · line 77
Quoted 6 lines
qemu/cpu-defs.h +1
-1@@ -73,7 +73,7 @@ typedef uint64_t target_phys_addr_t;#endif /* address in the RAM (different from a physical address) */ -typedef unsigned long ram_addr_t ; +typedef target_ulong ram_addr_t ;
This is wrong. For i386 on x86_64, we can have >4GB RAM, whereas target_ulong is 32-bit.
Quoted 8 lines
qemu/cpu-defs.h +0
-0#define HOST_LONG_SIZE (HOST_LONG_BITS / 8)qemu/exec.c +0
-0
qemu/exec.c static inline void tlb_set_dirty(CPUState *env, · line 1991
Quoted 7 lines
qemu/exec.c +1
-1@@ -1986,7 +1986,7 @@ static inline void tlb_set_dirty(CPUState *env,static int subpage_register (subpage_t *mmio,uint32_t start,uint32_t end,int memory); -static void *subpage_init (target_phys_addr_t base,uint32_t *phys, +static void *subpage_init (target_phys_addr_t base,ram_addr_t *phys,int orig_memory);
target_phys_addr_t is more correct here, I believe.
Please copy qemu-devel on these types of core qemu changes.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/