Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1143533imm; Wed, 13 Jun 2018 14:11:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ4WkLGOPaQ6tETakRv5bfjGfC0sEqMfRxRjEfB8hSJt1epccviN7PzwKMV4/7CCJOzrHJw X-Received: by 2002:a17:902:714e:: with SMTP id u14-v6mr6849602plm.289.1528924278629; Wed, 13 Jun 2018 14:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528924278; cv=none; d=google.com; s=arc-20160816; b=AG3gyEoHkatH9xHihEYB91h2sU07FmZHQFxHS0NDaExt/gZ2QXxiJdl2jrSiRd9UfD rPgo2Dx85VoH+an811XxM6ckQPHOjlF14Ls/sTvafZKO/3bYMPETG0aMUJULwgDP7q9n ZHV44h/WYj6fGdzexODnluHaxzh1tP5Pda9iVFqc4EnSCdsi7PgVZxgv0vMGmdudKx4c PbP2mm3o1qCRnXZWDBROpiXa2EN4mXkqtVRxtuua6KUEKoquj//GN52RUCZ8wytCvq0d toVj4b2Bp3nv3qSM+Axlnw3mLlhVa9syiXL9lMwWolQQzMihwXR9Hrug9Qqa63W6fkK0 3gkQ== 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=KDNCZGs9ndibecWUtA6bX2iXJUCYk35P5jcy0fJbAZM=; b=aXJg1N91wTJE3EqxoaDO/uvjLVy9+8Q5e23fUebUUZErVfDLE0ceo+SOTug+fS+YQ7 gw7mnr+DbYeQcH/f+asOrqTFlVe2mLDDwjT9amcQ9anpAyj4ySYcgaGKMBLJIfR2HWMf nOOd1iOybwW0+F0xSOJRwicnll+OQja511InEhhWw+hDw4jmhwiYqcwuv4AyfYmmHeb4 xFC72/sdHb6ihWDBf8fDJqLiaIWKedt+Zd0TTttIYtFyUH+BCYr8lih7NMtHZgdyRxjp IDf0pys06h8niF5qyk6+YjkSncBkF9W8+gHLuBE4/I64nugTv8fKfAWPLP6mWCfdCkRh y53w== 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 g83-v6si3749827pfg.225.2018.06.13.14.11.04; Wed, 13 Jun 2018 14:11:18 -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 S936017AbeFMVJS (ORCPT + 99 others); Wed, 13 Jun 2018 17:09:18 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:49469 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935764AbeFMVJQ (ORCPT ); Wed, 13 Jun 2018 17:09:16 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Wed, 13 Jun 2018 14:08: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 E1EDB40853; Wed, 13 Jun 2018 14:09:15 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , , Arnd Bergmann , Nadav Amit , Subject: [PATCH v2 1/7] vmw_balloon: fix inflation of 64-bit GFNs Date: Wed, 13 Jun 2018 06:54:06 -0700 Message-ID: <20180613135412.81660-2-namit@vmware.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180613135412.81660-1-namit@vmware.com> References: <20180613135412.81660-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