Re: [PATCH] kvm: emit GUEST_PANICKED event in case of abnormal KVM exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrey Drobyshev <andrey.drobyshev@xxxxxxxxxxxxx> writes:

(Add kvm@vger to CC for wider review)

> Currently we emit GUEST_PANICKED event in case kvm_vcpu_ioctl() returns
> KVM_EXIT_SYSTEM_EVENT with the event type KVM_SYSTEM_EVENT_CRASH.  Let's
> extend this scenario and emit GUEST_PANICKED in case of an abnormal KVM
> exit.  That's a natural thing to do since in this case guest is no
> longer operational anyway.
>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@xxxxxxxxxxxxx>
> Acked-by: Denis V. Lunev <den@xxxxxxxxxxxxx>
> ---
>  accel/kvm/kvm-all.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index e39a810a4e..d74b3f0b0e 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2816,6 +2816,14 @@ static void kvm_eat_signals(CPUState *cpu)
>      } while (sigismember(&chkset, SIG_IPI));
>  }
>  
> +static void kvm_emit_guest_crash(CPUState *cpu)
> +{
> +    kvm_cpu_synchronize_state(cpu);
> +    qemu_mutex_lock_iothread();
> +    qemu_system_guest_panicked(cpu_get_crash_info(cpu));
> +    qemu_mutex_unlock_iothread();
> +}
> +
>  int kvm_cpu_exec(CPUState *cpu)
>  {
>      struct kvm_run *run = cpu->kvm_run;
> @@ -2969,21 +2977,24 @@ int kvm_cpu_exec(CPUState *cpu)
>                  ret = EXCP_INTERRUPT;
>                  break;
>              case KVM_SYSTEM_EVENT_CRASH:
> -                kvm_cpu_synchronize_state(cpu);
> -                qemu_mutex_lock_iothread();
> -                qemu_system_guest_panicked(cpu_get_crash_info(cpu));
> -                qemu_mutex_unlock_iothread();
> +                kvm_emit_guest_crash(cpu);
>                  ret = 0;
>                  break;
>              default:
>                  DPRINTF("kvm_arch_handle_exit\n");
>                  ret = kvm_arch_handle_exit(cpu, run);
> +                if (ret < 0) {
> +                    kvm_emit_guest_crash(cpu);
> +                }
>                  break;
>              }
>              break;
>          default:
>              DPRINTF("kvm_arch_handle_exit\n");
>              ret = kvm_arch_handle_exit(cpu, run);
> +            if (ret < 0) {
> +                kvm_emit_guest_crash(cpu);
> +            }
>              break;
>          }
>      } while (ret == 0);

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux