Skip to contentSkip to conversation

vfio: use correct runstate

PATCH In review Paolo Bonzini 3 participants 5 messages Jun 27, 2014 – Jul 2, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vfio: use correct runstate

io-error is for block device errors; it should always be preceded by a BLOCK_IO_ERROR event. I think vfio wants to use RUN_STATE_INTERNAL_ERROR instead.

Cc Alex Williamson <[email protected]>
---
 hw/misc/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/vfio.c +1 -1
index 7437c2e..9d71d97 100644
@@ -3978,7 +3978,7 @@ static void vfio_err_notifier_handler(void *opaque)
                  __func__, vdev->host.domain, vdev->host.bus,
                  vdev->host.slot, vdev->host.function);
 
-    vm_stop(RUN_STATE_IO_ERROR);
+    vm_stop(RUN_STATE_INTERNAL_ERROR);
 }
 
 /*
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 2 lines · Paolo Bonzini

io-error is for block device errors; it should always be preceded by a BLOCK_IO_ERROR event.

Where does this requirement come from? I only see a loose association of IO_ERROR to disk in libvirt and none in QEMU.

Quoted 2 lines

I think vfio wants to use
RUN_STATE_INTERNAL_ERROR instead.

But that seems to put us into an "unknown" paused state in libvirt. An I/O error still seems like a more appropriate state. I'm not sure this qualifies as a trivial patch, it is small, but subtle. Thanks,

Alex

Quoted 20 lines
Cc Alex Williamson <[email protected]>
---
 hw/misc/vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/misc/vfio.c +1 -1
index 7437c2e..9d71d97 100644
@@ -3978,7 +3978,7 @@ static void vfio_err_notifier_handler(void *opaque)
                  __func__, vdev->host.domain, vdev->host.bus,
                  vdev->host.slot, vdev->host.function);
 
-    vm_stop(RUN_STATE_IO_ERROR);
+    vm_stop(RUN_STATE_INTERNAL_ERROR);
 }
 
 /*
#2 lore raw

----- Messaggio originale -----

Quoted 6 lines

Da: "Alex Williamson" <[email protected]>
A: "Paolo Bonzini" <[email protected]>
Cc: [email protected], [email protected]
Inviato: Venerdì, 27 giugno 2014 18:34:59
Oggetto: Re: [PATCH for 2.1] vfio: use correct runstate

Quoted 6 lines
Quoted 2 lines · Paolo Bonzini

io-error is for block device errors; it should always be preceded by a BLOCK_IO_ERROR event.

Where does this requirement come from? I only see a loose association of IO_ERROR to disk in libvirt and none in QEMU.

See the RunState enum in qapi-schema.json:

##
# @RunState
#
# An enumeration of VM run states.
#

# ...
#
# @internal-error: An internal error that prevents further guest execution
# has occurred
#
# @io-error: the last IOP has failed and the device is configured to pause
# on I/O errors
#
# @paused: guest has been paused via the 'stop' command

The point of io-error is that management can look at block devices, see if any have an error reported, and then resume execution (see documentation of rerror=stop and werror=stop/enospc). This is counter to the intentions you have in vfio.

Quoted 4 lines
Quoted 2 lines

I think vfio wants to use
RUN_STATE_INTERNAL_ERROR instead.

But that seems to put us into an "unknown" paused state in libvirt.

I think paused is incorrect, because (unlike RUN_STATE_IO_ERROR), you cannot resume from RUN_STATE_INTERNAL_ERROR except with a reset. QEMU enforces that, and this matches the error you are reporting:

    error_report("%s(%04x:%02x:%02x.%x) Unrecoverable error detected.  "
                 "Please collect any data possible and then kill the guest",
                 __func__, vdev->host.domain, vdev->host.bus,
                 vdev->host.slot, vdev->host.function);

libvirt has a crashed state, I think that's what libvirt should call the internal-error runstate. IIRC on Xen you get to crashed when the processor raises an error on vmentry, for example.

Libvirt only knows about crashed/unknown, but one could add crashed/internal-error too.

Paolo

#3 lore raw
Quoted 50 lines · Paolo Bonzini

----- Messaggio originale -----

Quoted 6 lines

Da: "Alex Williamson" <[email protected]>
A: "Paolo Bonzini" <[email protected]>
Cc: [email protected], [email protected]
Inviato: Venerdì, 27 giugno 2014 18:34:59
Oggetto: Re: [PATCH for 2.1] vfio: use correct runstate

Quoted 6 lines
Quoted 2 lines · Paolo Bonzini

io-error is for block device errors; it should always be preceded by a BLOCK_IO_ERROR event.

Where does this requirement come from? I only see a loose association of IO_ERROR to disk in libvirt and none in QEMU.

See the RunState enum in qapi-schema.json:

##
# @RunState
#
# An enumeration of VM run states.
#

# ...
#
# @internal-error: An internal error that prevents further guest execution
# has occurred
#
# @io-error: the last IOP has failed and the device is configured to pause
# on I/O errors
#
# @paused: guest has been paused via the 'stop' command

The point of io-error is that management can look at block devices, see if any have an error reported, and then resume execution (see documentation of rerror=stop and werror=stop/enospc). This is counter to the intentions you have in vfio.

Quoted 4 lines
Quoted 2 lines

I think vfio wants to use
RUN_STATE_INTERNAL_ERROR instead.

But that seems to put us into an "unknown" paused state in libvirt.

I think paused is incorrect, because (unlike RUN_STATE_IO_ERROR), you cannot resume from RUN_STATE_INTERNAL_ERROR except with a reset. QEMU enforces that, and this matches the error you are reporting:

    error_report("%s(%04x:%02x:%02x.%x) Unrecoverable error detected.  "
                 "Please collect any data possible and then kill the guest",
                 __func__, vdev->host.domain, vdev->host.bus,
                 vdev->host.slot, vdev->host.function);
Quoted 6 lines

libvirt has a crashed state, I think that's what libvirt should call the internal-error runstate. IIRC on Xen you get to crashed when the processor raises an error on vmentry, for example.

Libvirt only knows about crashed/unknown, but one could add crashed/internal-error too.

Ok, I'll go with it. I'll include this in the pull request I intend to do on Monday. Thanks,

Alex

#4 lore raw
In reply to Paolo Bonzini

[adding libvirt]

Quoted 50 lines · Paolo Bonzini

----- Messaggio originale -----

Quoted 6 lines

Da: "Alex Williamson" <[email protected]>
A: "Paolo Bonzini" <[email protected]>
Cc: [email protected], [email protected]
Inviato: Venerdì, 27 giugno 2014 18:34:59
Oggetto: Re: [PATCH for 2.1] vfio: use correct runstate

Quoted 6 lines
Quoted 2 lines · Paolo Bonzini

io-error is for block device errors; it should always be preceded by a BLOCK_IO_ERROR event.

Where does this requirement come from? I only see a loose association of IO_ERROR to disk in libvirt and none in QEMU.

See the RunState enum in qapi-schema.json:

##
# @RunState
#
# An enumeration of VM run states.
#

# ...
#
# @internal-error: An internal error that prevents further guest execution
# has occurred
#
# @io-error: the last IOP has failed and the device is configured to pause
# on I/O errors
#
# @paused: guest has been paused via the 'stop' command

The point of io-error is that management can look at block devices, see if any have an error reported, and then resume execution (see documentation of rerror=stop and werror=stop/enospc). This is counter to the intentions you have in vfio.

Quoted 4 lines
Quoted 2 lines

I think vfio wants to use
RUN_STATE_INTERNAL_ERROR instead.

But that seems to put us into an "unknown" paused state in libvirt.

I think paused is incorrect, because (unlike RUN_STATE_IO_ERROR), you cannot resume from RUN_STATE_INTERNAL_ERROR except with a reset. QEMU enforces that, and this matches the error you are reporting:

    error_report("%s(%04x:%02x:%02x.%x) Unrecoverable error detected.  "
                 "Please collect any data possible and then kill the guest",
                 __func__, vdev->host.domain, vdev->host.bus,
                 vdev->host.slot, vdev->host.function);
Quoted 6 lines

libvirt has a crashed state, I think that's what libvirt should call the internal-error runstate. IIRC on Xen you get to crashed when the processor raises an error on vmentry, for example.

Libvirt only knows about crashed/unknown, but one could add crashed/internal-error too.

Yes, we probably need to teach libvirt about this state.

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org