Linus Torvalds <email@example.com> wrote:
> Richard B. Johnson <firstname.lastname@example.org> wrote:
> > ticks = 1 * HZ; /* For 1 second */
> > while((ticks = interruptible_sleep_on_timeout(&wqhead, ticks)) > 0)
> > ;
> Don't do this.
> Imagine what happens if a signal comes in and wakes you up? The signal
> will continue to be pending, which will make your "sleep loop" be a busy
> loop as you can never go to sleep interruptibly with a pending signal.
Well, the problem was quite different compare to what I thought.
Our hardware requires that once you start talking to firmware you cannot let
anybody to interrupt you.
Thus, I lazily put in all "magic" handlers (read, write, ioctl):
... do entry stuff
_fw_spinlock // = spin_lock_irqsave(...);
.. do my stuff (nobody could interrupt me)
_fw_spinunlock // = spin_lock_irqrestore(...);
Everything worked fine under 2.2.x (I knew that this was a shortcut!!!)
In 2.4.x I could not call wake_up_interruptible() while in spinlock
(and it's clearly understandable).
Now it seems that I have to grab and release spinlock each time I talk to the board,
exactly as I did in NT:
if (KeSynchronizeExecution(Adapter->InterruptObject, PdAdapterEnableInterrupt, &Context));
What d'u think?
-- Regards, Alex
-- Alex Ivchenko, Ph.D. United Electronic Industries, Inc. "The High-Performance Alternative (tm)"-- 10 Dexter Avenue Watertown, Massachusetts 02472 Tel: (617) 924-1155 x 222 Fax: (617) 924-1441 http://www.ueidaq.com - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/