Skip to content

Commit

Permalink
vmw_balloon: do not use 2MB without batching
Browse files Browse the repository at this point in the history
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: 365bd7e ("VMware balloon: Support 2m page ballooning.")
Cc: [email protected]
Reviewed-by: Xavier Deguillard <[email protected]>
Signed-off-by: Nadav Amit <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
anadav authored and gregkh committed Jul 3, 2018
1 parent 0975569 commit 5081efd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/misc/vmw_balloon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5081efd

Please sign in to comment.