* [PATCH] virtio-pci: mask notifier error handling fixups
@ 2011-01-18 13:42 Michael S. Tsirkin
2011-01-18 15:29 ` Alex Williamson
2011-01-20 16:34 ` Marcelo Tosatti
0 siblings, 2 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-01-18 13:42 UTC (permalink / raw)
To: kvm; +Cc: alex.williamson, mst
Fix virtio-pci error handling in the mask notifiers: be careful to undo
exactly what we did so far.
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
This is for qemu-kvm only.
hw/virtio-pci.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bf3cf4f..dd8887a 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -612,6 +612,9 @@ static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
return 0;
undo:
while (--n >= 0) {
+ if (virtio_queue_vector(vdev, n) != vector) {
+ continue;
+ }
virtio_pci_mask_vq(dev, vector, virtio_get_queue(vdev, n), !masked);
}
return r;
@@ -681,9 +684,18 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
assign_error:
/* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
+ if (assign) {
+ msix_unset_mask_notifier(&proxy->pci_dev);
+ }
+
while (--n >= 0) {
virtio_pci_set_guest_notifier(opaque, n, !assign);
}
+
+ if (!assign) {
+ msix_set_mask_notifier(&proxy->pci_dev,
+ virtio_pci_mask_notifier);
+ }
return r;
}
--
1.7.3.2.91.g446ac
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] virtio-pci: mask notifier error handling fixups
2011-01-18 13:42 [PATCH] virtio-pci: mask notifier error handling fixups Michael S. Tsirkin
@ 2011-01-18 15:29 ` Alex Williamson
2011-01-20 16:34 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2011-01-18 15:29 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm
On Tue, 2011-01-18 at 15:42 +0200, Michael S. Tsirkin wrote:
> Fix virtio-pci error handling in the mask notifiers: be careful to undo
> exactly what we did so far.
>
> Reported-by: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
Looks right.
Acked-by: Alex Williamson <alex.williamson@redhat.com>
> hw/virtio-pci.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
> index bf3cf4f..dd8887a 100644
> --- a/hw/virtio-pci.c
> +++ b/hw/virtio-pci.c
> @@ -612,6 +612,9 @@ static int virtio_pci_mask_notifier(PCIDevice *dev, unsigned vector,
> return 0;
> undo:
> while (--n >= 0) {
> + if (virtio_queue_vector(vdev, n) != vector) {
> + continue;
> + }
> virtio_pci_mask_vq(dev, vector, virtio_get_queue(vdev, n), !masked);
> }
> return r;
> @@ -681,9 +684,18 @@ static int virtio_pci_set_guest_notifiers(void *opaque, bool assign)
>
> assign_error:
> /* We get here on assignment failure. Recover by undoing for VQs 0 .. n. */
> + if (assign) {
> + msix_unset_mask_notifier(&proxy->pci_dev);
> + }
> +
> while (--n >= 0) {
> virtio_pci_set_guest_notifier(opaque, n, !assign);
> }
> +
> + if (!assign) {
> + msix_set_mask_notifier(&proxy->pci_dev,
> + virtio_pci_mask_notifier);
> + }
> return r;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] virtio-pci: mask notifier error handling fixups
2011-01-18 13:42 [PATCH] virtio-pci: mask notifier error handling fixups Michael S. Tsirkin
2011-01-18 15:29 ` Alex Williamson
@ 2011-01-20 16:34 ` Marcelo Tosatti
1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2011-01-20 16:34 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm, alex.williamson
On Tue, Jan 18, 2011 at 03:42:57PM +0200, Michael S. Tsirkin wrote:
> Fix virtio-pci error handling in the mask notifiers: be careful to undo
> exactly what we did so far.
>
> Reported-by: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> This is for qemu-kvm only.
>
> hw/virtio-pci.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-01-20 22:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-18 13:42 [PATCH] virtio-pci: mask notifier error handling fixups Michael S. Tsirkin
2011-01-18 15:29 ` Alex Williamson
2011-01-20 16:34 ` Marcelo Tosatti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox