Skip to contentSkip to conversation

virtio-balloon: tweak config_changed

PATCH Superseded Wei Wang 4 participants 17 messages Jan 3, 2019 – Jan 4, 2019

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Wang

author
#0 lore raw

cover virtio-balloon: tweak config_changed

Since virtio-ccw doesn't work with accessing to the config registers inside an interrupt context, this patch series avoids that issue by moving the config register accesses to the related workqueue contexts.

Wei Wang (2):
virtio-balloon: tweak config_changed implementation
virtio-balloon: improve update_balloon_size_func

 drivers/virtio/virtio_balloon.c | 59 +++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 29 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 virtio-balloon: tweak config_changed implementation

virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

---
 drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/virtio/virtio_balloon.c +26 -28
index 728ecd1..9a82a11 100644
@@ -394,33 +394,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
 {
 	struct virtio_balloon *vb = vdev->priv;
 	unsigned long flags;
-	s64 diff = towards_target(vb);
-
-	if (diff) {
-		spin_lock_irqsave(&vb->stop_update_lock, flags);
-		if (!vb->stop_update)
-			queue_work(system_freezable_wq,
-				   &vb->update_balloon_size_work);
-		spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-	}
 
-	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
-		virtio_cread(vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id, &vb->cmd_id_received);
-		if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
-			/* Pass ULONG_MAX to give back all the free pages */
-			return_free_pages_to_mm(vb, ULONG_MAX);
-		} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
-			   vb->cmd_id_received !=
-			   virtio32_to_cpu(vdev, vb->cmd_id_active)) {
-			spin_lock_irqsave(&vb->stop_update_lock, flags);
-			if (!vb->stop_update) {
-				queue_work(vb->balloon_wq,
-					   &vb->report_free_page_work);
-			}
-			spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-		}
+	spin_lock_irqsave(&vb->stop_update_lock, flags);
+	if (!vb->stop_update) {
+		queue_work(system_freezable_wq,
+			   &vb->update_balloon_size_work);
+		if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
+			queue_work(vb->balloon_wq, &vb->report_free_page_work);
 	}
+	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
 }
 
 static void update_balloon_size(struct virtio_balloon *vb)
@@ -637,11 +619,9 @@ static int send_free_pages(struct virtio_balloon *vb)
 	return 0;
 }
 
-static void report_free_page_func(struct work_struct *work)
+static void virtio_balloon_report_free_page(struct virtio_balloon *vb)
 {
 	int err;
-	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
-						 report_free_page_work);
 	struct device *dev = &vb->vdev->dev;
 
 	/* Start by sending the received cmd id to host with an outbuf. */
@@ -659,6 +639,24 @@ static void report_free_page_func(struct work_struct *work)
 		dev_err(dev, "Failed to send a stop id, err = %d\n", err);
 }
 
+static void report_free_page_func(struct work_struct *work)
+{
+	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
+						 report_free_page_work);
+
+	virtio_cread(vb->vdev, struct virtio_balloon_config,
+		     free_page_report_cmd_id, &vb->cmd_id_received);
+
+	if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
+		/* Pass ULONG_MAX to give back all the free pages */
+		return_free_pages_to_mm(vb, ULONG_MAX);
+	} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
+		   vb->cmd_id_received !=
+		   virtio32_to_cpu(vb->vdev, vb->cmd_id_active)) {
+		virtio_balloon_report_free_page(vb);
+	}
+}
+
 #ifdef CONFIG_BALLOON_COMPACTION
 /*
  * virtballoon_migratepage - perform the balloon page migration on behalf of
Signature · 1 line
2.7.4
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

Quoted 1 line · On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang <[email protected]> wrote:

virtio-ccw has deadlock issues with reading config registers inside the

s/config registers/the config space/ ?

Quoted 2 lines

interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

Also credit Christian with a Reported-by:?

Quoted 5 lines
---
 drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
author
#3 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

Quoted 5 lines · Cornelia Huck
Quoted 1 line · On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang <[email protected]> wrote:

virtio-ccw has deadlock issues with reading config registers inside the

s/config registers/the config space/ ?

Sounds good.

Quoted 4 lines
Quoted 3 lines

interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

Also credit Christian with a Reported-by:?

Yes, definitely. Sorry for missing that.

Best,
Wei

author
#4 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Cornelia Huck
Quoted 5 lines · Cornelia Huck
Quoted 1 line · On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang <[email protected]> wrote:

virtio-ccw has deadlock issues with reading config registers inside the

s/config registers/the config space/ ?

Sounds good.

Quoted 4 lines
Quoted 3 lines

interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

Also credit Christian with a Reported-by:?

Yes, definitely. Sorry for missing that.

Best,
Wei

Reviewed-by on v1 1/2
#5 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Wei Wang
Quoted 1 line · On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang <[email protected]> wrote:

virtio-ccw has deadlock issues with reading config registers inside the

s/config registers/the config space/ ?

Quoted 2 lines

interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

Also credit Christian with a Reported-by:?

Quoted 5 lines
---
 drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
Reviewed-by on v1 1/2
#6 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Wei Wang
Quoted 2 lines · On Thu, 3 Jan 2019 13:31:01 +0800 Wei Wang <[email protected]> wrote:

virtio-ccw has deadlock issues with reading config registers inside the interrupt context

I would say something like 'virtio-ccw does not support using virtio_config_ops from an atomic context' as the limitation is not limited to read config (aka. get()). But I'm fine with your formulation as well.

Quoted 4 lines

, so we tweak the virtballoon_changed implementation
by moving the config read operations into the related workqueue contexts.

[..]

#7 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Wei Wang
Quoted 20 lines · Wei Wang

virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

---
 drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/virtio/virtio_balloon.c +0 -3
index 728ecd1..9a82a11 100644
@@ -394,33 +394,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
 {
 	struct virtio_balloon *vb = vdev->priv;
 	unsigned long flags;
-	s64 diff = towards_target(vb);
-
-	if (diff) {

drivers/virtio/virtio_balloon.c static void virtballoon_changed(struct virtio_device *vdev) · line 409

Quoted 10 lines
drivers/virtio/virtio_balloon.c +0 -9
-		spin_lock_irqsave(&vb->stop_update_lock, flags);
-		if (!vb->stop_update)
-			queue_work(system_freezable_wq,
-				   &vb->update_balloon_size_work);
-		spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-	}
 
-	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
-		virtio_cread(vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id, &vb->cmd_id_received);

There's one problem with this approach:

previously updating the cmd_id_received here would immediately stop the report in send_free_pages.

With this approach we are waiting for the wq to schedule, which might be blocked waiting for report to complete. So host can no longer quickly stop the report in progress.

A simple work-around would be to set some kind of flag whenever there is a change interrupt, then have send_free_pages test it and re-read cmd_id_received.

Needs to be an atomic I guess ...

Quoted 64 lines
drivers/virtio/virtio_balloon.c +26 -16
-		if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
-			/* Pass ULONG_MAX to give back all the free pages */
-			return_free_pages_to_mm(vb, ULONG_MAX);
-		} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
-			   vb->cmd_id_received !=
-			   virtio32_to_cpu(vdev, vb->cmd_id_active)) {
-			spin_lock_irqsave(&vb->stop_update_lock, flags);
-			if (!vb->stop_update) {
-				queue_work(vb->balloon_wq,
-					   &vb->report_free_page_work);
-			}
-			spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-		}
+	spin_lock_irqsave(&vb->stop_update_lock, flags);
+	if (!vb->stop_update) {
+		queue_work(system_freezable_wq,
+			   &vb->update_balloon_size_work);
+		if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
+			queue_work(vb->balloon_wq, &vb->report_free_page_work);
 	}
+	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
 }
 
 static void update_balloon_size(struct virtio_balloon *vb)
@@ -637,11 +619,9 @@ static int send_free_pages(struct virtio_balloon *vb)
 	return 0;
 }
 
-static void report_free_page_func(struct work_struct *work)
+static void virtio_balloon_report_free_page(struct virtio_balloon *vb)
 {
 	int err;
-	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
-						 report_free_page_work);
 	struct device *dev = &vb->vdev->dev;
 
 	/* Start by sending the received cmd id to host with an outbuf. */
@@ -659,6 +639,24 @@ static void report_free_page_func(struct work_struct *work)
 		dev_err(dev, "Failed to send a stop id, err = %d\n", err);
 }
 
+static void report_free_page_func(struct work_struct *work)
+{
+	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
+						 report_free_page_work);
+
+	virtio_cread(vb->vdev, struct virtio_balloon_config,
+		     free_page_report_cmd_id, &vb->cmd_id_received);
+
+	if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
+		/* Pass ULONG_MAX to give back all the free pages */
+		return_free_pages_to_mm(vb, ULONG_MAX);
+	} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
+		   vb->cmd_id_received !=
+		   virtio32_to_cpu(vb->vdev, vb->cmd_id_active)) {
+		virtio_balloon_report_free_page(vb);
+	}
+}
+
 #ifdef CONFIG_BALLOON_COMPACTION
 /*
  * virtballoon_migratepage - perform the balloon page migration on behalf of
Signature · 1 line
2.7.4
author
#8 lore raw

Re: [virtio-dev] Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

Quoted 40 lines · Michael S. Tsirkin
Quoted 20 lines · Wei Wang

virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

---
  drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
  1 file changed, 26 insertions(+), 28 deletions(-)
drivers/virtio/virtio_balloon.c +0 -3
index 728ecd1..9a82a11 100644
@@ -394,33 +394,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
  {
  	struct virtio_balloon *vb = vdev->priv;
  	unsigned long flags;
-	s64 diff = towards_target(vb);
-
-	if (diff) {

drivers/virtio/virtio_balloon.c static void virtballoon_changed(struct virtio_device *vdev) · line 409

Quoted 10 lines
drivers/virtio/virtio_balloon.c +0 -9
-		spin_lock_irqsave(&vb->stop_update_lock, flags);
-		if (!vb->stop_update)
-			queue_work(system_freezable_wq,
-				   &vb->update_balloon_size_work);
-		spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-	}
 
-	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
-		virtio_cread(vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id, &vb->cmd_id_received);

There's one problem with this approach:

previously updating the cmd_id_received here would immediately stop the report in send_free_pages.

With this approach we are waiting for the wq to schedule, which might be blocked waiting for report to complete. So host can no longer quickly stop the report in progress.

Quoted 6 lines

A simple work-around would be to set some kind of flag whenever there is a change interrupt, then have send_free_pages test it and re-read cmd_id_received.

Needs to be an atomic I guess ...

Yes, sounds better..will update the patch.

Best,
Wei

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

author
#9 lore raw

Re: [virtio-dev] Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Michael S. Tsirkin
Quoted 40 lines · Michael S. Tsirkin
Quoted 20 lines · Wei Wang

virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

---
  drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
  1 file changed, 26 insertions(+), 28 deletions(-)
drivers/virtio/virtio_balloon.c +0 -3
index 728ecd1..9a82a11 100644
@@ -394,33 +394,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
  {
  	struct virtio_balloon *vb = vdev->priv;
  	unsigned long flags;
-	s64 diff = towards_target(vb);
-
-	if (diff) {

drivers/virtio/virtio_balloon.c static void virtballoon_changed(struct virtio_device *vdev) · line 409

Quoted 10 lines
drivers/virtio/virtio_balloon.c +0 -9
-		spin_lock_irqsave(&vb->stop_update_lock, flags);
-		if (!vb->stop_update)
-			queue_work(system_freezable_wq,
-				   &vb->update_balloon_size_work);
-		spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-	}
 
-	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
-		virtio_cread(vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id, &vb->cmd_id_received);

There's one problem with this approach:

previously updating the cmd_id_received here would immediately stop the report in send_free_pages.

With this approach we are waiting for the wq to schedule, which might be blocked waiting for report to complete. So host can no longer quickly stop the report in progress.

Quoted 6 lines

A simple work-around would be to set some kind of flag whenever there is a change interrupt, then have send_free_pages test it and re-read cmd_id_received.

Needs to be an atomic I guess ...

Yes, sounds better..will update the patch.

Best,
Wei

#10 lore raw

Re: [PATCH v1 1/2] virtio-balloon: tweak config_changed implementation

In reply to Wei Wang
Quoted 20 lines · Wei Wang

virtio-ccw has deadlock issues with reading config registers inside the interrupt context, so we tweak the virtballoon_changed implementation by moving the config read operations into the related workqueue contexts.

---
 drivers/virtio/virtio_balloon.c | 54 ++++++++++++++++++++---------------------
 1 file changed, 26 insertions(+), 28 deletions(-)
drivers/virtio/virtio_balloon.c +0 -3
index 728ecd1..9a82a11 100644
@@ -394,33 +394,15 @@ static void virtballoon_changed(struct virtio_device *vdev)
 {
 	struct virtio_balloon *vb = vdev->priv;
 	unsigned long flags;
-	s64 diff = towards_target(vb);
-
-	if (diff) {

drivers/virtio/virtio_balloon.c static void virtballoon_changed(struct virtio_device *vdev) · line 409

Quoted 10 lines
drivers/virtio/virtio_balloon.c +0 -9
-		spin_lock_irqsave(&vb->stop_update_lock, flags);
-		if (!vb->stop_update)
-			queue_work(system_freezable_wq,
-				   &vb->update_balloon_size_work);
-		spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-	}
 
-	if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
-		virtio_cread(vdev, struct virtio_balloon_config,
-			     free_page_report_cmd_id, &vb->cmd_id_received);

There's one problem with this approach:

previously updating the cmd_id_received here would immediately stop the report in send_free_pages.

With this approach we are waiting for the wq to schedule, which might be blocked waiting for report to complete. So host can no longer quickly stop the report in progress.

A simple work-around would be to set some kind of flag whenever there is a change interrupt, then have send_free_pages test it and re-read cmd_id_received.

Needs to be an atomic I guess ...

Quoted 64 lines
drivers/virtio/virtio_balloon.c +26 -16
-		if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
-			/* Pass ULONG_MAX to give back all the free pages */
-			return_free_pages_to_mm(vb, ULONG_MAX);
-		} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
-			   vb->cmd_id_received !=
-			   virtio32_to_cpu(vdev, vb->cmd_id_active)) {
-			spin_lock_irqsave(&vb->stop_update_lock, flags);
-			if (!vb->stop_update) {
-				queue_work(vb->balloon_wq,
-					   &vb->report_free_page_work);
-			}
-			spin_unlock_irqrestore(&vb->stop_update_lock, flags);
-		}
+	spin_lock_irqsave(&vb->stop_update_lock, flags);
+	if (!vb->stop_update) {
+		queue_work(system_freezable_wq,
+			   &vb->update_balloon_size_work);
+		if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT))
+			queue_work(vb->balloon_wq, &vb->report_free_page_work);
 	}
+	spin_unlock_irqrestore(&vb->stop_update_lock, flags);
 }
 
 static void update_balloon_size(struct virtio_balloon *vb)
@@ -637,11 +619,9 @@ static int send_free_pages(struct virtio_balloon *vb)
 	return 0;
 }
 
-static void report_free_page_func(struct work_struct *work)
+static void virtio_balloon_report_free_page(struct virtio_balloon *vb)
 {
 	int err;
-	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
-						 report_free_page_work);
 	struct device *dev = &vb->vdev->dev;
 
 	/* Start by sending the received cmd id to host with an outbuf. */
@@ -659,6 +639,24 @@ static void report_free_page_func(struct work_struct *work)
 		dev_err(dev, "Failed to send a stop id, err = %d\n", err);
 }
 
+static void report_free_page_func(struct work_struct *work)
+{
+	struct virtio_balloon *vb = container_of(work, struct virtio_balloon,
+						 report_free_page_work);
+
+	virtio_cread(vb->vdev, struct virtio_balloon_config,
+		     free_page_report_cmd_id, &vb->cmd_id_received);
+
+	if (vb->cmd_id_received == VIRTIO_BALLOON_CMD_ID_DONE) {
+		/* Pass ULONG_MAX to give back all the free pages */
+		return_free_pages_to_mm(vb, ULONG_MAX);
+	} else if (vb->cmd_id_received != VIRTIO_BALLOON_CMD_ID_STOP &&
+		   vb->cmd_id_received !=
+		   virtio32_to_cpu(vb->vdev, vb->cmd_id_active)) {
+		virtio_balloon_report_free_page(vb);
+	}
+}
+
 #ifdef CONFIG_BALLOON_COMPACTION
 /*
  * virtballoon_migratepage - perform the balloon page migration on behalf of
Signature · 1 line
2.7.4
author
#11 lore raw

PATCH 2/2 virtio-balloon: improve update_balloon_size_func

In reply to Wei Wang

There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0.

---
 drivers/virtio/virtio_balloon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +4 -1
index 9a82a11..4884b85 100644
@@ -435,9 +435,12 @@ static void update_balloon_size_func(struct work_struct *work)
 			  update_balloon_size_work);
 	diff = towards_target(vb);
 
+	if (!diff)
+		return;
+
 	if (diff > 0)
 		diff -= fill_balloon(vb, diff);
-	else if (diff < 0)
+	else
 		diff += leak_balloon(vb, -diff);
 	update_balloon_size(vb);
 
Signature · 1 line
2.7.4
Reviewed-by on v1 2/2
#12 lore raw

Re: [PATCH v1 2/2] virtio-balloon: improve update_balloon_size_func

Quoted 7 lines · On Thu, 3 Jan 2019 13:31:02 +0800 Wei Wang <[email protected]> wrote:

There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0.

---
 drivers/virtio/virtio_balloon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by on v1 2/2
#13 lore raw

Re: [PATCH v1 2/2] virtio-balloon: improve update_balloon_size_func

In reply to Wei Wang
Quoted 7 lines · On Thu, 3 Jan 2019 13:31:02 +0800 Wei Wang <[email protected]> wrote:

There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0.

---
 drivers/virtio/virtio_balloon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by on v1 2/2
#14 lore raw

Re: [PATCH v1 2/2] virtio-balloon: improve update_balloon_size_func

In reply to Wei Wang
Quoted 4 lines · On Thu, 3 Jan 2019 13:31:02 +0800 Wei Wang <[email protected]> wrote:

There is no need to update the balloon actual register when there is no ballooning request. This patch avoids update_balloon_size when diff is 0.

I would be also fine with both patches squashed into one.

BTW the end result looks to me even a bit nicer.

#15 lore raw
In reply to Wei Wang
Quoted 11 lines · On Thu, 3 Jan 2019 13:31:00 +0800 Wei Wang <[email protected]> wrote:

Since virtio-ccw doesn't work with accessing to the config registers inside an interrupt context, this patch series avoids that issue by moving the config register accesses to the related workqueue contexts.

Wei Wang (2):
virtio-balloon: tweak config_changed implementation
virtio-balloon: improve update_balloon_size_func

 drivers/virtio/virtio_balloon.c | 59 +++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 29 deletions(-)

A quick test (various 'balloon <num>' in the QEMU monitor) with a virtio-balloon-ccw device seems to work fine here.

#16 lore raw
In reply to Wei Wang
Quoted 11 lines · On Thu, 3 Jan 2019 13:31:00 +0800 Wei Wang <[email protected]> wrote:

Since virtio-ccw doesn't work with accessing to the config registers inside an interrupt context, this patch series avoids that issue by moving the config register accesses to the related workqueue contexts.

Wei Wang (2):
virtio-balloon: tweak config_changed implementation
virtio-balloon: improve update_balloon_size_func

 drivers/virtio/virtio_balloon.c | 59 +++++++++++++++++++++--------------------
 1 file changed, 30 insertions(+), 29 deletions(-)

A quick test (various 'balloon <num>' in the QEMU monitor) with a virtio-balloon-ccw device seems to work fine here.