From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756980AbcHXVey (ORCPT ); Wed, 24 Aug 2016 17:34:54 -0400 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:44076 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756794AbcHXVef (ORCPT ); Wed, 24 Aug 2016 17:34:35 -0400 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, alexng@microsoft.com Cc: "K. Y. Srinivasan" Subject: [PATCH 1/5] Drivers: hv: balloon: keep track of where ha_region starts Date: Wed, 24 Aug 2016 16:23:09 -0700 Message-Id: <1472080993-29694-1-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1472080943-29654-1-git-send-email-kys@exchange.microsoft.com> References: <1472080943-29654-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfP33fSlrRnJvZyP7T+nDQU24dRsoiJO1UPzln4yuXpliSP+OWv93uSrKEPHILn62QUuzeGbNxdlBuVdFrk00oHZr5QLBBtyyIG9UviKFu2aDKPXoe23S oD0DhUHTGP0NQqSZqoe1Knc0xqx7pcMPWUJ7PmFs09uN26cpM+5/sgVEu3xKXopu5HmPBSTGVYS4JuCmJd1V+9RhmxjVf8CpqU/IbiNt9pZBlCefmPLEVzMs Kt9ZtuDtaQVrDGxrfje+3J3vXf+DUbyapL0ynjr4dFBeJTFlOjSdQL4nT7wBDC8hIkhtD7CPKTaPNMIuxCg/dgEkfgCSIeVlEjeHyF+aB64BuOtPUpyGQ6yZ T65LcynSlCINmi7uYWkeKlYyABa6hJqZrgM18bwlEcRmdHjw75MwiKjncWv9aaFsO9OBTr/NFreoys6QkA9toihHEc1WLtrqiUA31+7jU+IQHHqJ8IPBaJmo RKnjj73+fjZAvtIG Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vitaly Kuznetsov 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 5abbbb75d733 ("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 Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_balloon.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index df35fb7..4ae26d6 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -430,13 +430,14 @@ struct dm_info_msg { * currently hot added. We hot add in multiples of 128M * chunks; it is possible that we may not be able to bring * online all the pages in the region. The range - * covered_end_pfn defines the pages that can + * covered_start_pfn:covered_end_pfn defines the pages that can * be brough online. */ struct hv_hotadd_state { struct list_head list; unsigned long start_pfn; + unsigned long covered_start_pfn; unsigned long covered_end_pfn; unsigned long ha_end_pfn; unsigned long end_pfn; @@ -682,7 +683,8 @@ static void hv_online_page(struct page *pg) list_for_each(cur, &dm_device.ha_region_list) { has = list_entry(cur, struct hv_hotadd_state, list); - cur_start_pgp = (unsigned long)pfn_to_page(has->start_pfn); + cur_start_pgp = (unsigned long) + pfn_to_page(has->covered_start_pfn); cur_end_pgp = (unsigned long)pfn_to_page(has->covered_end_pfn); if (((unsigned long)pg >= cur_start_pgp) && @@ -854,6 +856,7 @@ static unsigned long process_hot_add(unsigned long pg_start, list_add_tail(&ha_region->list, &dm_device.ha_region_list); ha_region->start_pfn = rg_start; ha_region->ha_end_pfn = rg_start; + ha_region->covered_start_pfn = pg_start; ha_region->covered_end_pfn = pg_start; ha_region->end_pfn = rg_start + rg_size; } -- 1.7.4.1