linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* jiffies got lost because of printk
@ 2009-07-14 11:39 林建安
  2009-07-14 15:23 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: 林建安 @ 2009-07-14 11:39 UTC (permalink / raw)
  To: linux-kernel


Hi there,
We found that system time is not synced with RTC time on our embedded 
system.
This is because sometimes we print too many chars to console.
For these lines in the function, release_console_sem, of printk.c,
        for ( ; ; ) {
                spin_lock_irqsave(&logbuf_lock, flags);
                wake_klogd |= log_start - log_end;
                if (con_start == log_end)
                        break;                  /* Nothing to print */
                _con_start = con_start;
                _log_end = log_end;
                con_start = log_end;            /* Flush */
                spin_unlock(&logbuf_lock);
                call_console_drivers(_con_start, _log_end);
                local_irq_restore(flags);
        }

Interrupt will be disabled before calling call_console_drivers and enabled 
after call_console_drivers finishes.
For the setting of com port baud rate 115200 and HZ 100, if there are more 
than 115200/8/100 bytes waiting for output,
interrupt will be disabled for more than 1 HZ and timer interrupt will be 
lost.
I know that printing too much in kernel level is not proper. But for 1000HZ, 
interrupt may be lost even just output 15 chars.
Any idea?

Regards,
Colin



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: jiffies got lost because of printk
  2009-07-14 11:39 jiffies got lost because of printk 林建安
@ 2009-07-14 15:23 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2009-07-14 15:23 UTC (permalink / raw)
  To: 林建安; +Cc: linux-kernel

2009/7/14 林建安 <colin@realtek.com.tw>:

> We found that system time is not synced with RTC time on our embedded
> system. (...)
> interrupt will be disabled for more than 1 HZ and timer interrupt will be
> lost.

This sounds like you're using some kind of old timekeeping code.
Make sure you migrate to using a proper time source and clock
events. It will compensate for lost jiffies in situations like this.

Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-14 15:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-14 11:39 jiffies got lost because of printk 林建安
2009-07-14 15:23 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).