Skip to contentSkip to conversation

vhost_net: start/stop guest notifiers properly

PATCH In review Jason Wang 4 participants 16 messages Aug 19, 2014 – Sep 5, 2014

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH v3 1/1 vhost_net: start/stop guest notifiers properly

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue support changed the order of stopping the device. Previously vhost_dev_stop would disable backend and only afterwards, unset guest notifiers. We now unset guest notifiers while vhost is still active. This can lose interrupts causing guest networking to fail. In particular, this has been observed during migration.

To adapt this, several other changes are needed:
- remove the hdev->started assertion in vhost.c since we may want to start the guest notifiers before vhost starts and stop the guest notifiers after vhost is stopped.
- introduce the vhost_net_set_vq_index() and call it before setting guest notifiers. This is used to guarantee vhost_net has the correct virtqueue index when setting guest notifiers.

--
Changes from Michael's patch:
- Remove the assertion
Changes from V1:
- Rebase to latest
Changes from V2:
- Introduce vhost_net_set_vq_index() to unbreak multiqueue

Zhang Jie, please test this patch to see if it fixes the issue.

---
 hw/net/vhost_net.c | 31 +++++++++++++++++++------------
 hw/virtio/vhost.c  |  2 --
 2 files changed, 19 insertions(+), 14 deletions(-)
hw/net/vhost_net.c +19 -12
index f87c798..fe0203d 100644
@@ -188,9 +188,13 @@ bool vhost_net_query(VHostNetState *net, VirtIODevice *dev)
     return vhost_dev_query(&net->dev, dev);
 }
 
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}
+
 static int vhost_net_start_one(struct vhost_net *net,
-                               VirtIODevice *dev,
-                               int vq_index)
+			VirtIODevice *dev)
 {
     struct vhost_vring_file file = { };
     int r;
@@ -201,7 +205,6 @@ static int vhost_net_start_one(struct vhost_net *net,
 
     net->dev.nvqs = 2;
     net->dev.vqs = net->vqs;
-    net->dev.vq_index = vq_index;
 
     r = vhost_dev_enable_notifiers(&net->dev, dev);
     if (r < 0) {
@@ -309,11 +312,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
     }
 
     for (i = 0; i < total_queues; i++) {
-        r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev, i * 2);
-
-        if (r < 0) {
-            goto err;
-        }
+        vhost_net_set_vq_index(get_vhost_net(ncs[i].peer), i * 2);
     }
 
     r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true);
@@ -322,6 +321,14 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs,
         goto err;
     }
 
+    for (i = 0; i < total_queues; i++) {
+        r = vhost_net_start_one(get_vhost_net(ncs[i].peer), dev);
+
+        if (r < 0) {
+            goto err;
+        }
+    }
+
     return 0;
 
 err:
@@ -339,16 +346,16 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs,
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus);
     int i, r;
 
+    for (i = 0; i < total_queues; i++) {
+        vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
+    }
+
     r = k->set_guest_notifiers(qbus->parent, total_queues * 2, false);
     if (r < 0) {
         fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r);
         fflush(stderr);
     }
     assert(r >= 0);
-
-    for (i = 0; i < total_queues; i++) {
-        vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev);
-    }
 }
 
 void vhost_net_cleanup(struct vhost_net *net)
hw/virtio/vhost.c +0 -2
index e55fe1c..5d7c40a 100644
@@ -976,7 +976,6 @@ void vhost_dev_disable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev)
 bool vhost_virtqueue_pending(struct vhost_dev *hdev, int n)
 {
     struct vhost_virtqueue *vq = hdev->vqs + n - hdev->vq_index;
-    assert(hdev->started);
     assert(n >= hdev->vq_index && n < hdev->vq_index + hdev->nvqs);
     return event_notifier_test_and_clear(&vq->masked_notifier);
 }
@@ -988,7 +987,6 @@ void vhost_virtqueue_mask(struct vhost_dev *hdev, VirtIODevice *vdev, int n,
     struct VirtQueue *vvq = virtio_get_queue(vdev, n);
     int r, index = n - hdev->vq_index;
 
-    assert(hdev->started);
     assert(n >= hdev->vq_index && n < hdev->vq_index + hdev->nvqs);
 
     struct vhost_vring_file file = {
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 20 lines · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue support changed the order of stopping the device. Previously vhost_dev_stop would disable backend and only afterwards, unset guest notifiers. We now unset guest notifiers while vhost is still active. This can lose interrupts causing guest networking to fail. In particular, this has been observed during migration.

To adapt this, several other changes are needed:
- remove the hdev->started assertion in vhost.c since we may want to start the guest notifiers before vhost starts and stop the guest notifiers after vhost is stopped.
- introduce the vhost_net_set_vq_index() and call it before setting guest notifiers. This is used to guarantee vhost_net has the correct virtqueue index when setting guest notifiers.

Quoted 7 lines

--
Changes from Michael's patch:
- Remove the assertion
Changes from V1:
- Rebase to latest
Changes from V2:
- Introduce vhost_net_set_vq_index() to unbreak multiqueue

indeed I had with v2:
qemu-system-x86_64: hw/virtio/vhost.c:990: vhost_virtqueue_mask: Assertion `n >= hdev->vq_index && n < hdev->vq_index + hdev->nvqs' failed.

v3 seems ok to me

Signature · 1 line
William
#2 lore raw
In reply to Jason Wang
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 6 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Signature · 2 lines
Best Wishes!
Zhang Jie
#3 lore raw
Quoted 10 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 6 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 5 lines
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Could you please clarify what do you mean by "notify tap" here? Thanks!

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie
#4 lore raw
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 6 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Could you please clarify what do you mean by "notify tap" here? Thanks!

Or just post your jprobe script.

Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie
author
#6 lore raw
In reply to Zhangjie (HZ)
Quoted 9 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 5 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 5 lines
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Thanks for the testing. A questions is can you reproduce this when vhost is disabled?

Anyway, I will try to reproduce it by myself.

#7 lore raw
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 5 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Thanks for the testing. A questions is can you reproduce this when vhost is disabled?

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Signature · 2 lines
Best Wishes!
Zhang Jie
author
#8 lore raw
Quoted 16 lines · Zhangjie (HZ)
Quoted 15 lines · Jason Wang
Quoted 14 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 5 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Quoted 6 lines
Quoted 2 lines

Thanks for the testing. A questions is can you reproduce this when vhost is disabled?

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Just want to confirm. For the problem did not occur, you mean with my patch on top?

#5 lore raw
In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 7 lines · Michael S. Tsirkin
Quoted 4 lines

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Could you please clarify what do you mean by "notify tap" here? Thanks!

Or just post your jprobe script.

Ok, thanks, this is the key function.
static int cont =1;
static int virtnet_poll_jprobe(struct napi_struct *napi, int budget)

{
        struct receive_queue *rq =
                container_of(napi, struct receive_queue, napi);
        struct virtnet_info *vi = rq->vq->vdev->priv;
        struct send_queue *sq;
        struct vring_virtqueue *vq;
        int i;

        if (cont == 1) {
                for (i = 0; i < curr_queue_pairs; i++) {
                        sq = &vi->sq[i];
                        vq = to_vvq(sq->vq);
                       vq->notify(sq->vq);
                }
                cont = 0;
        }
        jprobe_return();
        return 0;
}

When the problem occurs, one queue pair(each nic has two queue pairs) is active, so virtual nic can still receive skbs. And, only one queue pair misses a interrupt.
To run the jprobe, some definition of function and structure should be copied to jprobe.c.

Signature · 2 lines
Best Wishes!
Zhang Jie
#9 lore raw
In reply to Jason Wang
Quoted 8 lines · Jason Wang
Quoted 5 lines · Zhangjie (HZ)

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

That sounds reasonable, but the test case is to test vhost.

Quoted 16 lines
Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Quoted 4 lines

Just want to confirm. For the problem did not occur, you mean with my patch on top?
.

I mean, with your patch, I have to test 80 times before it occurs, the probability is reduced.

Signature · 2 lines
Best Wishes!
Zhang Jie
author
#14 lore raw
In reply to Zhangjie (HZ)
Quoted 29 lines · Zhangjie (HZ)
Quoted 10 lines · Jason Wang
Quoted 10 lines · Zhangjie (HZ)
Quoted 9 lines
Quoted 9 lines · Jason Wang
Quoted 1 line
Quoted 1 line

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

Quoted 5 lines

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 5 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

Thanks for the testing. A questions is can you reproduce this when vhost is disabled?

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Yes.

I'm trying to reproduce locally, but with my patch on top, after 5000+ times of migration, network is still available (I stress the guest network in the same time). What's the qemu command line did you use, and did you enable zerocopy?

#15 lore raw
In reply to Zhangjie (HZ)
Quoted 10 lines · Zhangjie (HZ)
Quoted 1 line · Jason Wang

commit a9f98bb5ebe6fb1869321dcc58e72041ae626ad8 vhost: multiqueue

call it before setting

hw/net/vhost_net.c bool vhost_net_query(VHostNetState *net, VirtIODevice *dev) · line 194

Quoted 6 lines

Zhang Jie, please test this patch to see if it fixes the issue.

hw/net/vhost_net.c +4 -0
+static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index)
+{
+    net->dev.vq_index = vq_index;
+}

int vq_index)

Quoted 5 lines
Quoted 1 line

...

Because of vhost_net_set_vq_index, VM can be start successfully.
But, after about 80 times of migration under my environment, virtual nic became unreachable again. When I use jprobe to notify tap, the virtual nic becomes reachable again. This shows that interrupts missing causes the problem.

What about the patch
net: Forbid dealing with packets when VM is not
does it help if you additionally apply that one?

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie
#10 lore raw
In reply to Zhangjie (HZ)
Quoted 26 lines · Zhangjie (HZ)
Quoted 8 lines · Jason Wang
Quoted 5 lines · Zhangjie (HZ)

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

That sounds reasonable, but the test case is to test vhost.

Quoted 16 lines
Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Quoted 5 lines
Quoted 4 lines

Just want to confirm. For the problem did not occur, you mean with my patch on top?
.

I mean, with your patch, I have to test 80 times before it occurs, the probability is reduced.

Could you please try to apply the patch
[PATCH V4] net: Forbid dealing with packets when VM is not running
on top and see if this helps?

Thanks!

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie
#11 lore raw
Quoted 37 lines · Michael S. Tsirkin
Quoted 26 lines · Zhangjie (HZ)
Quoted 8 lines · Jason Wang
Quoted 5 lines · Zhangjie (HZ)

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

That sounds reasonable, but the test case is to test vhost.

Quoted 16 lines
Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Quoted 5 lines
Quoted 4 lines

Just want to confirm. For the problem did not occur, you mean with my patch on top?
.

I mean, with your patch, I have to test 80 times before it occurs, the probability is reduced.

Could you please try to apply the patch
[PATCH V4] net: Forbid dealing with packets when VM is not running
on top and see if this helps?

Quoted 7 lines

Thanks!

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie

.

Thanks! I will have a test.

Signature · 2 lines
Best Wishes!
Zhang Jie
#12 lore raw
Quoted 40 lines · Zhangjie (HZ)
Quoted 37 lines · Michael S. Tsirkin
Quoted 26 lines · Zhangjie (HZ)
Quoted 8 lines · Jason Wang
Quoted 5 lines · Zhangjie (HZ)

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

That sounds reasonable, but the test case is to test vhost.

Quoted 16 lines
Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Quoted 5 lines
Quoted 4 lines

Just want to confirm. For the problem did not occur, you mean with my patch on top?
.

I mean, with your patch, I have to test 80 times before it occurs, the probability is reduced.

Could you please try to apply the patch
[PATCH V4] net: Forbid dealing with packets when VM is not running
on top and see if this helps?

Quoted 8 lines
Quoted 7 lines

Thanks!

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie

.

Thanks! I will have a test.

Great, once you have the result of the two patches applied together, please let us know on the list.

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie
#13 lore raw
Quoted 50 lines · Michael S. Tsirkin
Quoted 40 lines · Zhangjie (HZ)
Quoted 37 lines · Michael S. Tsirkin
Quoted 26 lines · Zhangjie (HZ)
Quoted 8 lines · Jason Wang
Quoted 5 lines · Zhangjie (HZ)

After migration, vhost is not disabled, virtual nic became unreachable because vhost is not awakened. By the logical of EVENT_IDX, virtio-net will not kick vhost again if the used idx is not updated. So, if one interrupts is lost during migration, virtio_net will not kick vhost again. Then, no skb from virtio-net can be sent to tap.

Yes and I mean to test vhost=off to see if it was the issue of vhost.

That sounds reasonable, but the test case is to test vhost.

Quoted 16 lines
Quoted 4 lines

Jason's patch reduced the probability of occurrence, from about 1/20 to 1/80. It is really effective. I think the patch should be acked. May be we can try to solve the problem from another perspective. Do you have some methods to sense the migration? We can make up a signal from virtio-net after the migration.

You can make a patch like this to debug. If problem disappears, it means interrupt was really lost anyway.

Quoted 8 lines
Quoted 3 lines

Anyway, I will try to reproduce it by myself.

The test environment is really terrible, I build a environment myself, but it problem did not occur. The environment I use now is from a colleague Responsible for test work.
Two hosts, every host has about 20 vms, they send packages(ipv4 and ipv6) between each other. The VM to be migrated also sens packages itself, and there is a ping(-i 0.001) from another host to it. The physical nic is 1GE, connected through a internal nework.

Quoted 5 lines
Quoted 4 lines

Just want to confirm. For the problem did not occur, you mean with my patch on top?
.

I mean, with your patch, I have to test 80 times before it occurs, the probability is reduced.

Could you please try to apply the patch
[PATCH V4] net: Forbid dealing with packets when VM is not running
on top and see if this helps?

Quoted 8 lines
Quoted 7 lines

Thanks!

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie

.

Thanks! I will have a test.

Quoted 9 lines

Great, once you have the result of the two patches applied together, please let us know on the list.

Quoted 3 lines
Signature · 2 lines
Best Wishes!
Zhang Jie

.

I'm sorry for not giving test results in time, test resource is busy these days. Perhaps I can give the result next week.

Signature · 2 lines
Best Wishes!
Zhang Jie