From: Rusty Russell Date: Thu, 13 Mar 2014 00:53:38 +0000 (+1030) Subject: virtio_balloon: don't softlockup on huge balloon changes. X-Git-Tag: upstream/snapshot3+hdmi~3009 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f52e31dc5f5f61db5bd08576b8189ada2a8c9b82;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git virtio_balloon: don't softlockup on huge balloon changes. commit 1f74ef0f2d7d692fcd615621e0e734c3e7771413 upstream. When adding or removing 100G from a balloon: BUG: soft lockup - CPU#0 stuck for 22s! [vballoon:367] We have a wait_event_interruptible(), but the condition is always true (more ballooning to do) so we don't ever sleep. We also have a wait_event() for the host to ack, but that is also always true as QEMU is synchronous for balloon operations. Reported-by: Gopesh Kumar Chaudhary Signed-off-by: Rusty Russell Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index 34bdaba..36e7859 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c @@ -310,6 +310,12 @@ static int balloon(void *_vballoon) else if (diff < 0) leak_balloon(vb, -diff); update_balloon_size(vb); + + /* + * For large balloon changes, we could spend a lot of time + * and always have work to do. Be nice if preempt disabled. + */ + cond_resched(); } return 0; }