Hi all.
I'm using kernel 2.4.16 on my SH-4 board.
After I start xntpd, I get following kernel messages.
---------------------------------------------
Scheduling in interrupt
kernel BUG at sched.c:551!
alloc_skb called nonatomically from interrupt 880c2086
Warning: kfree_skb on hard IRQ 88105074
Warning: kfree_skb on hard IRQ 880ae3c6
---------------------------------------------
When I comment out schedule_timeout(HZ/2) calls in
arch/sh/kernel/rtc.c:sh_rtc_settimeofday, these messages disappear.
I think that sh_rtc_settimeofday is called from time.c:do_timer_interrupt,
so we should not call schedule_timeout here.
Here is the patch. Please test it.
* arch/sh/kernel/rtc.c (sh_rtc_gettimeofday): Another work around implemented.
(set_rtc_time sh_rtc_settimeofday): merged.
Index: arch/sh/kernel/rtc.c
===================================================================
RCS file: /home/cvs/linux/linux-sh-2.4/arch/sh/kernel/rtc.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 rtc.c
--- arch/sh/kernel/rtc.c 2001/05/28 10:39:21 1.1.1.1
+++ arch/sh/kernel/rtc.c 2001/12/11 07:41:45
@@ -46,7 +46,7 @@
} while ((ctrl_inb(RCR1) & RCR1_CF) != 0);
#if RTC_BIT_INVERTED != 0
- /* Work around to avoid reading correct value. */
+ /* Work around to avoid reading incorrect value. */
if (sec128 == RTC_BIT_INVERTED) {
schedule_timeout(1);
goto again;
@@ -81,12 +81,18 @@
goto again;
}
+#if RTC_BIT_INVERTED != 0
+ if ((sec128 & RTC_BIT_INVERTED) != 0)
+ sec--;
+#endif
+
tv->tv_sec = mktime(yr100 * 100 + yr, mon, day, hr, min, sec);
- tv->tv_usec = ((sec128 ^ RTC_BIT_INVERTED) * 1000000) / 128;
+ tv->tv_usec = (sec128 * 1000000) / 128;
}
-static int set_rtc_time(unsigned long nowtime)
+int sh_rtc_settimeofday(const struct timeval *tv)
{
+ unsigned long nowtime = tv->tv_sec;
int retval = 0;
int real_seconds, real_minutes, cmos_minutes;
@@ -122,13 +128,4 @@
ctrl_outb(RCR2_RTCEN|RCR2_START, RCR2); /* Start RTC */
return retval;
-}
-
-int sh_rtc_settimeofday(const struct timeval *tv)
-{
-#if RTC_BIT_INVERTED != 0
- /* This is not accurate, but better than nothing. */
- schedule_timeout(HZ/2);
-#endif
- return set_rtc_time(tv->tv_sec);
}
----
SUGIOKA Toshinobu
|