Re: [PATCH RFC 15/39] KVM: x86/xen: handle PV spinlocks slowpath

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2019-02-20 at 20:15 +0000, Joao Martins wrote:
> From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> 
> Add support for SCHEDOP_poll hypercall.
> 
> This implementation is optimized for polling for a single channel, which
> is what Linux does. Polling for multiple channels is not especially
> efficient (and has not been tested).
> 
> PV spinlocks slow path uses this hypercall, and explicitly crash if it's
> not supported.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> ---

...

> +static void kvm_xen_check_poller(struct kvm_vcpu *vcpu, int port)
> +{
> +       struct kvm_vcpu_xen *vcpu_xen = vcpu_to_xen_vcpu(vcpu);
> +
> +       if ((vcpu_xen->poll_evtchn == port ||
> +            vcpu_xen->poll_evtchn == -1) &&
> +           test_and_clear_bit(vcpu->vcpu_id, vcpu->kvm->arch.xen.poll_mask))
> +               wake_up(&vcpu_xen->sched_waitq);
> +}

...

> +	if (sched_poll.nr_ports == 1)
> +		vcpu_xen->poll_evtchn = port;
> +	else
> +		vcpu_xen->poll_evtchn = -1;
> +
> +	if (!wait_pending_event(vcpu, sched_poll.nr_ports, ports))
> +		wait_event_interruptible_timeout(
> +			 vcpu_xen->sched_waitq,
> +			 wait_pending_event(vcpu, sched_poll.nr_ports, ports),
> +			 sched_poll.timeout ?: KTIME_MAX);

Hm, this doesn't wake on other interrupts, does it? I think it should.
Shouldn't it basically be like HLT, with an additional wakeup when the
listed ports are triggered even when they're masked?

At https://git.infradead.org/users/dwmw2/linux.git/commitdiff/ddfbdf1af
I've tried to make it use kvm_vcpu_halt(), and kvm_xen_check_poller()
sets KVM_REQ_UNBLOCK when an event is delivered to a monitored port.

I haven't quite got it to work yet, but does it seem like a sane
approach?

+       if (!wait_pending_event(vcpu, sched_poll.nr_ports, ports)) {
+               vcpu->arch.mp_state = KVM_MP_STATE_HALTED;
+               kvm_vcpu_halt(vcpu);





Attachment: smime.p7s
Description: S/MIME cryptographic signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux