win32 fixes for NUMA merge
cover win32 fixes for NUMA merge
Patch 1 adds a Win32 implementation of preallocation. Patch 2 fixes an initialization issue where the ram_list mutex was used before initialization. On Win32 this results in a deadlock.
Paolo
Paolo Bonzini (2):
fixup! memory: move preallocation code out of exec.c fixup! numa: add -numa node,memdev= option
include/sysemu/os-win32.h | 2 ++ translate-all.c | 7 ------- util/oslib-win32.c | 19 +++++++++++++++++++ vl.c | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-)
Signature · 1 line
1.9.3
PATCH 1/2 fixup! memory: move preallocation code out of exec.c
Since we need the page size for efficiency, move code to compute it out of translate-all.c and into util/oslib-win32.c.
--- include/sysemu/os-win32.h | 2 ++ translate-all.c | 7 ------- util/oslib-win32.c | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-)
include/sysemu/os-win32.h +2 -0
@@ -89,6 +89,8 @@ static inline void os_setup_post(void) {}void os_set_line_buffering (void );static inline void os_set_proc_name (const char *dummy) {} +size_t getpagesize (void ); +#if !defined(EPROTONOSUPPORT )# define EPROTONOSUPPORT EINVAL#endif
translate-all.c +0 -7
@@ -295,14 +295,7 @@ void page_size_init(void) {/* NOTE: we can always suppose that qemu_host_page_size >= TARGET_PAGE_SIZE */ -#ifdef _WIN32 -SYSTEM_INFO system_info; - -GetSystemInfo (&system_info); - qemu_real_host_page_size = system_info.dwPageSize; -#else qemu_real_host_page_size =getpagesize (); -#endif if (qemu_host_page_size ==0 ) { qemu_host_page_size = qemu_real_host_page_size; }
util/oslib-win32.c +19 -0
@@ -350,3 +350,22 @@ gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout)return num_completed; } + +size_t getpagesize (void ) +{ +SYSTEM_INFO system_info; + +GetSystemInfo (&system_info); +return system_info.dwPageSize; +} + +void os_mem_prealloc (int fd,char *area,size_t memory) +{ +int i; +size_t pagesize =getpagesize (); + + memory = (memory + pagesize -1 ) & -pagesize; +for (i =0 ; i < memory / pagesize; i++) { +memset (area + pagesize * i,0 ,1 ); + } +}
Signature · 1 line
1.9.3
PATCH 2/2 fixup! numa: add -numa node, memdev= option
In reply to Paolo Bonzini--- vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
vl.c +2 -2
@@ -3959,6 +3959,8 @@ int main(int argc, char **argv, char **envp)exit (1 ); } +cpu_exec_init_all (); + current_machine =MACHINE (object_new (object_class_get_name (OBJECT_CLASS (machine_class)))); object_property_add_child(object_get_root(), "machine",
@@ -4296,8 +4298,6 @@ int main(int argc, char **argv, char **envp) } } -cpu_exec_init_all (); -blk_mig_init ();ram_mig_init ();
Signature · 1 line
1.9.3
Michael S. Tsirkin
AppliedQuoted 5 lines · Paolo Bonzini
Patch 1 adds a Win32 implementation of preallocation. Patch 2 fixes an initialization issue where the
ram_listmutex was used before initialization. On Win32 this results in a deadlock.Paolo
Applied, thanks a lot.
Quoted 12 lines
Paolo Bonzini (2):
fixup! memory: move preallocation code out ofexec.cfixup! numa: add -numa node,memdev= optioninclude/sysemu/os-win32.h | 2 ++ translate-all.c | 7 ------- util/oslib-win32.c | 19 +++++++++++++++++++ vl.c | 4 ++-- 4 files changed, 23 insertions(+), 9 deletions(-)Signature · 1 line
1.9.3