Sean Christopherson <[email protected]> writes:
> On Tue, Jul 21, 2020 at 12:57:21PM +0200, Thomas Gleixner wrote:
>> -            if (signal_pending(current))
>> +            if (__exit_to_guest_mode_work_pending())
>
> I whined about this back in v2[*].  "exit to guest mode" is confusing becuase
> virt terminology is "enter to guest" and "exit from guest", whereas the
> kernel's terminology here is "exit from kernel to guest".
>
> My past and current self still like XFER_TO_GUEST as the base terminology.
>
> [*] https://lkml.kernel.org/r/[email protected]

Forgot about that, sorry. Will fix.

>> @@ -8676,15 +8677,11 @@ static int vcpu_run(struct kvm_vcpu *vcp
>>                      break;
>>              }
>>  
>> -            if (signal_pending(current)) {
>> -                    r = -EINTR;
>> -                    vcpu->run->exit_reason = KVM_EXIT_INTR;
>> -                    ++vcpu->stat.signal_exits;
>> -                    break;
>> -            }
>> -            if (need_resched()) {
>> +            if (exit_to_guest_mode_work_pending()) {
>>                      srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
>> -                    cond_resched();
>> +                    r = exit_to_guest_mode(vcpu);
>> +                    if (r)
>
> This loses the stat.signal_exits accounting.  Maybe this?

No, it does not:

+               if (ti_work & _TIF_SIGPENDING) {
+                       kvm_handle_signal_exit(vcpu);
+                       return -EINTR;
+               }

and

+#ifdef CONFIG_KVM_EXIT_TO_GUEST_WORK
+static inline void kvm_handle_signal_exit(struct kvm_vcpu *vcpu)
+{
+       vcpu->run->exit_reason = KVM_EXIT_INTR;
+       vcpu->stat.signal_exits++;
+}
+#endif /* CONFIG_KVM_EXIT_TO_GUEST_WORK */

in patch 5/15

Thanks,

        tglx

Reply via email to