* [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault()
@ 2020-10-02 15:43 Vitaly Kuznetsov
2020-10-05 8:42 ` Vitaly Kuznetsov
2020-10-19 15:17 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-10-02 15:43 UTC (permalink / raw)
To: x86
Cc: kvm, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, Peter Zijlstra, Paolo Bonzini,
linux-kernel
KVM was switched to interrupt-based mechanism for 'page ready' event
delivery in Linux-5.8 (see commit 2635b5c4a0e4 ("KVM: x86: interrupt based
APF 'page ready' event delivery")) and #PF (ab)use for 'page ready' event
delivery was removed. Linux guest switched to this new mechanism
exclusively in 5.9 (see commit b1d405751cd5 ("KVM: x86: Switch KVM guest to
using interrupts for page ready APF delivery")) so it is not possible to
get older KVM (APF mechanism won't be enabled). Update the comment in
exc_page_fault() to reflect the new reality.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
arch/x86/mm/fault.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 6e3e8a124903..3cf77592ac54 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -1446,11 +1446,14 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
prefetchw(¤t->mm->mmap_lock);
/*
- * KVM has two types of events that are, logically, interrupts, but
- * are unfortunately delivered using the #PF vector. These events are
- * "you just accessed valid memory, but the host doesn't have it right
- * now, so I'll put you to sleep if you continue" and "that memory
- * you tried to access earlier is available now."
+ * KVM uses #PF vector to deliver 'page not present' events to guests
+ * (asynchronous page fault mechanism). The event happens when a
+ * userspace task is trying to access some valid (from guest's point of
+ * view) memory which is not currently mapped by the host (e.g. the
+ * memory is swapped out). Note, the corresponding "page ready" event
+ * which is injected when the memory becomes available, is delived via
+ * an interrupt mechanism and not a #PF exception
+ * (see arch/x86/kernel/kvm.c: sysvec_kvm_asyncpf_interrupt()).
*
* We are relying on the interrupted context being sane (valid RSP,
* relevant locks not held, etc.), which is fine as long as the
--
2.25.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault()
2020-10-02 15:43 [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault() Vitaly Kuznetsov
@ 2020-10-05 8:42 ` Vitaly Kuznetsov
2020-10-19 15:17 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Kuznetsov @ 2020-10-05 8:42 UTC (permalink / raw)
To: kvm, x86
Cc: Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, Peter Zijlstra, Paolo Bonzini, linux-kernel
Vitaly Kuznetsov <vkuznets@redhat.com> writes:
> KVM was switched to interrupt-based mechanism for 'page ready' event
> delivery in Linux-5.8 (see commit 2635b5c4a0e4 ("KVM: x86: interrupt based
> APF 'page ready' event delivery")) and #PF (ab)use for 'page ready' event
> delivery was removed. Linux guest switched to this new mechanism
> exclusively in 5.9 (see commit b1d405751cd5 ("KVM: x86: Switch KVM guest to
> using interrupts for page ready APF delivery")) so it is not possible to
> get older KVM (APF mechanism won't be enabled). Update the comment in
Sigh, this should have been
"to get #PF for a 'page ready' event even when the guest is running on
top of an older KVM"
or something like that but the part after "#" was eaten by git :-(
> exc_page_fault() to reflect the new reality.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/mm/fault.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 6e3e8a124903..3cf77592ac54 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1446,11 +1446,14 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
> prefetchw(¤t->mm->mmap_lock);
>
> /*
> - * KVM has two types of events that are, logically, interrupts, but
> - * are unfortunately delivered using the #PF vector. These events are
> - * "you just accessed valid memory, but the host doesn't have it right
> - * now, so I'll put you to sleep if you continue" and "that memory
> - * you tried to access earlier is available now."
> + * KVM uses #PF vector to deliver 'page not present' events to guests
> + * (asynchronous page fault mechanism). The event happens when a
> + * userspace task is trying to access some valid (from guest's point of
> + * view) memory which is not currently mapped by the host (e.g. the
> + * memory is swapped out). Note, the corresponding "page ready" event
> + * which is injected when the memory becomes available, is delived via
> + * an interrupt mechanism and not a #PF exception
> + * (see arch/x86/kernel/kvm.c: sysvec_kvm_asyncpf_interrupt()).
> *
> * We are relying on the interrupted context being sane (valid RSP,
> * relevant locks not held, etc.), which is fine as long as the
--
Vitaly
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault()
2020-10-02 15:43 [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault() Vitaly Kuznetsov
2020-10-05 8:42 ` Vitaly Kuznetsov
@ 2020-10-19 15:17 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-10-19 15:17 UTC (permalink / raw)
To: Vitaly Kuznetsov, x86
Cc: kvm, Andy Lutomirski, Thomas Gleixner, Ingo Molnar,
Borislav Petkov, Dave Hansen, Peter Zijlstra, linux-kernel
On 02/10/20 17:43, Vitaly Kuznetsov wrote:
> KVM was switched to interrupt-based mechanism for 'page ready' event
> delivery in Linux-5.8 (see commit 2635b5c4a0e4 ("KVM: x86: interrupt based
> APF 'page ready' event delivery")) and #PF (ab)use for 'page ready' event
> delivery was removed. Linux guest switched to this new mechanism
> exclusively in 5.9 (see commit b1d405751cd5 ("KVM: x86: Switch KVM guest to
> using interrupts for page ready APF delivery")) so it is not possible to
> get older KVM (APF mechanism won't be enabled). Update the comment in
> exc_page_fault() to reflect the new reality.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> ---
> arch/x86/mm/fault.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 6e3e8a124903..3cf77592ac54 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1446,11 +1446,14 @@ DEFINE_IDTENTRY_RAW_ERRORCODE(exc_page_fault)
> prefetchw(¤t->mm->mmap_lock);
>
> /*
> - * KVM has two types of events that are, logically, interrupts, but
> - * are unfortunately delivered using the #PF vector. These events are
> - * "you just accessed valid memory, but the host doesn't have it right
> - * now, so I'll put you to sleep if you continue" and "that memory
> - * you tried to access earlier is available now."
> + * KVM uses #PF vector to deliver 'page not present' events to guests
> + * (asynchronous page fault mechanism). The event happens when a
> + * userspace task is trying to access some valid (from guest's point of
> + * view) memory which is not currently mapped by the host (e.g. the
> + * memory is swapped out). Note, the corresponding "page ready" event
> + * which is injected when the memory becomes available, is delived via
> + * an interrupt mechanism and not a #PF exception
> + * (see arch/x86/kernel/kvm.c: sysvec_kvm_asyncpf_interrupt()).
> *
> * We are relying on the interrupted context being sane (valid RSP,
> * relevant locks not held, etc.), which is fine as long as the
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-19 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 15:43 [PATCH] x86/kvm: Update the comment about asynchronous page fault in exc_page_fault() Vitaly Kuznetsov
2020-10-05 8:42 ` Vitaly Kuznetsov
2020-10-19 15:17 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.