mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Duane Griffin" <duaneg@dghda.com>
To: Chris Adams <cmadams@hiwaay.net>
Cc: Linas Vepstas <linasvepstas@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: Bug: Status/Summary of slashdot leap-second crash on new years 2008-2009
Date: Sat, 3 Jan 2009 02:23:58 +0000	[thread overview]
Message-ID: <20090103022358.GA2454@dastardly.home.dghda.com> (raw)
In-Reply-To: <20090103002114.GA1538533@hiwaay.net>

On Fri, Jan 02, 2009 at 06:21:14PM -0600, Chris Adams wrote:
> Once upon a time, Linas Vepstas <linasvepstas@gmail.com> said:
> > Below follows a summary of the reported crashes. I'm ignoring the
> > zillions of "mine didn't crash" reports, or the "you're a paranoid
> > conspiracy theorist, its random chance" reports.
> 
> I have reproduced this and got a stack trace (this is with Fedora 8 and
> kernel kernel-2.6.26.6-49.fc8.x86_64):
> 
> #0  ktime_get_ts (ts=0xffffffff8158bb30) at include/asm/processor.h:691
> #1  0xffffffff8104c09a in ktime_get () at kernel/hrtimer.c:59
> #2  0xffffffff8102a39a in hrtick_start_fair (rq=0xffff810009013880, 
>     p=<value optimized out>) at kernel/sched.c:1064
> #3  0xffffffff8102decc in enqueue_task_fair (rq=0xffff810009013880, 
>     p=0xffff81003fb02d40, wakeup=1) at kernel/sched_fair.c:863
> #4  0xffffffff81029a08 in enqueue_task (rq=0xffffffff8158bb30, 
>     p=0xffff81003b8ac418, wakeup=-994836480) at kernel/sched.c:1550
> #5  0xffffffff81029a39 in activate_task (rq=0xffff810009013880, 
>     p=0xffff81003b8ac418, wakeup=20045) at kernel/sched.c:1614
> #6  0xffffffff8102be38 in try_to_wake_up (p=0xffff81003fb02d40, 
>     state=<value optimized out>, sync=0) at kernel/sched.c:2173
> #7  0xffffffff8102be9c in default_wake_function (curr=<value optimized out>, 
>     mode=998949912, sync=20045, key=0x4c4b40000) at kernel/sched.c:4366
> #8  0xffffffff810492ed in autoremove_wake_function (wait=0xffffffff8158bb30, 
>     mode=998949912, sync=20045, key=0x4c4b40000) at kernel/wait.c:132
> #9  0xffffffff810296a2 in __wake_up_common (q=0xffffffff813d3180, mode=1, 
>     nr_exclusive=1, sync=0, key=0x0) at kernel/sched.c:4387
> #10 0xffffffff8102b97b in __wake_up (q=0xffffffff813d3180, mode=1, 
>     nr_exclusive=1, key=0x0) at kernel/sched.c:4406
> #11 0xffffffff8103692f in wake_up_klogd () at kernel/printk.c:1005
> #12 0xffffffff81036abb in release_console_sem () at kernel/printk.c:1051
> #13 0xffffffff81036fd1 in vprintk (fmt=<value optimized out>, 
>     args=<value optimized out>) at kernel/printk.c:789
> #14 0xffffffff81037081 in printk (
>     fmt=0xffffffff8158bb30 "yj$\201????\2008\001\t") at kernel/printk.c:613
> #15 0xffffffff8104ec16 in ntp_leap_second (timer=<value optimized out>)
>     at kernel/time/ntp.c:143
> #16 0xffffffff8104b7a6 in run_hrtimer_pending (cpu_base=0xffff81000900f740)
>     at kernel/hrtimer.c:1204
> #17 0xffffffff8104b86a in run_hrtimer_softirq (h=<value optimized out>)
>     at kernel/hrtimer.c:1355
> #18 0xffffffff8103b31f in __do_softirq () at kernel/softirq.c:234
> #19 0xffffffff8100d52c in call_softirq () at include/asm/current_64.h:10
> #20 0xffffffff8100ed5e in do_softirq () at arch/x86/kernel/irq_64.c:262
> #21 0xffffffff8103b280 in irq_exit () at kernel/softirq.c:310
> #22 0xffffffff8101b0fe in smp_apic_timer_interrupt (regs=<value optimized out>)
>     at arch/x86/kernel/apic_64.c:514
> #23 0xffffffff8100cf52 in apic_timer_interrupt ()
>     at include/asm/current_64.h:10
> #24 0xffff81003b9d5a90 in ?? ()
> #25 0x0000000000000000 in ?? ()
> 
> 
> Basically (to my untrained eye), the leap second code is called from the
> timer interrupt handler, which holds xtime_lock.  The leap second code
> does a printk to notify about the leap second.  The printk code tries to
> wake up klogd (I assume to prioritize kernel messages), and (under some
> conditions), the scheduler attempts to get the current time, which tries
> to get xtime_lock => deadlock.
> 
> I can only reproduce this if the system is busy.  If the system is
> otherwise idle at the timer interrupt, I guess the scheduler doesn't try
> to get the time.  I can run a "find / | xargs cat > /dev/nul" in one
> window and then trigger the leap second in another, and the system dies
> most of the time.
> 
> I'm looking at the source for the RHEL 4 kernel 2.6.9-67.0.7.EL (which I
> had crash on a system), and the scheduler is enough different that I am
> not finding the path to the deadlock right off.
> 
> In any case, the quick-n-dirty fix would be to not try to printk while
> holding xtime_lock (I think the NTP code is the only thing that does).
> However, it would be nice to still get the leap second notification, so
> some other fix would be better I guess.

How about just moving the printk out of the lock? I.e. something like
this:

diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index f5f793d..ad3e2b7 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -140,8 +140,6 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer)
 		xtime.tv_sec--;
 		wall_to_monotonic.tv_sec++;
 		time_state = TIME_OOP;
-		printk(KERN_NOTICE "Clock: "
-		       "inserting leap second 23:59:60 UTC\n");
 		hrtimer_add_expires_ns(&leap_timer, NSEC_PER_SEC);
 		res = HRTIMER_RESTART;
 		break;
@@ -166,6 +164,10 @@ static enum hrtimer_restart ntp_leap_second(struct hrtimer *timer)
 
 	write_sequnlock(&xtime_lock);
 
+	if (res == HRTIMER_RESTART)
+		printk(KERN_NOTICE "Clock: "
+		       "inserting leap second 23:59:60 UTC\n");
+
 	return res;
 }
 

> -- 
> Chris Adams <cmadams@hiwaay.net>
> Systems and Network Administrator - HiWAAY Internet Services
> I don't speak for anybody but myself - that's enough trouble.

Cheers,
Duane.

-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan

  reply	other threads:[~2009-01-03  2:24 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-02 19:25 Linas Vepstas
2009-01-02 20:04 ` Diego Calleja
2009-01-02 20:25   ` Robert Hancock
2009-01-03  6:32     ` David Newall
2009-01-03  6:37       ` Ben Goodger
2009-01-04  8:43         ` David Newall
2009-01-04  9:00           ` Kyle Moffett
2009-01-04 10:03             ` David Newall
2009-01-04 11:13               ` david
2009-01-04 23:15                 ` David Newall
2009-01-04 23:25                   ` Chris Adams
2009-01-05  0:01                     ` David Newall
2009-01-05  0:41                       ` Alan Cox
2009-01-05  8:43                         ` David Newall
2009-01-05 19:47                           ` Alan Cox
2009-01-05  0:29                   ` david
2009-01-04 23:37                     ` David Newall
2009-01-05  1:05                       ` david
2009-01-05  0:14                         ` David Newall
2009-01-05  0:21                           ` Ben Goodger
2009-01-05  6:34                             ` David Newall
2009-01-05 23:03                               ` Linas Vepstas
2009-01-05  0:44                         ` Alan Cox
2009-01-05  5:48                       ` Linas Vepstas
2009-01-05 14:33                         ` Nick Andrew
2009-01-05 16:08                           ` Linas Vepstas
2009-01-05 17:51                             ` david
2009-01-05 17:42                               ` Linas Vepstas
2009-01-06  2:27                                 ` john stultz-lkml
2009-01-06  4:53                                   ` Linas Vepstas
2009-01-06  5:00                                     ` Linas Vepstas
2009-01-06 19:40                                     ` [ntpwg] " M. Warner Losh
2009-01-06 19:50                                 ` M. Warner Losh
2009-01-07  3:50                                 ` Danny Mayer
2009-01-07  4:52                                   ` Linas Vepstas
2009-01-07 10:03                                     ` David Newall
2009-01-07 17:24                                       ` M. Warner Losh
2009-01-08 16:51                                         ` Magnus Danielson
2009-01-07 14:34                                     ` Danny Mayer
2009-01-07 15:42                                       ` Linas Vepstas
2009-01-07 19:23                                         ` Danny Mayer
2009-01-07 16:04                                       ` john stultz
2009-01-07 17:36                                     ` M. Warner Losh
2009-01-07 17:39                                   ` M. Warner Losh
2009-01-07 19:31                                     ` Alan Cox
2009-01-07 19:42                                       ` M. Warner Losh
2009-01-08  3:57                                       ` Danny Mayer
2009-01-08  4:42                                         ` M. Warner Losh
2009-01-08 10:48                                           ` Alan Cox
2009-01-08 10:56                                             ` Alan Cox
2009-01-08 22:22                                               ` David Mills
2009-01-08 15:02                                             ` M. Warner Losh
2009-01-08 18:57                                               ` Marshall Eubanks
2009-01-08 20:09                                     ` Steve Allen
2009-01-12 16:11                                 ` Pavel Machek
2009-01-12 17:07                                   ` [ntpwg] " M. Warner Losh
2009-01-12 21:45                                     ` Valdis.Kletnieks
2009-01-06  2:31                             ` Nick Andrew
2009-01-06  1:59                           ` David Newall
2009-01-06  2:18                             ` Chris Adams
2009-01-06  2:51                             ` Nick Andrew
2009-01-06  9:40                               ` Alan Cox
2009-01-07  1:17                                 ` Nick Andrew
2009-01-07  9:37                                   ` Alan Cox
2009-01-07  9:46                                 ` David Newall
2009-01-07  9:54                                   ` Alan Cox
2009-01-07 10:18                                     ` David Newall
2009-01-07 10:52                                       ` Alan Cox
2009-01-07 13:45                                         ` David Newall
2009-01-07 14:10                                           ` Alan Cox
2009-01-07 14:36                                             ` David Newall
2009-01-07 15:40                                               ` Alan Cox
2009-01-10  9:46                                                 ` David Newall
2009-01-07 22:13                                               ` Chris Adams
2009-01-07 13:33                                       ` Chris Adams
2009-01-07 13:37                                         ` Alan Cox
2009-01-07 14:12                                           ` David Newall
2009-01-07 14:09                                         ` David Newall
2009-01-07 21:42                                           ` Chris Adams
2009-01-04 11:35               ` Valdis.Kletnieks
2009-01-05  0:08                 ` David Newall
2009-01-06  3:53                   ` Valdis.Kletnieks
2009-01-04 17:20               ` Kyle Moffett
2009-01-03  7:00       ` Chris Adams
2009-01-04  8:41         ` David Newall
2009-01-02 20:29   ` Linas Vepstas
     [not found] ` <8752a8760901021328t545a0327v58faebe1e921680a@mail.gmail.com>
2009-01-02 21:29   ` Ben Goodger
2009-01-03  0:21 ` Chris Adams
2009-01-03  2:23   ` Duane Griffin [this message]
2009-01-03  3:45     ` Linas Vepstas
2009-01-03  4:41     ` [PATCH] " Chris Adams
2009-01-03  4:52       ` Duane Griffin
2009-01-03 18:01         ` [PATCH] v2 " Chris Adams
2009-01-03 19:04           ` Duane Griffin
2009-01-03 20:01           ` Linas Vepstas
2009-06-08  2:18           ` Ben Hutchings
2009-06-18 22:34             ` Chris Friesen
2009-06-18 22:58               ` Ben Hutchings
2009-06-18 23:48                 ` Chris Friesen
2009-01-06  2:21   ` john stultz-lkml
2009-01-06  2:25     ` Chris Adams
2009-01-06  4:35     ` Linas Vepstas
2009-01-03  3:49 ` Linas Vepstas
2009-01-03  4:02   ` Ben Goodger
2009-01-03  4:46     ` Duane Griffin
2009-01-03  4:50       ` Ben Goodger
2009-01-03 22:58   ` Jeffrey J. Kosowsky
     [not found] <fa.dw2l5ZM+UL3xoF6IYh5RLMmbYfw@ifi.uio.no>
     [not found] ` <fa.XOM1F85uBvmj4QzZKaDu36nYBk0@ifi.uio.no>
     [not found]   ` <fa.rviZJBmVqkAE5uxDjhJOpIuKT4g@ifi.uio.no>
     [not found]     ` <fa.OPVERUiJ763jH2/QynTxgBgoKYw@ifi.uio.no>
     [not found]       ` <fa.v3FUjJ43bw2G7KiZGaxqL3tD4xo@ifi.uio.no>
     [not found]         ` <fa.BrNhgY8S+TEOLMiPd27M7YHo9bI@ifi.uio.no>
2009-01-04 16:15           ` Sitsofe Wheeler
2009-01-04 17:26             ` Kyle Moffett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090103022358.GA2454@dastardly.home.dghda.com \
    --to=duaneg@dghda.com \
    --cc=cmadams@hiwaay.net \
    --cc=linasvepstas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®