Skip to contentSkip to conversation

virtio_balloon: refill by config handler

RFC PATCH In review Michael S. Tsirkin 2 participants 5 messages Jan 1, 2016 – Jan 5, 2016

Subsystems (2)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

RFC PATCH 1/1 virtio_balloon: refill by config handler

Peter Mladek reported that balloon might never refill completely after restore. This is because fill_balloon is only called once there. Calling fill_balloon repeatedly seems too aggressive, especially in light of the fact that it sleeps on failure: let's wake the config change handler and fill it asynchronously.

---

I was unable to test this - for some reason my test VM doesn't resume (with or without the patch). Petr, does this work for you?

 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index 7efc329..ee29473 100644
@@ -589,7 +589,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
-	fill_balloon(vb, towards_target(vb));
+	wake_up(&vb->config_change);
 	update_balloon_size(vb);
 	return 0;
 }
Signature · 1 line
MST
#1 lore raw
Quoted 6 lines · Michael S. Tsirkin

Peter Mladek reported that balloon might never refill completely after restore. This is because fill_balloon is only called once there. Calling fill_balloon repeatedly seems too aggressive, especially in light of the fact that it sleeps on failure: let's wake the config change handler and fill it asynchronously.

Quoted 7 lines

---

I was unable to test this - for some reason my test VM doesn't resume (with or without the patch). Petr, does this work for you?

Ah, I have just realized that the problem happens only after the conversion to the workqueue. It works without this patch with the current code. The balloon kthread is waken when released from __refrigerator().

I am sorry for the noise. I wanted to split the conversion to workqueues into two patches to make it better readable. We need to queue the balloon resizing work here. I wrongly assumed that the original kthread must have the same problem.

Best Regards,
Petr

Quoted 18 lines
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index 7efc329..ee29473 100644
@@ -589,7 +589,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
-	fill_balloon(vb, towards_target(vb));
+	wake_up(&vb->config_change);
 	update_balloon_size(vb);
 	return 0;
 }
Signature · 1 line
MST
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 6 lines · Michael S. Tsirkin

Peter Mladek reported that balloon might never refill completely after restore. This is because fill_balloon is only called once there. Calling fill_balloon repeatedly seems too aggressive, especially in light of the fact that it sleeps on failure: let's wake the config change handler and fill it asynchronously.

Quoted 7 lines

---

I was unable to test this - for some reason my test VM doesn't resume (with or without the patch). Petr, does this work for you?

Ah, I have just realized that the problem happens only after the conversion to the workqueue. It works without this patch with the current code. The balloon kthread is waken when released from __refrigerator().

I am sorry for the noise. I wanted to split the conversion to workqueues into two patches to make it better readable. We need to queue the balloon resizing work here. I wrongly assumed that the original kthread must have the same problem.

Best Regards,
Petr

Quoted 18 lines
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index 7efc329..ee29473 100644
@@ -589,7 +589,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
-	fill_balloon(vb, towards_target(vb));
+	wake_up(&vb->config_change);
 	update_balloon_size(vb);
 	return 0;
 }
Signature · 1 line
MST
author maintainer
#3 lore raw
Quoted 11 lines · Petr Mladek
Quoted 10 lines · Michael S. Tsirkin

Peter Mladek reported that balloon might never refill completely after restore. This is because fill_balloon is only called once there. Calling fill_balloon repeatedly seems too aggressive, especially in light of the fact that it sleeps on failure: let's wake the config change handler and fill it asynchronously.

---

Quoted 8 lines
Quoted 3 lines

I was unable to test this - for some reason my test VM doesn't resume (with or without the patch). Petr, does this work for you?

Ah, I have just realized that the problem happens only after the conversion to the workqueue. It works without this patch with the current code. The balloon kthread is waken when released from __refrigerator().

In fact, maybe we should drop fill_balloon and
update_balloon_size here?
Resume will finish faster ...

Quoted 26 lines

I am sorry for the noise. I wanted to split the conversion to workqueues into two patches to make it better readable. We need to queue the balloon resizing work here. I wrongly assumed that the original kthread must have the same problem.

Best Regards,
Petr

Quoted 18 lines
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index 7efc329..ee29473 100644
@@ -589,7 +589,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
-	fill_balloon(vb, towards_target(vb));
+	wake_up(&vb->config_change);
 	update_balloon_size(vb);
 	return 0;
 }
Signature · 1 line
MST
author maintainer
#4 lore raw
In reply to Petr Mladek
Quoted 11 lines · Petr Mladek
Quoted 10 lines · Michael S. Tsirkin

Peter Mladek reported that balloon might never refill completely after restore. This is because fill_balloon is only called once there. Calling fill_balloon repeatedly seems too aggressive, especially in light of the fact that it sleeps on failure: let's wake the config change handler and fill it asynchronously.

---

Quoted 8 lines
Quoted 3 lines

I was unable to test this - for some reason my test VM doesn't resume (with or without the patch). Petr, does this work for you?

Ah, I have just realized that the problem happens only after the conversion to the workqueue. It works without this patch with the current code. The balloon kthread is waken when released from __refrigerator().

In fact, maybe we should drop fill_balloon and
update_balloon_size here?
Resume will finish faster ...

Quoted 26 lines

I am sorry for the noise. I wanted to split the conversion to workqueues into two patches to make it better readable. We need to queue the balloon resizing work here. I wrongly assumed that the original kthread must have the same problem.

Best Regards,
Petr

Quoted 18 lines
 drivers/virtio/virtio_balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
index 7efc329..ee29473 100644
@@ -589,7 +589,7 @@ static int virtballoon_restore(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
-	fill_balloon(vb, towards_target(vb));
+	wake_up(&vb->config_change);
 	update_balloon_size(vb);
 	return 0;
 }
Signature · 1 line
MST