Re: [question] why does rtc_read() use spin_lock_irq()?

From: Tigran Aivazian (tigran@veritas.com)
Date: Mon Jun 26 2000 - 10:51:26 EST


On Mon, 26 Jun 2000, Jeff Garzik wrote:

> Tigran Aivazian wrote:
> >
> > Hi guys,
> >
> > It would appear that fop->read() methods assume that interrupts are always
> > enabled on the current cpu. For example, drivers/char/rtc:rtc_read() uses
> > spin_lock_irq(&rtc_lock) while the interrupt handler uses the plain
> > spin_lock(&rtc_lock). It is clear why rtc_interrupt() use spin_lock() but
> > is not clear why rtc_read() uses spin_lock_irq() and not the generic
> > spin_lock_irqsave().
>
> rtc_read is never called w/ interrupts disabled, so you can use the
> cheaper version of the spinlock
>
> Jeff

Jeff, I understand very well that if I knew why what you say is true, it
would answer my question. The reason I asked the question is - how do you
know that interrupts are always enabled when rtc_read is called?

Or, more generally, can one say that interrupts are always enabled (on
this cpu) when we enter into arbitrary sys_call_table[] handler?

So, the question is more about traps.c+entry.S interaction rather than
about rtc_read :)

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jun 26 2000 - 21:00:09 EST