From: Andrew Morton <akpm@linux-foundation.org>
To: Zachary Amsden <zach@vmware.com>
Cc: Daniel Hecht <dhecht@vmware.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Linus Torvalds <torvalds@linux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Bug in on_each_cpu?
Date: Thu, 1 Mar 2007 07:28:59 -0800 [thread overview]
Message-ID: <20070301072859.aea3c4da.akpm@linux-foundation.org> (raw)
In-Reply-To: <45E6BA3A.2040306@vmware.com>
On Thu, 01 Mar 2007 03:34:18 -0800 Zachary Amsden <zach@vmware.com> wrote:
> > Why is it a bug? Because there's a deadlock where this CPU is waiting for
> > CPU A to take the IPI, but CPU A is waiting (with interrupts disabled) for
> > this CPU to take an IPI.
> >
>
> Then the bug is not in on_each_cpu(). It is in the usage of
> clock_was_set(). For example, look at do_settimeofday in kernel/timer.c:
>
> write_sequnlock_irqrestore(&xtime_lock, flags);
>
> /* signal hrtimers about time change */
> clock_was_set();
>
> return 0;
Perhaps a WARN_ON(irqs_disabled()) in clock_was_set() would help. But probably
the one in smp_call_function() will suffice.
> And timekeeping_resume has similar code (and called from a sysdev
> callback, so I don't know what the interrupt state should be ). Either
> the write_sequnlock_irqrestore is redundant, and should be merely an
> write_sequnlock_irq, or the callsite is not prepared to handle enabling
> interrupts temporarily as must be done for on_each_cpu(), which is a
> pretty scary scenario.
>
> What would be really, really nice would be to statically check all
> callsites that issue irq disables actually keep irqs disabled.
> Presumably, there was a reason they disabled irqs, and re-enabling them
> underneath their noses, even if it is to avoid a race, breaks the logic
> behind that reason.
yup. I once played with adding warnings in places like spin_lock_irq(),
but there were false positives from places which were odd-but-correct.
It would be worth revisiting however.
next prev parent reply other threads:[~2007-03-01 15:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <45E6AC1A.8050608@vmware.com>
[not found] ` <20070301024524.c7c8ea1a.akpm@linux-foundation.org>
2007-03-01 11:34 ` Bug in on_each_cpu? Zachary Amsden
2007-03-01 11:41 ` Rusty Russell
2007-03-01 11:47 ` Zachary Amsden
2007-03-01 15:22 ` Andrew Morton
2007-03-01 20:31 ` Zachary Amsden
2007-03-02 4:46 ` Ernie Petrides
2007-03-01 15:28 ` Andrew Morton [this message]
2007-03-01 20:03 ` Zachary Amsden
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=20070301072859.aea3c4da.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dhecht@vmware.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@linux-foundation.org \
--cc=zach@vmware.com \
/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