summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorNadav Amit <namit@vmware.com>2018-06-19 16:00:25 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-03 12:56:30 +0200
commit5081efd112560d3febb328e627176235b250d59d (patch)
treed0097568b2c08f76cf0c0ae4adcb4c4c6ad77ff1 /drivers/misc
parent09755690c6b7c1eabdc4651eb3b276f8feb1e447 (diff)
downloadlinux-stable-5081efd112560d3febb328e627176235b250d59d.tar.gz
linux-stable-5081efd112560d3febb328e627176235b250d59d.tar.bz2
linux-stable-5081efd112560d3febb328e627176235b250d59d.zip
vmw_balloon: do not use 2MB without batching
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 <xdeguillard@vmware.com> Signed-off-by: Nadav Amit <nadav.amit@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/vmw_balloon.c8
1 files changed, 7 insertions, 1 deletions
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;