Commit 77bcd9e
committed
KVM: Add dedicated arch hook for querying if vCPU was preempted in-kernel
Plumb in a dedicated hook for querying whether or not a vCPU was preempted
in-kernel. Unlike literally every other architecture, x86's VMX can check
if a vCPU is in kernel context if and only if the vCPU is loaded on the
current pCPU.
x86's kvm_arch_vcpu_in_kernel() works around the limitation by querying
kvm_get_running_vcpu() and redirecting to vcpu->arch.preempted_in_kernel
as needed. But that's unnecessary, confusing, and fragile, e.g. x86 has
had at least one bug where KVM incorrectly used a stale
preempted_in_kernel.
No functional change intended.
Reviewed-by: Yuan Yao <yuan.yao@intel.com>
Link: https://lore.kernel.org/r/20240110003938.490206-2-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>1 parent fc3c941 commit 77bcd9e
3 files changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13054 | 13054 | | |
13055 | 13055 | | |
13056 | 13056 | | |
| 13057 | + | |
| 13058 | + | |
| 13059 | + | |
| 13060 | + | |
| 13061 | + | |
13057 | 13062 | | |
13058 | 13063 | | |
13059 | 13064 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1505 | 1505 | | |
1506 | 1506 | | |
1507 | 1507 | | |
| 1508 | + | |
1508 | 1509 | | |
1509 | 1510 | | |
1510 | 1511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4042 | 4042 | | |
4043 | 4043 | | |
4044 | 4044 | | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
4045 | 4057 | | |
4046 | 4058 | | |
4047 | 4059 | | |
| |||
4080 | 4092 | | |
4081 | 4093 | | |
4082 | 4094 | | |
4083 | | - | |
| 4095 | + | |
4084 | 4096 | | |
4085 | 4097 | | |
4086 | 4098 | | |
| |||
0 commit comments