public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Remove spurious BUG from posix-cpu-timers
@ 2005-03-19  4:45 Matthew Wilcox
  2005-03-19  4:53 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2005-03-19  4:45 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-arch, Roland McGrath


PA-RISC does not necessarily have interrupts disabled while timers are
running.  This doesn't appear to be a requirement, but posix-cpu-timers
seems to think it is.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>

diff -urpNX dontdiff linus-2.6/kernel/posix-cpu-timers.c parisc-2.6/kernel/posix-cpu-timers.c
--- linus-2.6/kernel/posix-cpu-timers.c	2005-03-18 05:55:27.000000000 -0700
+++ parisc-2.6/kernel/posix-cpu-timers.c	2005-03-18 13:52:53.341505966 -0700
@@ -1242,8 +1242,6 @@ void run_posix_cpu_timers(struct task_st
 	LIST_HEAD(firing);
 	struct k_itimer *timer, *next;
 
-	BUG_ON(!irqs_disabled());
-
 #define UNEXPIRED(clock) \
 		(tsk->it_##clock##_expires == 0 || \
 		 cputime_lt(clock##_ticks(tsk), tsk->it_##clock##_expires))

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

* Re: [PATCH] Remove spurious BUG from posix-cpu-timers
  2005-03-19  4:45 [PATCH] Remove spurious BUG from posix-cpu-timers Matthew Wilcox
@ 2005-03-19  4:53 ` Andrew Morton
  2005-03-19  4:59   ` Matthew Wilcox
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2005-03-19  4:53 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: torvalds, linux-arch, roland

Matthew Wilcox <matthew@wil.cx> wrote:
>
> 
> PA-RISC does not necessarily have interrupts disabled while timers are
> running.  This doesn't appear to be a requirement, but posix-cpu-timers
> seems to think it is.
> 

But a bit later on we do

        spin_lock(&tsk->sighand->siglock);

rather than spin_lock_irqsave()?

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

* Re: [PATCH] Remove spurious BUG from posix-cpu-timers
  2005-03-19  4:53 ` Andrew Morton
@ 2005-03-19  4:59   ` Matthew Wilcox
  2005-03-20  7:38     ` Roland McGrath
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2005-03-19  4:59 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Matthew Wilcox, torvalds, linux-arch, roland

On Fri, Mar 18, 2005 at 08:53:34PM -0800, Andrew Morton wrote:
> Matthew Wilcox <matthew@wil.cx> wrote:
> >
> > 
> > PA-RISC does not necessarily have interrupts disabled while timers are
> > running.  This doesn't appear to be a requirement, but posix-cpu-timers
> > seems to think it is.
> > 
> 
> But a bit later on we do
> 
>         spin_lock(&tsk->sighand->siglock);
> 
> rather than spin_lock_irqsave()?

We're in interrupt context ... we're ok, unless another interrupt handler
tries to take the same spinlock.  Maybe the posix cpu timer code should
be using _irqsave anyway?

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

* Re: [PATCH] Remove spurious BUG from posix-cpu-timers
  2005-03-19  4:59   ` Matthew Wilcox
@ 2005-03-20  7:38     ` Roland McGrath
  0 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2005-03-20  7:38 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Andrew Morton, torvalds, linux-arch

I put those BUG_ON's in places where I was using spin_lock on a lock that
requires irqs disabled.  Those places are called in contexts that already
require irqs disabled for some other reason, so I didn't use
irqsave/irqrestore there to skip the unnecessary overhead.  (Of course it's
the same the BUG_ON's have, but those can be compiled out.)  I really don't
recall at the moment if there was a deeper reason, i.e. that the code itself in
some other way relies on interrupts being disabled for its proper operation.
But I don't see any reason to change it.


Thanks,
Roland

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

end of thread, other threads:[~2005-03-20  7:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-19  4:45 [PATCH] Remove spurious BUG from posix-cpu-timers Matthew Wilcox
2005-03-19  4:53 ` Andrew Morton
2005-03-19  4:59   ` Matthew Wilcox
2005-03-20  7:38     ` Roland McGrath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox