Patch "virtio_balloon: fix PFN format for virtio-1" has been added to the 4.6-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
virtio_balloon: fix PFN format for virtio-1
to the 4.6-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
virtio_balloon-fix-pfn-format-for-virtio-1.patch
and it can be found in the queue-4.6 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
87c9403b0d1de4676b0bd273eea68fcf6de68e68Mon Sep 17 00:00:00 2001
From: "Michael S. Tsirkin" <[email protected]>
Date: Tue, 17 May 2016 13:31:18 +0300
Subject: virtio_balloon: fix PFN format for virtio-1
From: Michael S. Tsirkin <[email protected]>
commit 87c9403b0d1de4676b0bd273eea68fcf6de68e68 upstream.
Everything should be LE when using virtio-1, but the linux balloon driver does not seem to care about that.
--- drivers/virtio/virtio_balloon.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/virtio/virtio_balloon.c +12 -8
@@ -75,7 +75,7 @@ struct virtio_balloon {/* The array of pfns we tell the Host about. */ unsigned int num_pfns; -u32 pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX ]; +__virtio32 pfns[VIRTIO_BALLOON_ARRAY_PFNS_MAX ];/* Memory statistics */ struct virtio_balloon_stat stats[VIRTIO_BALLOON_S_NR ];
@@ -127,14 +127,16 @@ static void tell_host(struct virtio_ball } -static void set_page_pfns (u32 pfns[],struct page *page) +static void set_page_pfns (struct virtio_balloon *vb, +__virtio32 pfns[],struct page *page) {unsigned int i;/* Set balloon pfns pointing at this page. * Note that the first pfn points at start of the page. */ for (i =0 ; i <VIRTIO_BALLOON_PAGES_PER_PAGE ; i++) - pfns[i] =page_to_balloon_pfn (page) + i; + pfns[i] =cpu_to_virtio32 (vb->vdev, +page_to_balloon_pfn (page) + i); }static unsigned fill_balloon (struct virtio_balloon *vb,size_t num)
@@ -158,7 +160,7 @@ static unsigned fill_balloon(struct virtmsleep (200 );break ; } -set_page_pfns (vb->pfns + vb->num_pfns, 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 ))
@@ -177,10 +179,12 @@ static unsigned fill_balloon(struct virtstatic void release_pages_balloon (struct virtio_balloon *vb) {unsigned int i; +struct page *page;/* Find pfns pointing at start of each page, get pages and free them. */ for (i =0 ; i < vb->num_pfns; i +=VIRTIO_BALLOON_PAGES_PER_PAGE ) { -struct page *page =balloon_pfn_to_page (vb->pfns[i]); + page =balloon_pfn_to_page (virtio32_to_cpu (vb->vdev, + vb->pfns[i]));if (!virtio_has_feature (vb->vdev,VIRTIO_BALLOON_F_DEFLATE_ON_OOM ))adjust_managed_page_count (page,1 );
@@ -203,7 +207,7 @@ static unsigned leak_balloon(struct virt page =balloon_page_dequeue (vb_dev_info);if (!page)break ; -set_page_pfns (vb->pfns + vb->num_pfns, page); +set_page_pfns (vb, vb->pfns + vb->num_pfns, page); vb->num_pages -=VIRTIO_BALLOON_PAGES_PER_PAGE ; }
@@ -471,13 +475,13 @@ static int virtballoon_migratepage(struc__count_vm_event (BALLOON_MIGRATE );spin_unlock_irqrestore (&vb_dev_info->pages_lock, flags); vb->num_pfns =VIRTIO_BALLOON_PAGES_PER_PAGE ; -set_page_pfns (vb->pfns, newpage); +set_page_pfns (vb, vb->pfns, newpage);tell_host (vb, vb->inflate_vq);/* balloon's page migration 2nd step -- deflate "page" */ balloon_page_delete (page); vb->num_pfns =VIRTIO_BALLOON_PAGES_PER_PAGE ; -set_page_pfns (vb->pfns, page); +set_page_pfns (vb, vb->pfns, page);tell_host (vb, vb->deflate_vq);mutex_unlock (&vb->balloon_lock);
Patches currently in stable-queue which might be from [email protected] are
queue-4.6/virtio_balloon-fix-pfn-format-for-virtio-1.patch