kvm tools: Fix 'lkvm stop' when guest is pasued.
PATCH 1/2 kvm tools: Fix 'lkvm stop' when guest is pasued.
Currently, 'lkvm stop' can not stop a pasued guest becasue guest is blocked on the pause_lock.
This patch fixes it by un-pausing the guest before stops it.
The pthread_kill() call is not needed.
Signed-off-by Asias He <[email protected]>
--- tools/kvm/kvm-cpu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/kvm/kvm-cpu.c +1 -1
@@ -39,7 +39,7 @@ static void kvm_cpu_signal_handler(int signum)if (signum ==SIGKVMEXIT ) {if (current_kvm_cpu && current_kvm_cpu->is_running) { current_kvm_cpu->is_running = false; -pthread_kill (pthread_self (),SIGKVMEXIT ); +kvm__continue (); } }else if (signum ==SIGKVMPAUSE ) { current_kvm_cpu->paused =1 ;
Signature · 1 line
1.7.7.3
PATCH 2/2 kvm tools: Do not run guest if it is stopped.
If the guest is stopped, there is no need to run it. This patch fixes this when running 'lkvm stop'.
KVM_RUN failed: Bad address
Signed-off-by Asias He <[email protected]>
--- tools/kvm/kvm-cpu.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
tools/kvm/kvm-cpu.c +3 -0
@@ -29,6 +29,9 @@ void kvm_cpu__run(struct kvm_cpu *vcpu) {int err; +if (!vcpu->is_running) +return ; + err =ioctl (vcpu->vcpu_fd,KVM_RUN ,0 );if (err <0 && (errno !=EINTR && errno !=EAGAIN ))die_perror ("KVM_RUN failed" );
Signature · 1 line
1.7.7.3