Message ID | 4F4AF316.50400@cn.fujitsu.com |
---|---|
State | New |
Headers | show |
On 2012-02-27 04:05, Wen Congyang wrote: > When the host knows the guest is paniced, it will set > exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive > this exit_reason, we can send a event to tell management > application that the guest is paniced. > > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> > --- > kvm-all.c | 3 +++ > linux-headers/linux/kvm.h | 1 + > monitor.c | 3 +++ > monitor.h | 1 + > 4 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/kvm-all.c b/kvm-all.c > index c4babda..ae428ab 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) > (uint64_t)run->hw.hardware_exit_reason); > ret = -1; > break; > + case KVM_EXIT_GUEST_PANIC: > + monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); > + break; > case KVM_EXIT_INTERNAL_ERROR: > ret = kvm_handle_internal_error(env, run); > break; > diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h > index f6b5343..45dd031 100644 > --- a/linux-headers/linux/kvm.h > +++ b/linux-headers/linux/kvm.h > @@ -163,6 +163,7 @@ struct kvm_pit_config { > #define KVM_EXIT_OSI 18 > #define KVM_EXIT_PAPR_HCALL 19 > #define KVM_EXIT_S390_UCONTROL 20 > +#define KVM_EXIT_GUEST_PANIC 21 > > /* For KVM_EXIT_INTERNAL_ERROR */ > #define KVM_INTERNAL_ERROR_EMULATION 1 linux-headers are supposed to be synchronized in a separate patch, naming the upstream or kvm.git hash they pull in. IOW: the KVM ABI change has to be applied first. Jan
On Mon, 27 Feb 2012 11:05:58 +0800 Wen Congyang <wency@cn.fujitsu.com> wrote: > When the host knows the guest is paniced, it will set > exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive > this exit_reason, we can send a event to tell management > application that the guest is paniced. > > Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> > --- > kvm-all.c | 3 +++ > linux-headers/linux/kvm.h | 1 + > monitor.c | 3 +++ > monitor.h | 1 + > 4 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/kvm-all.c b/kvm-all.c > index c4babda..ae428ab 100644 > --- a/kvm-all.c > +++ b/kvm-all.c > @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) > (uint64_t)run->hw.hardware_exit_reason); > ret = -1; > break; > + case KVM_EXIT_GUEST_PANIC: > + monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); > + break; The event alone is not enough, because the mngt app may miss it (eg. the panic happens before the mngt app connected to qemu). A simple way to solve this would be to also add a new RunState called guest-panic and make the transition to it (besides sending the event). A more general way would be to model this after -drive's werror/rerror options, say guest-error=report|ignore|stop. When guest-error=stop, the mngt app will get a STOP event and can check the VM runstate to know if it's guest-panic.
At 03/02/2012 12:51 AM, Luiz Capitulino Wrote: > On Mon, 27 Feb 2012 11:05:58 +0800 > Wen Congyang <wency@cn.fujitsu.com> wrote: > >> When the host knows the guest is paniced, it will set >> exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive >> this exit_reason, we can send a event to tell management >> application that the guest is paniced. >> >> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> >> --- >> kvm-all.c | 3 +++ >> linux-headers/linux/kvm.h | 1 + >> monitor.c | 3 +++ >> monitor.h | 1 + >> 4 files changed, 8 insertions(+), 0 deletions(-) >> >> diff --git a/kvm-all.c b/kvm-all.c >> index c4babda..ae428ab 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) >> (uint64_t)run->hw.hardware_exit_reason); >> ret = -1; >> break; >> + case KVM_EXIT_GUEST_PANIC: >> + monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); >> + break; > > The event alone is not enough, because the mngt app may miss it (eg. the panic > happens before the mngt app connected to qemu). > > A simple way to solve this would be to also add a new RunState called > guest-panic and make the transition to it (besides sending the event). > > A more general way would be to model this after -drive's werror/rerror options, > say guest-error=report|ignore|stop. When guest-error=stop, the mngt app will > get a STOP event and can check the VM runstate to know if it's guest-panic. OK, I will fix it. Thanks Wen Congyang > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >
diff --git a/kvm-all.c b/kvm-all.c index c4babda..ae428ab 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1190,6 +1190,9 @@ int kvm_cpu_exec(CPUState *env) (uint64_t)run->hw.hardware_exit_reason); ret = -1; break; + case KVM_EXIT_GUEST_PANIC: + monitor_protocol_event(QEVENT_GUEST_PANICED, NULL); + break; case KVM_EXIT_INTERNAL_ERROR: ret = kvm_handle_internal_error(env, run); break; diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index f6b5343..45dd031 100644 --- a/linux-headers/linux/kvm.h +++ b/linux-headers/linux/kvm.h @@ -163,6 +163,7 @@ struct kvm_pit_config { #define KVM_EXIT_OSI 18 #define KVM_EXIT_PAPR_HCALL 19 #define KVM_EXIT_S390_UCONTROL 20 +#define KVM_EXIT_GUEST_PANIC 21 /* For KVM_EXIT_INTERNAL_ERROR */ #define KVM_INTERNAL_ERROR_EMULATION 1 diff --git a/monitor.c b/monitor.c index 953e748..9802792 100644 --- a/monitor.c +++ b/monitor.c @@ -494,6 +494,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data) case QEVENT_WAKEUP: event_name = "WAKEUP"; break; + case QEVENT_GUEST_PANICED: + event_name = "GUEST_PANICED"; + break; default: abort(); break; diff --git a/monitor.h b/monitor.h index 0d49800..a62da93 100644 --- a/monitor.h +++ b/monitor.h @@ -41,6 +41,7 @@ typedef enum MonitorEvent { QEVENT_DEVICE_TRAY_MOVED, QEVENT_SUSPEND, QEVENT_WAKEUP, + QEVENT_GUEST_PANICED, QEVENT_MAX, } MonitorEvent;
When the host knows the guest is paniced, it will set exit_reason to KVM_EXIT_GUEST_PANIC. So if qemu receive this exit_reason, we can send a event to tell management application that the guest is paniced. Signed-off-by: Wen Congyang <wency@cn.fujitsu.com> --- kvm-all.c | 3 +++ linux-headers/linux/kvm.h | 1 + monitor.c | 3 +++ monitor.h | 1 + 4 files changed, 8 insertions(+), 0 deletions(-)