From: Karel Zak Date: Thu, 16 Oct 2008 21:37:38 +0000 (+0200) Subject: hwclock: remove "cli" and "sti" from i386 CMOS code X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a55ee51ccdd09897985200a3ea56c35be29eb21;p=util-linux hwclock: remove "cli" and "sti" from i386 CMOS code The protection against context switch is nonsense. There is possible to optimize the access to CMOS by mlockall(MCL_CURRENT) and SCHED_FIFO. For more details see: http://lkml.org/lkml/2008/10/12/132 Reported-by: Arjan van de Ven Signed-off-by: Karel Zak --- diff --git a/hwclock/cmos.c b/hwclock/cmos.c index ca3ca61e..91b358d2 100644 --- a/hwclock/cmos.c +++ b/hwclock/cmos.c @@ -216,30 +216,7 @@ set_cmos_access(int Jensen, int funky_toy) { #endif - - -#ifdef __i386__ - -/* - * Try to do CMOS access atomically, so that no other processes - * can get a time slice while we are reading or setting the clock. - * (Also, if the kernel time is synchronized with an external source, - * the kernel itself will fiddle with the RTC every 11 minutes.) - */ - -static unsigned long -atomic(const char *name, unsigned long (*op)(unsigned long), - unsigned long arg) -{ - unsigned long v; - __asm__ volatile ("cli"); - v = (*op)(arg); - __asm__ volatile ("sti"); - return v; -} - -#elif __alpha__ - +#if __alpha__ /* * The Alpha doesn't allow user-level code to disable interrupts (for * good reasons). Instead, we ensure atomic operation by performing @@ -267,12 +244,14 @@ atomic(const char *name, unsigned long (*op)(unsigned long), fprintf(stderr, _("%s: atomic %s failed for 1000 iterations!"), progname, name); exit(1); } - #else /* * Hmmh, this isn't very atomic. Maybe we should force an error * instead? + * + * TODO: optimize the access to CMOS by mlockall(MCL_CURRENT) + * and SCHED_FIFO */ static unsigned long atomic(const char *name, unsigned long (*op)(unsigned long),