mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git
synced 2026-04-17 22:24:18 -04:00
entry/kvm: KVM: Move KVM details related to signal/-EINTR into KVM proper
Move KVM's morphing of pending signals into userspace exits into KVM proper, and drop the @vcpu param from xfer_to_guest_mode_handle_work(). How KVM responds to -EINTR is a detail that really belongs in KVM itself, and invoking kvm_handle_signal_exit() from kernel code creates an inverted module dependency. E.g. attempting to move kvm_handle_signal_exit() into kvm_main.c would generate an linker error when building kvm.ko as a module. Dropping KVM details will also converting the KVM "entry" code into a more generic virtualization framework so that it can be used when running as a Hyper-V root partition. Lastly, eliminating usage of "struct kvm_vcpu" outside of KVM is also nice to have for KVM x86 developers, as keeping the details of kvm_vcpu purely within KVM allows changing the layout of the structure without having to boot into a new kernel, e.g. allows rebuilding and reloading kvm.ko with a modified kvm_vcpu structure as part of debug/development. Signed-off-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Wei Liu <wei.liu@kernel.org>
This commit is contained in:
committed by
Wei Liu
parent
0ebac01a00
commit
6d0386ea99
@@ -2,7 +2,7 @@
|
||||
#ifndef __KVM_HOST_H
|
||||
#define __KVM_HOST_H
|
||||
|
||||
|
||||
#include <linux/entry-kvm.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/list.h>
|
||||
@@ -2450,6 +2450,17 @@ static inline void kvm_handle_signal_exit(struct kvm_vcpu *vcpu)
|
||||
vcpu->run->exit_reason = KVM_EXIT_INTR;
|
||||
vcpu->stat.signal_exits++;
|
||||
}
|
||||
|
||||
static inline int kvm_xfer_to_guest_mode_handle_work(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
int r = xfer_to_guest_mode_handle_work();
|
||||
|
||||
if (r) {
|
||||
WARN_ON_ONCE(r != -EINTR);
|
||||
kvm_handle_signal_exit(vcpu);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
#endif /* CONFIG_KVM_XFER_TO_GUEST_WORK */
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user