[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTikEF3B-0JGvqosY5jMaChbpYctOmKW1jJKOWsQE@mail.gmail.com>
Date: Tue, 6 Jul 2010 12:09:10 -0500
From: Andy Fleming <afleming@...il.com>
To: Richard Cochran <richardcochran@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH 4/4] phylib: Allow reading and writing a mii bus from
atomic context.
On Mon, Jul 5, 2010 at 12:33 AM, Richard Cochran
<richardcochran@...il.com> wrote:
> In order to support hardware time stamping from a PHY, it is necessary to
> read from the PHY while running in_interrupt(). This patch allows a mii
> bus to operate in an atomic context. An mii_bus driver may declare itself
> capable for this mode. Drivers which do not do this will remain with the
> default that bus operations may sleep.
>
> Before commit 35b5f6b1a82b5c586e0b24c711dc6ba944e88ef1 mii bus
> operations were protected with spin locks. That commit replaced the
> locks with mutexs in order to accommodate i2c buses that need to
> sleep. Thus, this patch restores the original behavior as a run time
> option.
The reason we moved to mutexes was because we didn't want PHY
operations to be done in interrupt context. They are too slow. Also,
some MII busses will trigger an interrupt when the operation is done,
which means their driver has the option of sleeping. As such, it was
an original principle of the PHY lib that MII transactions were not
allowed in interrupt context. *Certainly*, once you *do* allow MII
transactions in interrupt context, you *cannot* use spin_lock(). You
at least have to use spin_lock_irq[save].
Also, I agree with David's comments, and Grant's. There's got to be
another way to do this.
Andy
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists