[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce716485bb0b3097cefb77c1ec53e1834bef2e06.camel@infradead.org>
Date: Tue, 08 Feb 2022 12:36:33 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: Joao Martins <joao.m.martins@...cle.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, metikaya@...zon.co.uk
Cc: Ankur Arora <ankur.a.arora@...cle.com>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org
Subject: Re: [PATCH RFC 15/39] KVM: x86/xen: handle PV spinlocks slowpath
On Wed, 2019-02-20 at 20:15 +0000, Joao Martins wrote:
> From: Boris Ostrovsky <boris.ostrovsky@...cle.com>
>
> 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@...cle.com>
> ---
...
> +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);
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5965 bytes)
Powered by blists - more mailing lists