Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Apr 2016 14:34:25 +0100 (BST)
From:      Stefano Stabellini <sstabellini@kernel.org>
To:        freebsd-xen@freebsd.org
Cc:        xen-devel@lists.xenproject.org, sstabellini@kernel.org,  roger.pau@citrix.com
Subject:   [PATCH] xen/x86: don't lose event interrupts
Message-ID:  <alpine.DEB.2.10.1604211432440.23110@sstabellini-ThinkPad-X260>

next in thread | raw e-mail | index | archive | help
xen/x86: don't lose event interrupts

On slow platforms with unreliable TSC, such as QEMU emulated machines,
it is possible for the FreeBSD kernel to request the next event in the
past. In that case, in the current implementation of
xentimer_vcpu_start_timer, we simply return -ETIME. To be precise Xen
returns -ETIME and we pass it on. As a consequence we need to loop
around to function to make sure that the timer is properly set.

Instead it is better to always ask the hypervisor for a timer event,
even if the timeout is past. To do that, remove the VCPU_SSHOTTMR_future
flag.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>

diff --git a/sys/dev/xen/timer/timer.c b/sys/dev/xen/timer/timer.c
index 53aff0a..db9b19b 100644
--- a/sys/dev/xen/timer/timer.c
+++ b/sys/dev/xen/timer/timer.c
@@ -267,7 +267,8 @@ xentimer_vcpu_start_timer(int vcpu, uint64_t next_time)
 	struct vcpu_set_singleshot_timer single;
 
 	single.timeout_abs_ns = next_time;
-	single.flags          = VCPU_SSHOTTMR_future;
+	/* Get an event anyway, even if the timeout is already expired */
+	single.flags          = 0;
 	return (HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, vcpu, &single));
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.DEB.2.10.1604211432440.23110>