Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1142996imm; Wed, 13 Jun 2018 14:10:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIGpiJiUxDPN4ghErJMcm4/UjIuiEfPLJvBTgy+SmArlYI18EuEfNbq8Y2Md2uMRWxrPSgs X-Received: by 2002:a17:902:bc4a:: with SMTP id t10-v6mr6756609plz.133.1528924239116; Wed, 13 Jun 2018 14:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528924239; cv=none; d=google.com; s=arc-20160816; b=b9Cp9kCQMCWedp1N0UhzSH+poDIo+viUzEH2k04Fnl43hv0E4ISKyCHZwsXNQbn+fx xnhjU//gkl+ht7Pn5qtKgh6cevUy4LUyeDPDA3r1U75QuDcG3XQNpgvarr1I8Kb+Uglw T6hgYrxBDCOJS24EleYMBsX0goR2ySm/Muc9MfXazC+XVBGFhRI2Nk7BlhhrAzN16BQW XfAq/UoPfqDtwPYB/NToggguy1lvjQN91SzEiBTYkWBcYLiXq6uPhnh/7aX5wak/QOUe RLYeiHFqSX8lpR1iMoAunMNJMtyWnH3EUo1poWGQxdmxt6p5kAkMpdXYBlQtENUgMjJj 93zg== 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=l5+SUMJYUbky7NttnS0OpOmaoIPfBnrj5uPA3rlQeLQ=; b=0YtekwVLyKgVLPZC4jSyh2RbmD19lusC4VEoXJ2cHjcCMV4RIflg3D6wPGfQNYmZWF 9eUv/BUp5IK0JwgER3Gl8d/hFysg6UNWsolpRgXy5woOVxoCoWr0gxyeSMnVV4rt6jYw I7IO/qMyM8cdi6IOUqNKhLUBR0q6jtCiXbnmdygGoeBN1EYZtHGSa1fzH4KH/4cYCkpI 0kTEBRSOBLr67iu7QWf05UdloUevbGzBPgbTZ4u7XMNoSmrGJN0k4UoFHL0BKNBYPaiq 4CcS//ef9tLJ9gHvAuVEMZMZSV5F94CDxp79+pt+gqeVSRkJgvWQqxC4SRCt5c8BJNBN Y9qQ== 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 p25-v6si3427772pfn.131.2018.06.13.14.10.24; Wed, 13 Jun 2018 14:10:39 -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 S936034AbeFMVJU (ORCPT + 99 others); Wed, 13 Jun 2018 17:09:20 -0400 Received: from ex13-edg-ou-002.vmware.com ([208.91.0.190]:54991 "EHLO EX13-EDG-OU-002.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935837AbeFMVJQ (ORCPT ); Wed, 13 Jun 2018 17:09:16 -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 14:09:11 -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 E60AC409B1; Wed, 13 Jun 2018 14:09:15 -0700 (PDT) From: Nadav Amit To: Greg Kroah-Hartman CC: Xavier Deguillard , , Arnd Bergmann , Nadav Amit , , Nadav Amit Subject: [PATCH v2 2/7] vmw_balloon: do not use 2MB without batching Date: Wed, 13 Jun 2018 06:54:07 -0700 Message-ID: <20180613135412.81660-3-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-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 If the hypervisor sets 2MB batching is on, while batching is cleared, the balloon code breaks. In this case the legacy mechanism is used with 2MB page. The VM would report a 2MB page is ballooned, and the hypervisor would only take the first 4KB. While the hypervisor should not report such settings, make the code more robust by not enabling 2MB support without batching. Fixes: 365bd7ef7ec8e ("VMware balloon: Support 2m page ballooning.") Cc: stable@vger.kernel.org Reviewed-by: Xavier Deguillard Signed-off-by: Nadav Amit --- drivers/misc/vmw_balloon.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c index 28e77ab1e136..60ab83d3d0ef 100644 --- a/drivers/misc/vmw_balloon.c +++ b/drivers/misc/vmw_balloon.c @@ -341,7 +341,13 @@ static bool vmballoon_send_start(struct vmballoon *b, unsigned long req_caps) success = false; } - if (b->capabilities & VMW_BALLOON_BATCHED_2M_CMDS) + /* + * 2MB pages are only supported with batching. If batching is for some + * reason disabled, do not use 2MB pages, since otherwise the legacy + * mechanism is used with 2MB pages, causing a failure. + */ + if ((b->capabilities & VMW_BALLOON_BATCHED_2M_CMDS) && + (b->capabilities & VMW_BALLOON_BATCHED_CMDS)) b->supported_page_sizes = 2; else b->supported_page_sizes = 1; -- 2.17.0