remove kvm_init_ap from qemu code.
PATCH 1/1 remove kvm_init_ap from qemu code.
Call it as a special case for cpu 0 creation. This removes a piece of kvm code from raw qemu.
Signed-off-by Glauber Costa <[email protected]>
--- qemu/qemu-kvm.c | 21 ++++++++++++--------- qemu/qemu-kvm.h | 1 - qemu/vl.c | 3 --- 3 files changed, 12 insertions(+), 13 deletions(-)
qemu/qemu-kvm.c +12 -9
@@ -436,15 +436,7 @@ static void *ap_main_loop(void *_env)return NULL ; } -void kvm_init_new_ap (int cpu,CPUState *env) -{ -pthread_create (&vcpu_info[cpu].thread,NULL , ap_main_loop, env); - -while (vcpu_info[cpu].created ==0 ) -qemu_cond_wait (&qemu_vcpu_cond); -} - -int kvm_init_ap (void ) +static int kvm_init_ap (void ) {#ifdef TARGET_I386 kvm_tpr_opt_setup ();
@@ -455,6 +447,17 @@ int kvm_init_ap(void)return 0 ; } +void kvm_init_new_ap (int cpu,CPUState *env) +{ +if (!cpu) +kvm_init_ap (); + +pthread_create (&vcpu_info[cpu].thread,NULL , ap_main_loop, env); + +while (vcpu_info[cpu].created ==0 ) +qemu_cond_wait (&qemu_vcpu_cond); +} +void qemu_kvm_notify_work (void ) {uint64_t value =1 ;
qemu/qemu-kvm.h +0 -1
@@ -16,7 +16,6 @@ int kvm_main_loop(void);int kvm_qemu_init (void );int kvm_qemu_create_context (void );void kvm_init_new_ap (int cpu,CPUState *env); -int kvm_init_ap (void );void kvm_qemu_destroy (void );void kvm_load_registers (CPUState *env);void kvm_save_registers (CPUState *env);
qemu/vl.c +0 -3
@@ -10080,9 +10080,6 @@ int main(int argc, char **argv) } } -if (kvm_enabled ()) -kvm_init_ap (); - machine->init (ram_size, vga_ram_size, boot_devices, ds, kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
Signature · 1 line
1.5.5.1
Quoted 5 lines · Glauber Costa
Call it as a special case for cpu 0 creation. This removes a piece of kvm code from raw qemu.
qemu/qemu-kvm.c +1
-0+void kvm_init_new_ap (int cpu,CPUState *env)
qemu/qemu-kvm.c int kvm_init_ap(void) · line 460
Quoted 10 lines
qemu/qemu-kvm.c +10
-0+{ +if (!cpu) +kvm_init_ap (); + +pthread_create (&vcpu_info[cpu].thread,NULL , ap_main_loop, env); + +while (vcpu_info[cpu].created ==0 ) +qemu_cond_wait (&qemu_vcpu_cond); +} +
kvm_init_ap() is machine-level initialization. It's hacky to call it from cpu-level initialization.
Do we have a machine-level initialization hook?
[btw, !x makes sense when x is a boolean, pointer, or count. Then it means "there is no x" or "there are no xs". But when x is an index, !x means "x equals 0", so you may as well write that.
and don't get me started on !strcmp()]
Signature · 1 line
error compiling committee.c: too many arguments to function