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

[Xen-changelog] [linux-2.6.18-xen] Do not call clock_was_set() from interrupt context.



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1183393164 -3600
# Node ID cb040341e05af32c804afef4216ec5491dcbf9e3
# Parent  4a284f968015fa4cd50d9d4c7695534c87c7bce6
Do not call clock_was_set() from interrupt context.

Currently clock_was_set() is a nop but on newer kernels it is not and
cannot be called from interrupt context. Prepare for that by deferring
to a workqueue. Since a timer interrupt can occur before
init_workqueue() is called we need to protect against the possibility
that keventd hasn't started yet.

(drop unused variable max_ntp_tick).

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 arch/i386/kernel/time-xen.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff -r 4a284f968015 -r cb040341e05a arch/i386/kernel/time-xen.c
--- a/arch/i386/kernel/time-xen.c       Mon Jul 02 13:05:39 2007 +0100
+++ b/arch/i386/kernel/time-xen.c       Mon Jul 02 17:19:24 2007 +0100
@@ -130,6 +130,12 @@ static DEFINE_PER_CPU(struct vcpu_runsta
 /* Must be signed, as it's compared with s64 quantities which can be -ve. */
 #define NS_PER_TICK (1000000000LL/HZ)
 
+static void __clock_was_set(void *unused)
+{
+       clock_was_set();
+}
+static DECLARE_WORK(clock_was_set_work, __clock_was_set, NULL);
+
 static inline void __normalize_time(time_t *sec, s64 *nsec)
 {
        while (*nsec >= NSEC_PER_SEC) {
@@ -365,7 +371,6 @@ void do_gettimeofday(struct timeval *tv)
 {
        unsigned long seq;
        unsigned long usec, sec;
-       unsigned long max_ntp_tick;
        unsigned long flags;
        s64 nsec;
        unsigned int cpu;
@@ -677,7 +682,8 @@ irqreturn_t timer_interrupt(int irq, voi
 
        if (shadow_tv_version != HYPERVISOR_shared_info->wc_version) {
                update_wallclock();
-               clock_was_set();
+               if (keventd_up())
+                       schedule_work(&clock_was_set_work);
        }
 
        write_sequnlock(&xtime_lock);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.