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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241118123948.4796-3-kalyazin@amazon.com>
Date: Mon, 18 Nov 2024 12:39:44 +0000
From: Nikita Kalyazin <kalyazin@...zon.com>
To: <pbonzini@...hat.com>, <seanjc@...gle.com>, <corbet@....net>,
	<tglx@...utronix.de>, <mingo@...hat.com>, <bp@...en8.de>,
	<dave.hansen@...ux.intel.com>, <hpa@...or.com>, <rostedt@...dmis.org>,
	<mhiramat@...nel.org>, <mathieu.desnoyers@...icios.com>,
	<kvm@...r.kernel.org>, <linux-doc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-trace-kernel@...r.kernel.org>
CC: <jthoughton@...gle.com>, <david@...hat.com>, <peterx@...hat.com>,
	<oleg@...hat.com>, <vkuznets@...hat.com>, <gshan@...hat.com>,
	<graf@...zon.de>, <jgowans@...zon.com>, <roypat@...zon.co.uk>,
	<derekmn@...zon.com>, <nsaenz@...zon.es>, <xmarcalx@...zon.com>,
	<kalyazin@...zon.com>
Subject: [RFC PATCH 2/6] Documentation: KVM: add async pf user doc

Signed-off-by: Nikita Kalyazin <kalyazin@...zon.com>
---
 Documentation/virt/kvm/api.rst | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index ffe9a2d0e525..b30f9989f5c1 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -6352,6 +6352,32 @@ a single guest_memfd file, but the bound ranges must not overlap).
 
 See KVM_SET_USER_MEMORY_REGION2 for additional details.
 
+4.143 KVM_ASYNC_PF_USER_READY
+----------------------------
+
+:Capability: KVM_CAP_USERFAULT
+:Architectures: x86
+:Type: vcpu ioctl
+:Parameters: struct kvm_async_pf_user_ready(in)
+:Returns: 0 on success, <0 on error
+
+KVM_ASYNC_PF_USER_READY notifies the kernel that the fault corresponding to the
+'token' has been resolved by the userspace. The ioctl is supposed to be used by
+the userspace when processing an async PF in response to a VM exit with the
+KVM_MEMORY_EXIT_FLAG_ASYNC_PF_USER flag set. The 'token' must match the value
+supplied by the kernel in 'async_pf_user_token' field of the
+struct memory_fault. When handling the ioctl, the kernel will inject the
+'page present' event in the guest and wake the vcpu up if it is halted, like it
+would do when completing a regular (kernel) async PF.
+
+::
+
+  struct kvm_async_pf_user_ready {
+  __u32 token;
+  };
+
+This is an asynchronous vcpu ioctl and can be invoked from any thread.
+
 5. The kvm_run structure
 ========================
 
@@ -6997,9 +7023,11 @@ spec refer, https://github.com/riscv/riscv-sbi-doc.
 		struct {
   #define KVM_MEMORY_EXIT_FLAG_PRIVATE	(1ULL << 3)
   #define KVM_MEMORY_EXIT_FLAG_USERFAULT  (1ULL << 4)
+  #define KVM_MEMORY_EXIT_FLAG_ASYNC_PF_USER (1ULL << 5)
 			__u64 flags;
 			__u64 gpa;
 			__u64 size;
+			__u32 async_pf_user_token;
 		} memory_fault;
 
 KVM_EXIT_MEMORY_FAULT indicates the vCPU has encountered a memory fault that
@@ -7012,6 +7040,10 @@ describes properties of the faulting access that are likely pertinent:
    shared access.
  - KVM_MEMORY_EXIT_FLAG_USERFAULT - When set, indicates the memory fault
    occurred, because the vCPU attempted to access a gfn marked as userfault.
+ - KVM_MEMORY_EXIT_FLAG_ASYNC_PF_USER - When set, indicates the memory fault can
+   be processed asynchronously and 'async_pf_user_token' contains the token to
+   be used when notifying KVM of the completion via the KVM_ASYNC_PF_USER_READY
+   ioctl.
 
 Note!  KVM_EXIT_MEMORY_FAULT is unique among all KVM exit reasons in that it
 accompanies a return code of '-1', not '0'!  errno will always be set to EFAULT
-- 
2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ