Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp373201imm; Tue, 19 Jun 2018 23:16:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJKvrGJEwDqvzv7C/vBMQo7iXso4PFMgBW9UPE+Pkcu+ufUGbf3+aabhLrURvck35e7tQyd X-Received: by 2002:a62:1013:: with SMTP id y19-v6mr21046639pfi.166.1529475380760; Tue, 19 Jun 2018 23:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529475380; cv=none; d=google.com; s=arc-20160816; b=dRy3uYPfn3g65M9X7HopbI4qExA/J4sJdtaxxMBGzp4jZZLDMeuYaCS3fNtEoXTgOh B6UlC8Q8Sgs4wikkJX86mCLRFGJX3bOtQrEdOmxrScYWJG8y2FpiOMEHw9Kng8wHEuwp yNQ8g36tC5VGNd2HuhVJD24OD2xWnirGKaFPwUFu8tPAGWU+RPYL+JfJ+5qnmtV8NKcg ZPy4ALMfC4mswPzQvLYLqfp9NhLsIsZdncy6wbD9U5M/fiZg9ax+2S5a3ANANtX/YMEe xAEDTOlbjMzrOl0rrxwTZ3c5yHCQNAvhcCz6dbTXUvWzZQwGY+YYQjn5IXG+6MDsSYev nI5A== 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=4xlAsFBT38WCBYeFK7aLW2FGxE6WCnr08Q3gl+T15oM=; b=P9ZWz2LbA8Rxby+0Mc8/kqs+P6RhTDTJtyPutNO7JrEcqfrG0rzVJjpF+u8pXq46Y2 0q3FBauAfRS6bemaNZA9bmvxFVLMcxcHtpkUNW0Cb9sFpjSohOfO9hkn8tmgXT4mZ+Hu zDKeoRoK2z0Xwiq0+NP2YZ7jJHFrxvwnuCyovGj9WqKtKbBvFoCJ0uCDVUtEGvCmNtb9 duelF1oRxlzgGt7XQlfMlVzO8QJoYtr4LtOxUOa7ZTN+NtUVzmVW1WBq7SCywzt2jL8c UdFY/RHYc7J3GCgE0uSldDKVPCd2JvrCxKG3VQRRKaVclZIIcIfTLUj2XYdqqE2nOdxO GpQg== 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 v31-v6si1654618plg.339.2018.06.19.23.16.06; Tue, 19 Jun 2018 23:16:20 -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 S1754084AbeFTGPX (ORCPT + 99 others); Wed, 20 Jun 2018 02:15:23 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:14595 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbeFTGPQ (ORCPT ); Wed, 20 Jun 2018 02:15:16 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Tue, 19 Jun 2018 23:14:41 -0700 Received: from sc2-haas01-esx0118.eng.vmware.com (sc2-haas01-esx0118.eng.vmware.com [10.172.44.118]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 87745B0C08; Tue, 19 Jun 2018 23:15:15 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , Arnd Bergmann , , Nadav Amit , Subject: [PATCH v3 1/7] vmw_balloon: fix inflation of 64-bit GFNs Date: Tue, 19 Jun 2018 16:00:24 -0700 Message-ID: <20180619230030.112906-2-namit@vmware.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180619230030.112906-1-namit@vmware.com> References: <20180619230030.112906-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: None (EX13-EDG-OU-001.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.") Cc: stable@vger.kernel.org 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 efd733472a35..28e77ab1e136 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -450,7 +450,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]); @@ -460,7 +460,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, @@ -597,11 +597,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; } @@ -617,7 +618,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