patch-2.1.36 linux/kernel/time.c

Next file: linux/mm/page_alloc.c
Previous file: linux/kernel/sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.35/linux/kernel/time.c linux/kernel/time.c
@@ -167,20 +167,21 @@
 	if (tz) {
 		if (copy_from_user(&new_tz, tz, sizeof(*tz)))
 			return -EFAULT;
-		lock_kernel();
+
+		/* SMP safe, global irq locking makes it work. */
 		sys_tz = new_tz;
 		if (firsttime) {
 			firsttime = 0;
 			if (!tv)
 				warp_clock();
 		}
-		unlock_kernel();
 	}
 	if (tv)
 	{
-		lock_kernel();
+		/* SMP safe, again the code in arch/foo/time.c should
+		 * globally block out interrupts when it runs.
+		 */
 		do_settimeofday(&new_tv);
-		unlock_kernel();
 	}
 	return 0;
 }
@@ -234,9 +235,7 @@
 		if (txc.tick < 900000/HZ || txc.tick > 1100000/HZ)
 			return -EINVAL;
 
-	lock_kernel();
-
-	cli();
+	cli(); /* SMP: global cli() is enough protection. */
 
 	/* Save for later - semantics of adjtime is to return old value */
 	save_adjust = time_adjust;
@@ -351,6 +350,6 @@
 	txc.stbcnt	   = pps_stbcnt;
 
 	sti();
-	unlock_kernel();
+
 	return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : time_state;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov