From 433c8bea8a4047aec35d894a3283853d1a48f897 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 16 Oct 2008 23:37:38 +0200 Subject: [PATCH] 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 --- hwclock/cmos.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/hwclock/cmos.c b/hwclock/cmos.c index c45a5045..8b3495b7 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), -- 2.39.5