Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp981747imm; Wed, 13 Jun 2018 11:21:02 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKF/RxSaUs2OOKxEO4BO0/h9EI1fjokq7bsuh1Ox42xD5rq+JhYc1yuEyDvYMUl8ZWvAqIr X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr6302509plh.107.1528914062286; Wed, 13 Jun 2018 11:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528914062; cv=none; d=google.com; s=arc-20160816; b=d02ngIY8eqAYUVr7aapzxRjmmpV1JTS98dlZpe79Qr0J/sdcmKBbTTblYKcnJgOHSf hvx6vnnQBN9jW2y1NWNgmJ58e4yZTLYIfQoskNsu9hTZ3/0krr5Ivm6t2Q82k0RWr11t 5wrn3D5XbG5MjTns8eNcUfXzPjXjIGFwfdP7ZuSWQszeHjuSpXPY/zVNy3MILXoofYOw SwZEqZiPtglLQMNbhyOLr5+HinKPEBHm8pNZq0+ohoFPhliBTxit52uOtToD5KGEKUMG WITWuOhGgSJVaipRvqenwVycjgXKurZDLO1xTqbULAa6L71vQ4k6uIdumbgSemRQOu+W /meA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=NR/FuJd+1nzl/UVCdGeWQVuDkyXsAnjwLY7Kl21YGKM=; b=PZhvFm+9+VGB6Q08cAXRsoxeiTdYSDyKlcHpHS96sfUgmjyZJykbXt7atzNkctKJox S6NvE4tVmG+V1Q/u81Cu+gtobPmsIG+SaWeOmWplr/D4TpjZyWAf+8tkQN9R8HxED7UY SYgMgQJgAI7e8TrRClNsNw/uwjPQVW/WxtAS7vbQpIgsQqBieiXQLqCu+i/SsAyS/l3f Q8ZhS8Qp/f1bPcGVoJ0D6dIWOtHSWswOZVcyVgr4RCyuZUCCz65jN1EHXdWurlmVPrN0 rJkvl0NJTBLvOUHh62rwbSjRQqs+QH1XawN6WOx5woVJ7k7BJrcVGSacuVjrpjrR8SVh K5Aw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si3634716plb.90.2018.06.13.11.20.47; Wed, 13 Jun 2018 11:21:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935555AbeFMSS4 (ORCPT + 99 others); Wed, 13 Jun 2018 14:18:56 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:19857 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935123AbeFMSSy (ORCPT ); Wed, 13 Jun 2018 14:18:54 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Wed, 13 Jun 2018 11:18:50 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 8BE9C409BD; Wed, 13 Jun 2018 11:18:54 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , , Arnd Bergmann , Nadav Amit Subject: [PATCH 3/7] vmw_balloon: fix inflation of 64-bit GFNs Date: Wed, 13 Jun 2018 04:03:55 -0700 Message-ID: <20180613110359.109033-4-namit@vmware.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180613110359.109033-1-namit@vmware.com> References: <20180613110359.109033-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-002.vmware.com: namit@vmware.com does not designate permitted sender hosts) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When balloon batching is not supported by the hypervisor, the guest frame number (GFN) must fit in 32-bit. However, due to a bug, this check was mistakenly ignored. In practice, when total RAM is greater than 16TB, the balloon does not work currently, making this bug unlikely to happen. Fixes: ef0f8f112984 ("VMware balloon: partially inline vmballoon_reserve_page.") Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index a73b5d64403a..496607a9046a 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -448,7 +448,7 @@ static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, pfn32 = (u32)pfn; if (pfn32 != pfn) - return -1; + return -EINVAL; STATS_INC(b->stats.lock[false]); @@ -458,7 +458,7 @@ static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status); STATS_INC(b->stats.lock_fail[false]); - return 1; + return -EIO; } static int vmballoon_send_batched_lock(struct vmballoon *b, @@ -595,11 +595,12 @@ static int vmballoon_lock_page(struct vmballoon *b, unsigned int num_pages, locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status, target); - if (locked > 0) { + if (locked) { STATS_INC(b->stats.refused_alloc[false]); - if (hv_status == VMW_BALLOON_ERROR_RESET || - hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED) { + if (locked == -EIO && + (hv_status == VMW_BALLOON_ERROR_RESET || + hv_status == VMW_BALLOON_ERROR_PPN_NOTNEEDED)) { vmballoon_free_page(page, false); return -EIO; } @@ -615,7 +616,7 @@ static int vmballoon_lock_page(struct vmballoon *b, unsigned int num_pages, } else { vmballoon_free_page(page, false); } - return -EIO; + return locked; } /* track allocated page */ -- 2.17.0