Skip to contentSkip to conversation

FAILED: patch "[PATCH] virtio_balloon: fix increment of vb->num_pfns in" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 11, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From d9e427f6ab8142d6868eb719e6a7851aafea56b6 Mon Sep 17 00:00:00 2001

From: Jan Stancek <[email protected]>
Date: Fri, 1 Dec 2017 10:50:28 +0100
Subject: [PATCH] virtio_balloon: fix increment of vb->num_pfns in
fill_balloon()

commit c7cdff0e8647 ("virtio_balloon: fix deadlock on OOM") changed code to increment vb->num_pfns before call to set_page_pfns(), which used to happen only after.

This patch fixes boot hang for me on ppc64le KVM guests.

Fixes c7cdff0e8647 ("virtio_balloon: fix deadlock on OOM")
Cc Michael S. Tsirkin <[email protected]>
Cc Tetsuo Handa <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Wei Wang <[email protected]>
drivers/virtio/virtio_balloon.c +1 -2
index 7960746f7597..a1fb52cb3f0a 100644
@@ -174,13 +174,12 @@ static unsigned fill_balloon(struct virtio_balloon *vb, size_t num)
 	while ((page = balloon_page_pop(&pages))) {
 		balloon_page_enqueue(&vb->vb_dev_info, page);
 
-		vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
-
 		set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
 		vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
 		if (!virtio_has_feature(vb->vdev,
 					VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
 			adjust_managed_page_count(page, -1);
+		vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
 	}
 
 	num_allocated_pages = vb->num_pfns;