aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/timer.h
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2011-01-08 10:09:44 +0000
committerKeir Fraser <keir@xen.org>2011-01-08 10:09:44 +0000
commitd8ec7a2381c2b26ea518610fa95c507c6872bdfa (patch)
tree1c520feb146f6c0ff6ff80d82d3e4a245f0b0927 /xen/include/xen/timer.h
parent44260b1a73a53f015530798438c20301f0858173 (diff)
downloadxen-d8ec7a2381c2b26ea518610fa95c507c6872bdfa.tar.gz
xen-d8ec7a2381c2b26ea518610fa95c507c6872bdfa.tar.bz2
xen-d8ec7a2381c2b26ea518610fa95c507c6872bdfa.zip
timer: Ensure that CPU field of a timer is read safely when lock-free.
Firstly, all updates must use atomic_write16(), and lock-free reads must use atomic_read16(). Secondly, we ensure ->cpu is the only field accessed without a lock. This requires us to place a special sentinel value in that field when a timer is killed, to avoid needing to read ->status outside a locked critical section. Signed-off-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/include/xen/timer.h')
-rw-r--r--xen/include/xen/timer.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/xen/include/xen/timer.h b/xen/include/xen/timer.h
index e8b80f248e..d2091420d7 100644
--- a/xen/include/xen/timer.h
+++ b/xen/include/xen/timer.h
@@ -32,6 +32,7 @@ struct timer {
void *data;
/* CPU on which this timer will be installed and executed. */
+#define TIMER_CPU_status_killed 0xffffu /* Timer is TIMER_STATUS_killed */
uint16_t cpu;
/* Timer status. */