Skip to contentSkip to conversation

UML - Add locking to xtime accesses

PATCH In review Jeff Dike 1 participant 1 message Jun 29, 2006 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 5/9 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.

arch/um/kernel/time_kern.c +8 -2
Index: linux-2.6.17/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,
 	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)

Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel