lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240916165743.201087-1-shivankg@amd.com>
Date: Mon, 16 Sep 2024 16:57:40 +0000
From: Shivank Garg <shivankg@....com>
To: <pbonzini@...hat.com>, <corbet@....net>, <akpm@...ux-foundation.org>,
	<willy@...radead.org>
CC: <acme@...hat.com>, <namhyung@...nel.org>, <mpe@...erman.id.au>,
	<isaku.yamahata@...el.com>, <joel@....id.au>, <kvm@...r.kernel.org>,
	<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-mm@...ck.org>, <linux-fsdevel@...r.kernel.org>, <shivankg@....com>,
	<shivansh.dhiman@....com>, <bharata@....com>, <nikunj@....com>
Subject: [PATCH RFC 0/3] Add NUMA mempolicy support for KVM guest_memfd

The current implementation of KVM guest-memfd does not honor the settings
provided by VMM. While mbind() can be used for NUMA policy support in
userspace applications, it is not functional for guest-memfd as the memory
is not mapped to userspace.

This patch-series adds support to specify NUMA memory policy for guests
with private guest-memfd memory backend. KVM guest-memfd support for
memory backend is already available in QEMU RAMBlock. However, the NUMA
support was missing. This cause memory allocation from guest to randomly
allocate on host NUMA nodes even when passing policy and host-nodes in the
QEMU command. It ensures that VMM provided NUMA policy is adhered.

This feature is particularly useful for SEV-SNP guests as they require
guest_memfd memory backend for allocations. Workloads with high memory-
locality are likely to benefit with this change.

Users can provide a policy mode such as default, bind, interleave, or
preferred along with a list of node IDs from the host machine.

To try this patch-series, build the custom QEMU with NUMA supported KVM
guest-memfd:
QEMU tree- https://github.com/AMDESE/qemu/tree/NUMA_guest_memfd
For instance, to run a SEV-SNP guest bound to NUMA Node 0 of the host,
the corresponding QEMU command would be:

$ qemu-system-x86_64 \
   -enable-kvm \
  ...
   -machine memory-encryption=sev0,vmport=off \
   -object sev-snp-guest,id=sev0,cbitpos=51,reduced-phys-bits=1 \
   -numa node,nodeid=0,memdev=ram0,cpus=0-15 \
   -object memory-backend-memfd,id=ram0,policy=bind,host-nodes=0,size=1024M,share=true,prealloc=false


Shivansh Dhiman (3):
  KVM: guest_memfd: Extend creation API to support NUMA mempolicy
  mm: add mempolicy support to the filemap layer
  KVM: guest_memfd: Enforce NUMA mempolicy if available

 Documentation/virt/kvm/api.rst | 13 ++++++++-
 include/linux/mempolicy.h      |  4 +++
 include/linux/pagemap.h        | 30 +++++++++++++++++++
 include/uapi/linux/kvm.h       |  5 +++-
 mm/filemap.c                   | 30 +++++++++++++++----
 mm/mempolicy.c                 | 53 ++++++++++++++++++++++++++++++++++
 tools/include/uapi/linux/kvm.h |  5 +++-
 virt/kvm/guest_memfd.c         | 28 ++++++++++++++----
 virt/kvm/kvm_mm.h              |  3 ++
 9 files changed, 158 insertions(+), 13 deletions(-)

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ