Skip to content

Commit 8e7a6db

Browse files
vittyvkgregkh
authored andcommitted
Drivers: hv: balloon: keep track of where ha_region starts
commit 7cf3b79ec85ee1a5bbaaf936bb1d050dc652983b upstream. Windows 2012 (non-R2) does not specify hot add region in hot add requests and the logic in hot_add_req() is trying to find a 128Mb-aligned region covering the request. It may also happen that host's requests are not 128Mb aligned and the created ha_region will start before the first specified PFN. We can't online these non-present pages but we don't remember the real start of the region. This is a regression introduced by the commit 5abbbb7 ("Drivers: hv: hv_balloon: don't lose memory when onlining order is not natural"). While the idea of keeping the 'moving window' was wrong (as there is no guarantee that hot add requests come ordered) we should still keep track of covered_start_pfn. This is not a revert, the logic is different. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 397488e commit 8e7a6db

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/hv/hv_balloon.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,13 +430,14 @@ struct dm_info_msg {
430430
* currently hot added. We hot add in multiples of 128M
431431
* chunks; it is possible that we may not be able to bring
432432
* online all the pages in the region. The range
433-
* covered_end_pfn defines the pages that can
433+
* covered_start_pfn:covered_end_pfn defines the pages that can
434434
* be brough online.
435435
*/
436436

437437
struct hv_hotadd_state {
438438
struct list_head list;
439439
unsigned long start_pfn;
440+
unsigned long covered_start_pfn;
440441
unsigned long covered_end_pfn;
441442
unsigned long ha_end_pfn;
442443
unsigned long end_pfn;
@@ -682,7 +683,8 @@ static void hv_online_page(struct page *pg)
682683

683684
list_for_each(cur, &dm_device.ha_region_list) {
684685
has = list_entry(cur, struct hv_hotadd_state, list);
685-
cur_start_pgp = (unsigned long)pfn_to_page(has->start_pfn);
686+
cur_start_pgp = (unsigned long)
687+
pfn_to_page(has->covered_start_pfn);
686688
cur_end_pgp = (unsigned long)pfn_to_page(has->covered_end_pfn);
687689

688690
if (((unsigned long)pg >= cur_start_pgp) &&
@@ -854,6 +856,7 @@ static unsigned long process_hot_add(unsigned long pg_start,
854856
list_add_tail(&ha_region->list, &dm_device.ha_region_list);
855857
ha_region->start_pfn = rg_start;
856858
ha_region->ha_end_pfn = rg_start;
859+
ha_region->covered_start_pfn = pg_start;
857860
ha_region->covered_end_pfn = pg_start;
858861
ha_region->end_pfn = rg_start + rg_size;
859862
}

0 commit comments

Comments
 (0)