mbox series

[kvmtool,v2,0/3] Align value generated by get_ram_size() to the host's page size

Message ID 20230717121232.3559948-1-tabba@google.com (mailing list archive)
Headers show
Series Align value generated by get_ram_size() to the host's page size | expand

Message

Fuad Tabba July 17, 2023, 12:12 p.m. UTC
Hi,

This patch series ensures that the value returned by
get_ram_size() is aligned to the host's page size. Without that,
KVM_SET_USER_MEMORY_REGION could fail when passed an unaligned
value.

Changes from V1:
- Factor out code for getting _SC_PHYS_PAGES into a function (Will)
- Apply the scaling down of the ramsize to the number of pages (Will)

Cheers,
/fuad

Fixes: 18bd8c3bd2a7 ("kvm tools: Don't use all of host RAM for guests by default")
Signed-off-by: Fuad Tabba <tabba@google.com>

Fuad Tabba (3):
  Factor out getting the host page size
  Factor out getting the number of physical memory host pages
  Apply scaling down the calculated guest ram size to the number of
    pages

 builtin-run.c | 44 +++++++++++++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 17 deletions(-)


base-commit: bd4ba57156dad39349edfb2338bdc2f4ed3c0bae

Comments

Will Deacon July 20, 2023, 4:04 p.m. UTC | #1
On Mon, 17 Jul 2023 13:12:29 +0100, Fuad Tabba wrote:
> This patch series ensures that the value returned by
> get_ram_size() is aligned to the host's page size. Without that,
> KVM_SET_USER_MEMORY_REGION could fail when passed an unaligned
> value.
> 
> Changes from V1:
> - Factor out code for getting _SC_PHYS_PAGES into a function (Will)
> - Apply the scaling down of the ramsize to the number of pages (Will)
> 
> [...]

Applied to kvmtool (master), thanks!

[1/3] Factor out getting the host page size
      https://git.kernel.org/will/kvmtool/c/b6bae725decc
[2/3] Factor out getting the number of physical memory host pages
      https://git.kernel.org/will/kvmtool/c/834e5ed62fb8
[3/3] Apply scaling down the calculated guest ram size to the number of pages
      https://git.kernel.org/will/kvmtool/c/63643b11ce7d

Cheers,