Skip to content

Commit 86014c1

Browse files
committed
Merge tag 'kvm-x86-generic-6.11' of https://github.com/kvm-x86/linux into HEAD
KVM generic changes for 6.11 - Enable halt poll shrinking by default, as Intel found it to be a clear win. - Setup empty IRQ routing when creating a VM to avoid having to synchronize SRCU when creating a split IRQCHIP on x86. - Rework the sched_in/out() paths to replace kvm_arch_sched_in() with a flag that arch code can use for hooking both sched_in() and sched_out(). - Take the vCPU @id as an "unsigned long" instead of "u32" to avoid truncating a bogus value from userspace, e.g. to help userspace detect bugs. - Mark a vCPU as preempted if and only if it's scheduled out while in the KVM_RUN loop, e.g. to avoid marking it preempted and thus writing guest memory when retrieving guest state during live migration blackout. - A few minor cleanups
2 parents f4501e8 + 25bc6af commit 86014c1

File tree

31 files changed

+196
-146
lines changed

31 files changed

+196
-146
lines changed

Documentation/virt/kvm/api.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7969,10 +7969,10 @@ perform a bulk copy of tags to/from the guest.
79697969
7.29 KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM
79707970
-------------------------------------
79717971

7972-
Architectures: x86 SEV enabled
7973-
Type: vm
7974-
Parameters: args[0] is the fd of the source vm
7975-
Returns: 0 on success
7972+
:Architectures: x86 SEV enabled
7973+
:Type: vm
7974+
:Parameters: args[0] is the fd of the source vm
7975+
:Returns: 0 on success
79767976

79777977
This capability enables userspace to migrate the encryption context from the VM
79787978
indicated by the fd to the VM this is called on.

Documentation/virt/kvm/halt-polling.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ adjustment of the polling interval.
7979
Module Parameters
8080
=================
8181

82-
The kvm module has 3 tuneable module parameters to adjust the global max
83-
polling interval as well as the rate at which the polling interval is grown and
84-
shrunk. These variables are defined in include/linux/kvm_host.h and as module
85-
parameters in virt/kvm/kvm_main.c, or arch/powerpc/kvm/book3s_hv.c in the
86-
powerpc kvm-hv case.
82+
The kvm module has 4 tunable module parameters to adjust the global max polling
83+
interval, the initial value (to grow from 0), and the rate at which the polling
84+
interval is grown and shrunk. These variables are defined in
85+
include/linux/kvm_host.h and as module parameters in virt/kvm/kvm_main.c, or
86+
arch/powerpc/kvm/book3s_hv.c in the powerpc kvm-hv case.
8787

8888
+-----------------------+---------------------------+-------------------------+
8989
|Module Parameter | Description | Default Value |
@@ -105,7 +105,7 @@ powerpc kvm-hv case.
105105
| | grow_halt_poll_ns() | |
106106
| | function. | |
107107
+-----------------------+---------------------------+-------------------------+
108-
|halt_poll_ns_shrink | The value by which the | 0 |
108+
|halt_poll_ns_shrink | The value by which the | 2 |
109109
| | halt polling interval is | |
110110
| | divided in the | |
111111
| | shrink_halt_poll_ns() | |

arch/arm64/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,6 @@ static inline bool kvm_system_needs_idmapped_vectors(void)
12891289
}
12901290

12911291
static inline void kvm_arch_sync_events(struct kvm *kvm) {}
1292-
static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
12931292

12941293
void kvm_arm_init_debug(void);
12951294
void kvm_arm_vcpu_init_debug(struct kvm_vcpu *vcpu);

arch/arm64/kvm/arm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
11381138

11391139
vcpu_load(vcpu);
11401140

1141-
if (run->immediate_exit) {
1141+
if (!vcpu->wants_to_run) {
11421142
ret = -EINTR;
11431143
goto out;
11441144
}

arch/loongarch/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ static inline bool kvm_is_ifetch_fault(struct kvm_vcpu_arch *arch)
274274
static inline void kvm_arch_hardware_unsetup(void) {}
275275
static inline void kvm_arch_sync_events(struct kvm *kvm) {}
276276
static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
277-
static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
278277
static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
279278
static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
280279
static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {}

arch/loongarch/kvm/vcpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
14161416
kvm_complete_iocsr_read(vcpu, run);
14171417
}
14181418

1419-
if (run->immediate_exit)
1419+
if (!vcpu->wants_to_run)
14201420
return r;
14211421

14221422
/* Clear exit_reason */

arch/mips/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,6 @@ static inline void kvm_arch_sync_events(struct kvm *kvm) {}
890890
static inline void kvm_arch_free_memslot(struct kvm *kvm,
891891
struct kvm_memory_slot *slot) {}
892892
static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
893-
static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
894893
static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
895894
static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
896895

arch/mips/kvm/mips.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
436436
vcpu->mmio_needed = 0;
437437
}
438438

439-
if (vcpu->run->immediate_exit)
439+
if (!vcpu->wants_to_run)
440440
goto out;
441441

442442
lose_fpu(1);

arch/powerpc/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ struct kvm_vcpu_arch {
897897
static inline void kvm_arch_sync_events(struct kvm *kvm) {}
898898
static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {}
899899
static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {}
900-
static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {}
901900
static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {}
902901
static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {}
903902

arch/powerpc/kvm/powerpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
18521852

18531853
kvm_sigset_activate(vcpu);
18541854

1855-
if (run->immediate_exit)
1855+
if (!vcpu->wants_to_run)
18561856
r = -EINTR;
18571857
else
18581858
r = kvmppc_vcpu_run(vcpu);

0 commit comments

Comments
 (0)