Skip to content

Commit c59fb12

Browse files
committed
KVM: remove KVM_REQ_UNHALT
KVM_REQ_UNHALT is now unnecessary because it is replaced by the return value of kvm_vcpu_block/kvm_vcpu_halt. Remove it. No functional change intended. Signed-off-by: Paolo Bonzini <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Acked-by: Marc Zyngier <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 599275c commit c59fb12

File tree

13 files changed

+3
-45
lines changed

13 files changed

+3
-45
lines changed

Documentation/virt/kvm/vcpu-requests.rst

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ VCPU requests are simply bit indices of the ``vcpu->requests`` bitmap.
9797
This means general bitops, like those documented in [atomic-ops]_ could
9898
also be used, e.g. ::
9999

100-
clear_bit(KVM_REQ_UNHALT & KVM_REQUEST_MASK, &vcpu->requests);
100+
clear_bit(KVM_REQ_UNBLOCK & KVM_REQUEST_MASK, &vcpu->requests);
101101

102102
However, VCPU request users should refrain from doing so, as it would
103103
break the abstraction. The first 8 bits are reserved for architecture
@@ -126,17 +126,6 @@ KVM_REQ_UNBLOCK
126126
or in order to update the interrupt routing and ensure that assigned
127127
devices will wake up the vCPU.
128128

129-
KVM_REQ_UNHALT
130-
131-
This request may be made from the KVM common function kvm_vcpu_block(),
132-
which is used to emulate an instruction that causes a CPU to halt until
133-
one of an architectural specific set of events and/or interrupts is
134-
received (determined by checking kvm_arch_vcpu_runnable()). When that
135-
event or interrupt arrives kvm_vcpu_block() makes the request. This is
136-
in contrast to when kvm_vcpu_block() returns due to any other reason,
137-
such as a pending signal, which does not indicate the VCPU's halt
138-
emulation should stop, and therefore does not make the request.
139-
140129
KVM_REQ_OUTSIDE_GUEST_MODE
141130

142131
This "request" ensures the target vCPU has exited guest mode prior to the
@@ -297,21 +286,6 @@ architecture dependent. kvm_vcpu_block() calls kvm_arch_vcpu_runnable()
297286
to check if it should awaken. One reason to do so is to provide
298287
architectures a function where requests may be checked if necessary.
299288

300-
Clearing Requests
301-
-----------------
302-
303-
Generally it only makes sense for the receiving VCPU thread to clear a
304-
request. However, in some circumstances, such as when the requesting
305-
thread and the receiving VCPU thread are executed serially, such as when
306-
they are the same thread, or when they are using some form of concurrency
307-
control to temporarily execute synchronously, then it's possible to know
308-
that the request may be cleared immediately, rather than waiting for the
309-
receiving VCPU thread to handle the request in VCPU RUN. The only current
310-
examples of this are kvm_vcpu_block() calls made by VCPUs to block
311-
themselves. A possible side-effect of that call is to make the
312-
KVM_REQ_UNHALT request, which may then be cleared immediately when the
313-
VCPU returns from the call.
314-
315289
References
316290
==========
317291

arch/arm64/kvm/arm.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ void kvm_vcpu_wfi(struct kvm_vcpu *vcpu)
666666

667667
kvm_vcpu_halt(vcpu);
668668
vcpu_clear_flag(vcpu, IN_WFIT);
669-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
670669

671670
preempt_disable();
672671
vgic_v4_load(vcpu);

arch/mips/kvm/emulate.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,6 @@ enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu)
958958
* We are runnable, then definitely go off to user space to
959959
* check if any I/O interrupts are pending.
960960
*/
961-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
962961
if (kvm_arch_vcpu_runnable(vcpu))
963962
vcpu->run->exit_reason = KVM_EXIT_IRQ_WINDOW_OPEN;
964963
}

arch/powerpc/kvm/book3s_pr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ static void kvmppc_set_msr_pr(struct kvm_vcpu *vcpu, u64 msr)
499499
if (msr & MSR_POW) {
500500
if (!vcpu->arch.pending_exceptions) {
501501
kvm_vcpu_halt(vcpu);
502-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
503502
vcpu->stat.generic.halt_wakeup++;
504503

505504
/* Unset POW bit after we woke up */

arch/powerpc/kvm/book3s_pr_papr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ int kvmppc_h_pr(struct kvm_vcpu *vcpu, unsigned long cmd)
393393
case H_CEDE:
394394
kvmppc_set_msr_fast(vcpu, kvmppc_get_msr(vcpu) | MSR_EE);
395395
kvm_vcpu_halt(vcpu);
396-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
397396
vcpu->stat.generic.halt_wakeup++;
398397
return EMULATE_DONE;
399398
case H_LOGICAL_CI_LOAD:

arch/powerpc/kvm/booke.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
719719
if (vcpu->arch.shared->msr & MSR_WE) {
720720
local_irq_enable();
721721
kvm_vcpu_halt(vcpu);
722-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
723722
hard_irq_disable();
724723

725724
kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS);

arch/powerpc/kvm/powerpc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
239239
case EV_HCALL_TOKEN(EV_IDLE):
240240
r = EV_SUCCESS;
241241
kvm_vcpu_halt(vcpu);
242-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
243242
break;
244243
default:
245244
r = EV_UNIMPLEMENTED;

arch/riscv/kvm/vcpu_insn.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ void kvm_riscv_vcpu_wfi(struct kvm_vcpu *vcpu)
191191
kvm_vcpu_srcu_read_unlock(vcpu);
192192
kvm_vcpu_halt(vcpu);
193193
kvm_vcpu_srcu_read_lock(vcpu);
194-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
195194
}
196195
}
197196

arch/s390/kvm/kvm-s390.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4343,8 +4343,6 @@ static int kvm_s390_handle_requests(struct kvm_vcpu *vcpu)
43434343
goto retry;
43444344
}
43454345

4346-
/* nothing to do, just clear the request */
4347-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
43484346
/* we left the vsie handler, nothing to do, just clear the request */
43494347
kvm_clear_request(KVM_REQ_VSIE_RESTART, vcpu);
43504348

arch/x86/kvm/x86.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10813,8 +10813,6 @@ static inline int vcpu_block(struct kvm_vcpu *vcpu)
1081310813
if (hv_timer)
1081410814
kvm_lapic_switch_to_hv_timer(vcpu);
1081510815

10816-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
10817-
1081810816
/*
1081910817
* If the vCPU is not runnable, a signal or another host event
1082010818
* of some kind is pending; service it without changing the
@@ -11034,7 +11032,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
1103411032
r = 0;
1103511033
goto out;
1103611034
}
11037-
kvm_clear_request(KVM_REQ_UNHALT, vcpu);
1103811035
r = -EAGAIN;
1103911036
if (signal_pending(current)) {
1104011037
r = -EINTR;

0 commit comments

Comments
 (0)