qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 5/6 v5] deal with guest panicked event accoring


From: Cornelia Huck
Subject: Re: [Qemu-devel] [PATCH 5/6 v5] deal with guest panicked event accoring to -onpanic parameter
Date: Wed, 27 Jun 2012 16:52:32 +0200

On Wed, 27 Jun 2012 15:02:23 +0800
Wen Congyang <address@hidden> wrote:

> When the guest is panicked, it will write 0x1 to the port KVM_PV_PORT.
> So if qemu reads 0x1 from this port, we can do the folloing three
> things according to the parameter -onpanic:
> 1. emit QEVENT_GUEST_PANICKED only
> 2. emit QEVENT_GUEST_PANICKED and pause the guest
> 3. emit QEVENT_GUEST_PANICKED and poweroff the guest
> 4. emit QEVENT_GUEST_PANICKED and reset the guest

Would it be useful to add some "dump the guest" actions here?

> 
> Note: if we emit QEVENT_GUEST_PANICKED only, and the management
> application does not receive this event(the management may not
> run when the event is emitted), the management won't know the
> guest is panicked.
> 
> Signed-off-by: Wen Congyang <address@hidden>

> +static void kvm_pv_port_read(IORange *iorange, uint64_t offset, unsigned 
> width,
> +                             uint64_t *data)
> +{
> +    *data = (1 << KVM_PV_FEATURE_PANICKED);
> +}

> +
> +static void kvm_pv_port_write(IORange *iorange, uint64_t offset, unsigned 
> width,
> +                              uint64_t data)
> +{
> +    if (data == KVM_PV_PANICKED) {
> +        panicked_perform_action();
> +    }
> +}
> +
> +static void kvm_pv_port_destructor(IORange *iorange)
> +{
> +    g_free(iorange);
> +}
> +
> +static IORangeOps pv_io_range_ops = {
> +    .read = kvm_pv_port_read,
> +    .write = kvm_pv_port_write,
> +    .destructor = kvm_pv_port_destructor,
> +};
> +
> +#if defined(KVM_PV_PORT)
> +void kvm_pv_port_init(void)
> +{
> +    IORange *pv_io_range = g_malloc(sizeof(IORange));
> +
> +    iorange_init(pv_io_range, &pv_io_range_ops, KVM_PV_PORT, 1);
> +    ioport_register(pv_io_range);
> +}
> +#else
> +void kvm_pv_port_init(void)
> +{
> +}
> +#endif

> @@ -3641,6 +3647,10 @@ int main(int argc, char **argv, char **envp)
>          }
>      }
> 
> +    if (kvm_enabled()) {
> +        kvm_pv_port_init();
> +    }
> +
>      if (incoming) {
>          Error *errp = NULL;
>          int ret = qemu_start_incoming_migration(incoming, &errp);

I/O ports won't work for s390, yet we'll likely want panic
notifications there as well. This will need some more abstraction.

Cornelia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]