Thread (153 messages) 153 messages, 23 authors, 2023-05-23

Re: [PATCH v10 2/9] KVM: Introduce per-page memory attributes

From: Chao Peng <hidden>
Date: 2023-01-17 13:38:45
Also in: kvm, linux-arch, linux-doc, linux-fsdevel, linux-mm, lkml, qemu-devel

On Tue, Jan 17, 2023 at 11:21:10AM +0800, Binbin Wu wrote:
On 12/2/2022 2:13 PM, Chao Peng wrote:
quoted
In confidential computing usages, whether a page is private or shared is
necessary information for KVM to perform operations like page fault
handling, page zapping etc. There are other potential use cases for
per-page memory attributes, e.g. to make memory read-only (or no-exec,
or exec-only, etc.) without having to modify memslots.

Introduce two ioctls (advertised by KVM_CAP_MEMORY_ATTRIBUTES) to allow
userspace to operate on the per-page memory attributes.
   - KVM_SET_MEMORY_ATTRIBUTES to set the per-page memory attributes to
     a guest memory range.
   - KVM_GET_SUPPORTED_MEMORY_ATTRIBUTES to return the KVM supported
     memory attributes.

KVM internally uses xarray to store the per-page memory attributes.

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Chao Peng <redacted>
Link: https://lore.kernel.org/all/Y2WB48kD0J4VGynX@google.com/ (local)
---
  Documentation/virt/kvm/api.rst | 63 ++++++++++++++++++++++++++++
  arch/x86/kvm/Kconfig           |  1 +
  include/linux/kvm_host.h       |  3 ++
  include/uapi/linux/kvm.h       | 17 ++++++++
Should the changes introduced in this file also need to be added in
tools/include/uapi/linux/kvm.h ?
Yes I think. But I'm hesitate to include in this patch or not. I see
many commits sync kernel kvm.h to tools's copy. Looks that is done
periodically and with a 'pull' model.

Chao
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help