Skip to contentSkip to conversation

update balloon size in balloon "probe"

PATCH Superseded Denis V. Lunev 3 participants 7 messages Sep 23, 2016 – Sep 28, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 update balloon size in balloon "probe"

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
 drivers/virtio/virtio_balloon.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +4 -0
index 4e7003d..0a6c10f 100644
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
+	if (towards_target(vb))
+		virtballoon_changed(vdev);
+	update_balloon_size(vb);
+
 	return 0;
 
 out_del_vqs:
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

+ add_wait_queue(&vb->config_change, &wait);
+ for (;;) {
+ if ((diff = towards_target(vb)) != 0 ||

+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))

+ break;
+ wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+ }
+ remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

The issue is more likely with this patch:

	commit fad7b7b27b6a168ca8ebc84482043886f837b89d
	Author: Petr Mladek <[email protected]>
	Date:   Mon Jan 25 17:38:05 2016 +0100

	    virtio_balloon: Use a workqueue instead of "vballoon" kthread
Quoted 15 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
 drivers/virtio/virtio_balloon.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct virtio_device *vdev) · line 586

Quoted 10 lines
drivers/virtio/virtio_balloon.c +4 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
+	if (towards_target(vb))
+		virtballoon_changed(vdev);
+	update_balloon_size(vb);
+
 	return 0;
 
 out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

        if (towards_target(vb))
                virtballoon_changed(vdev);
        update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

Quoted 2 lines
Signature · 1 line
2.7.4
#2 lore raw
In reply to Denis V. Lunev
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

+ add_wait_queue(&vb->config_change, &wait);
+ for (;;) {
+ if ((diff = towards_target(vb)) != 0 ||

+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))

+ break;
+ wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+ }
+ remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

The issue is more likely with this patch:

	commit fad7b7b27b6a168ca8ebc84482043886f837b89d
	Author: Petr Mladek <[email protected]>
	Date:   Mon Jan 25 17:38:05 2016 +0100

	    virtio_balloon: Use a workqueue instead of "vballoon" kthread
Quoted 15 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
 drivers/virtio/virtio_balloon.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct virtio_device *vdev) · line 586

Quoted 10 lines
drivers/virtio/virtio_balloon.c +4 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct virtio_device *vdev)
 
 	virtio_device_ready(vdev);
 
+	if (towards_target(vb))
+		virtballoon_changed(vdev);
+	update_balloon_size(vb);
+
 	return 0;
 
 out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

        if (towards_target(vb))
                virtballoon_changed(vdev);
        update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

Quoted 2 lines
Signature · 1 line
2.7.4
#3 lore raw
Quoted 26 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

(quoted diff) +10 -0
+               add_wait_queue(&vb->config_change, &wait);
+               for (;;) {
+                       if ((diff = towards_target(vb)) != 0 ||
+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))
+                               break;
+                       wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+               }
+               remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

Quoted 7 lines

The issue is more likely with this patch:

	commit fad7b7b27b6a168ca8ebc84482043886f837b89d
	Author: Petr Mladek <[email protected]>
	Date:   Mon Jan 25 17:38:05 2016 +0100

	    virtio_balloon: Use a workqueue instead of "vballoon" kthread

yes, you are right, sorry, commit message is incorrect.

Quoted 31 lines
Quoted 18 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
  drivers/virtio/virtio_balloon.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct virtio_device *vdev) · line 586

Quoted 10 lines
drivers/virtio/virtio_balloon.c +4 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct virtio_device *vdev)
 
  	virtio_device_ready(vdev);
 
+	if (towards_target(vb))
+		virtballoon_changed(vdev);
+	update_balloon_size(vb);
+
  	return 0;
 
  out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

Quoted 6 lines
         if (towards_target(vb))
                 virtballoon_changed(vdev);
         update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

in virtballoon_probe we just init work items, but if we have a target
- num_pages != 0
we will catch it only after virtballoon_changed will be called, isn't it?

So, I believe, on probe, we have to do the same thing as on restore:
check towards_target(vb)
and call virtballoon_changed(vdev) if necessary.

Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
-- 
2.7.4
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 26 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

(quoted diff) +10 -0
+               add_wait_queue(&vb->config_change, &wait);
+               for (;;) {
+                       if ((diff = towards_target(vb)) != 0 ||
+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))
+                               break;
+                       wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
+               }
+               remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

Quoted 7 lines

The issue is more likely with this patch:

	commit fad7b7b27b6a168ca8ebc84482043886f837b89d
	Author: Petr Mladek <[email protected]>
	Date:   Mon Jan 25 17:38:05 2016 +0100

	    virtio_balloon: Use a workqueue instead of "vballoon" kthread

yes, you are right, sorry, commit message is incorrect.

Quoted 31 lines
Quoted 18 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
  drivers/virtio/virtio_balloon.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct virtio_device *vdev) · line 586

Quoted 10 lines
drivers/virtio/virtio_balloon.c +4 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct virtio_device *vdev)
 
  	virtio_device_ready(vdev);
 
+	if (towards_target(vb))
+		virtballoon_changed(vdev);
+	update_balloon_size(vb);
+
  	return 0;
 
  out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

Quoted 6 lines
         if (towards_target(vb))
                 virtballoon_changed(vdev);
         update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

in virtballoon_probe we just init work items, but if we have a target
- num_pages != 0
we will catch it only after virtballoon_changed will be called, isn't it?

So, I believe, on probe, we have to do the same thing as on restore:
check towards_target(vb)
and call virtballoon_changed(vdev) if necessary.

Quoted 3 lines
Quoted 3 lines
Signature · 2 lines
-- 
2.7.4
#5 lore raw
Quoted 70 lines · Konstantin Neumoin
Quoted 27 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

(quoted diff) +8 -0
+               add_wait_queue(&vb->config_change, &wait);
+               for (;;) {
+                       if ((diff = towards_target(vb)) != 0 ||
+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))
+                               break;
+                       wait_woken(&wait, TASK_INTERRUPTIBLE, 

MAX_SCHEDULE_TIMEOUT);

(quoted diff) +2 -0
+               }
+               remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

Quoted 7 lines

The issue is more likely with this patch:

commit fad7b7b27b6a168ca8ebc84482043886f837b89d
Author: Petr Mladek <[email protected]>
Date: Mon Jan 25 17:38:05 2016 +0100

virtio_balloon: Use a workqueue instead of "vballoon" kthread

yes, you are right, sorry, commit message is incorrect.

Quoted 28 lines
Quoted 17 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
  drivers/virtio/virtio_balloon.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct · line 584

Quoted 8 lines
drivers/virtio/virtio_balloon.c +3 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct 
 virtio_device *vdev)
        virtio_device_ready(vdev);
  +    if (towards_target(vb))
+        virtballoon_changed(vdev);
+    update_balloon_size(vb);
+
      return 0;
    out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

Quoted 6 lines
         if (towards_target(vb))
                 virtballoon_changed(vdev);
         update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

Quoted 8 lines

in virtballoon_probe we just init work items, but if we have a target
- num_pages != 0
we will catch it only after virtballoon_changed will be called, isn't it?

So, I believe, on probe, we have to do the same thing as on restore:
check towards_target(vb)
and call virtballoon_changed(vdev) if necessary.

Quoted 1 line

Also we could try inflate the balloon once(by fill_balloon()) on probe
and it leads to config change,
but we will not receive this notification because of config change pending will be enabled after drv->prob() in virtio_dev_probe.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.7.4
#6 lore raw
In reply to Konstantin Neumoin
Quoted 70 lines · Konstantin Neumoin
Quoted 27 lines · Michael S. Tsirkin
Quoted 10 lines · Denis V. Lunev

From: Konstantin Neumoin <[email protected]>

Patch
Commit 3d2a3774c1b046f548ebea0391a602fd5685a307
Author: Michael S. Tsirkin <[email protected]>
Date: Tue Mar 10 11:55:08 2015 +1030
virtio-balloon: do not call blocking ops when !TASK_RUNNING
has added a regression. Original code with wait_event_interruptible checked the condition before start waiting and started balloon operations if necessary.

I don't get it, sorry.

(quoted diff) +8 -0
+               add_wait_queue(&vb->config_change, &wait);
+               for (;;) {
+                       if ((diff = towards_target(vb)) != 0 ||
+                           vb->need_stats_update ||
+                           kthread_should_stop() ||
+                           freezing(current))
+                               break;
+                       wait_woken(&wait, TASK_INTERRUPTIBLE, 

MAX_SCHEDULE_TIMEOUT);

(quoted diff) +2 -0
+               }
+               remove_wait_queue(&vb->config_change, &wait);

Seems to check the condition before waiting.

Quoted 7 lines

The issue is more likely with this patch:

commit fad7b7b27b6a168ca8ebc84482043886f837b89d
Author: Petr Mladek <[email protected]>
Date: Mon Jan 25 17:38:05 2016 +0100

virtio_balloon: Use a workqueue instead of "vballoon" kthread

yes, you are right, sorry, commit message is incorrect.

Quoted 28 lines
Quoted 17 lines

Right now balloon is not inflated if ballon target is set before the driver is loaded.

---
  drivers/virtio/virtio_balloon.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/virtio/virtio_balloon.c +0 -0
index 4e7003d..0a6c10f 100644

drivers/virtio/virtio_balloon.c static int virtballoon_probe(struct · line 584

Quoted 8 lines
drivers/virtio/virtio_balloon.c +3 -0
@@ -577,6 +577,10 @@ static int virtballoon_probe(struct 
 virtio_device *vdev)
        virtio_device_ready(vdev);
  +    if (towards_target(vb))
+        virtballoon_changed(vdev);
+    update_balloon_size(vb);
+
      return 0;
    out_del_vqs:

I know we have same thing on restore, but it seems bogus there as well:

Quoted 6 lines
         if (towards_target(vb))
                 virtballoon_changed(vdev);
         update_balloon_size(vb);

makes no sense because virtballoon_changed merely queues the work.

Quoted 8 lines

in virtballoon_probe we just init work items, but if we have a target
- num_pages != 0
we will catch it only after virtballoon_changed will be called, isn't it?

So, I believe, on probe, we have to do the same thing as on restore:
check towards_target(vb)
and call virtballoon_changed(vdev) if necessary.

Quoted 1 line

Also we could try inflate the balloon once(by fill_balloon()) on probe
and it leads to config change,
but we will not receive this notification because of config change pending will be enabled after drv->prob() in virtio_dev_probe.

Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
2.7.4