Patchwork [PATCHv2,1/6] virtio-net: don't dma while vm is stopped

login
register
mail settings
Submitter Michael S. Tsirkin
Date Nov. 24, 2010, 3:52 p.m.
Message ID <0c2beda8b93896b69ddd765814d111be86f86526.1290613959.git.mst@redhat.com>
Download mbox | patch
Permalink /patch/72916/
State New
Headers show

Comments

Michael S. Tsirkin - Nov. 24, 2010, 3:52 p.m.
DMA into memory while VM is stopped makes it
hard to debug migration (consequitive saves
result in different files).
Fixing this completely is a large effort,
this patch does this for virtio-net.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
---
 hw/virtio-net.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 1d61f19..43a2b3d 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -424,6 +424,9 @@  static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
 static int virtio_net_can_receive(VLANClientState *nc)
 {
     VirtIONet *n = DO_UPCAST(NICState, nc, nc)->opaque;
+    if (!n->vm_running) {
+        return 0;
+    }
 
     if (!virtio_queue_ready(n->rx_vq) ||
         !(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))