diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-19 11:54:31 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-19 11:54:31 +0100 |
commit | 68afcbc491c40150d3dc63e3f59b9d42a3dead22 (patch) | |
tree | 0f812982620a54ab3be2662d94f6c41b74ba8ecf /xen/common/timer.c | |
parent | e2da2bcec6ff289bb20f5cb0fb6d4b8593f89fca (diff) | |
download | xen-68afcbc491c40150d3dc63e3f59b9d42a3dead22.tar.gz xen-68afcbc491c40150d3dc63e3f59b9d42a3dead22.tar.bz2 xen-68afcbc491c40150d3dc63e3f59b9d42a3dead22.zip |
timers: Migrate timers away from an offlined CPU.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/timer.c')
-rw-r--r-- | xen/common/timer.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/xen/common/timer.c b/xen/common/timer.c index 57d488ce9a..68b56a6805 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -515,6 +515,29 @@ static struct keyhandler dump_timerq_keyhandler = { .desc = "dump timer queues" }; +static void migrate_timers_from_cpu(unsigned int cpu) +{ + struct timers *ts; + struct timer *t; + + ASSERT((cpu != 0) && cpu_online(0)); + + ts = &per_cpu(timers, cpu); + + spin_lock_irq(&per_cpu(timers, 0).lock); + spin_lock(&ts->lock); + + while ( (t = GET_HEAP_SIZE(ts->heap) ? ts->heap[1] : ts->list) != NULL ) + { + remove_entry(ts, t); + t->cpu = 0; + __add_timer(t); + } + + spin_unlock(&ts->lock); + spin_unlock_irq(&per_cpu(timers, 0).lock); +} + static struct timer *dummy_heap; static int cpu_callback( @@ -531,8 +554,7 @@ static int cpu_callback( break; case CPU_UP_CANCELED: case CPU_DEAD: - /* Enable this later. */ - /*WARN_ON(GET_HEAP_SIZE(ts->heap) || ts->list);*/ + migrate_timers_from_cpu(cpu); break; default: break; |