aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-06-30 01:55:56 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-30 11:25:37 -0700
commit572e614750c3ed27da1ec6b75dc486066a11fffd (patch)
tree50459d715a5145e43c7da1e0d87a85582258ca94
parent6edb08620fbeeeba81ab63c7129a51cdb3acd8b3 (diff)
[PATCH] uml: add locking to xtime accesses
do_timer must be called with xtime_lock held. I'm not sure boot_timer_handler needs this, however I don't think it hurts: it simply disables irq and takes a spinlock. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/kernel/time_kern.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 87cdbc560d3..08dd727e79e 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -96,11 +96,15 @@ void time_init_kern(void)
void do_boot_timer_handler(struct sigcontext * sc)
{
+ unsigned long flags;
struct pt_regs regs;
CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc),
(void) (regs.regs.skas.is_user = 0));
+
+ write_seqlock_irqsave(&xtime_lock, flags);
do_timer(&regs);
+ write_sequnlock_irqrestore(&xtime_lock, flags);
}
static DEFINE_SPINLOCK(timer_spinlock);
@@ -125,15 +129,17 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
unsigned long long nsecs;
unsigned long flags;
+ write_seqlock_irqsave(&xtime_lock, flags);
+
do_timer(regs);
- write_seqlock_irqsave(&xtime_lock, flags);
nsecs = get_time() + local_offset;
xtime.tv_sec = nsecs / NSEC_PER_SEC;
xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
+
write_sequnlock_irqrestore(&xtime_lock, flags);
- return(IRQ_HANDLED);
+ return IRQ_HANDLED;
}
long um_time(int __user *tloc)