linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Christoph Lameter <christoph@lameter.com>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH 0/5] timers: description
Date: Sun, 27 Mar 2005 14:08:06 +0400	[thread overview]
Message-ID: <42468606.280849C6@tv-sign.ru> (raw)
In-Reply-To: 200503261952.j2QJq1g27569@unix-os.sc.intel.com

"Chen, Kenneth W" wrote:
>
> Oleg Nesterov wrote on March 19, 2005 17:28:48
> > These patches are updated version of 'del_timer_sync: proof of
> > concept' 2 patches.
>
> I changed schedule_timeout() to call the new del_timer_sync instead of
> currently del_singleshot_timer_sync in attempt to stress these set of
> patches a bit more and I just observed a kernel hang.
>
> The symptom starts with lost network connectivity.  It looks like the
> entire ethernet connections were gone, followed by blank screen on the
> console.  I'm not sure whether it is a hard or soft hang, but system
> is inaccessible (blank screen and no network connection). I'm forced
> to do a reboot when that happens.

Very strange. I am running 2.6.11 + timer patches +
	#define del_singleshot_timer_sync(t) del_timer_sync(t)
without any problems.

This timer is private to schedule_timeout(), it can't change
base, so del_timer_sync() should be "obviously correct" in
that case.

What kernel version? Could you try this stupid patch?

Oleg.

--- TST/kernel/timer.c~	2005-03-27 16:47:20.000000000 +0400
+++ TST/kernel/timer.c	2005-03-27 17:16:32.000000000 +0400
@@ -352,27 +352,46 @@ EXPORT_SYMBOL(del_timer);
  */
 int del_timer_sync(struct timer_list *timer)
 {
+	unsigned long tout;
+	int running = 0, migrated = 0, done = 0;
 	int ret;
 
 	check_timer(timer);
 
+	preempt_disable();
+	tout = jiffies + 10;
+
 	ret = 0;
 	for (;;) {
 		unsigned long flags;
 		tvec_base_t *base;
 
 		base = timer_base(timer);
-		if (!base)
+		if (!base) {
+			preempt_enable();
 			return ret;
+		}
+		if (time_after(jiffies, tout)) {
+			preempt_enable();
+			printk(KERN_ERR "del_timer_sync hang: %d %d %d %d\n",
+				running, migrated, done, ret);
+			dump_stack();
+			return 0;
+		}
 
 		spin_lock_irqsave(&base->lock, flags);
 
-		if (base->running_timer == timer)
+		if (base->running_timer == timer) {
+			++running;
 			goto unlock;
+		}
 
-		if (timer_base(timer) != base)
+		if (timer_base(timer) != base) {
+			++migrated;
 			goto unlock;
+		}
 
+		++done;
 		if (timer_pending(timer)) {
 			list_del(&timer->entry);
 			ret = 1;

  reply	other threads:[~2005-03-27 10:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21 14:19 [PATCH 6/5] timers: enable irqs in __mod_timer() Oleg Nesterov
2005-03-22  5:43 ` Andrew Morton
2005-03-24 21:56 ` [PATCH 0/5] timers: description Chen, Kenneth W
2005-03-26 19:52 ` Chen, Kenneth W
2005-03-27 10:08   ` Oleg Nesterov [this message]
2005-03-28 19:12   ` Christoph Lameter
2005-03-29 11:27     ` Oleg Nesterov
2005-03-29 14:47       ` Christoph Lameter
  -- strict thread matches above, loose matches on Subject: below --
2005-03-19 18:30 Oleg Nesterov

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=42468606.280849C6@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=christoph@lameter.com \
    --cc=kenneth.w.chen@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).