netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: f.fainelli@gmail.com
Cc: vivien.didelot@savoirfairelinux.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@savoirfairelinux.com
Subject: Re: [PATCH] net: mdio-gpio: support access that may sleep
Date: Fri, 24 Apr 2015 12:25:14 -0400 (EDT)	[thread overview]
Message-ID: <20150424.122514.1993790707568222542.davem@davemloft.net> (raw)
In-Reply-To: <553A6D2B.20901@gmail.com>

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 24 Apr 2015 09:19:55 -0700

> On 24/04/15 09:01, David Miller wrote:
>> From: Florian Fainelli <f.fainelli@gmail.com>
>> Date: Fri, 24 Apr 2015 08:56:34 -0700
>> 
>>> On 24/04/15 08:04, David Miller wrote:
>>>> From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>>>> Date: Wed, 22 Apr 2015 13:06:54 -0400
>>>>
>>>>> Some systems using mdio-gpio may use gpio on message based busses, which
>>>>> require sleeping (e.g. gpio from an I2C I/O expander).
>>>>>
>>>>> Since this driver does not use IRQ handler, it is safe to use the
>>>>> _cansleep suffixed gpio accessors.
>>>>>
>>>>> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
>>>>
>>>> Since this is down underneath the layer of an MII bus, you cannot
>>>> universally say that these routines are always called in a sleepable
>>>> context.
>>>>
>>>> The PHY layer, and the driver itself above that, might call these
>>>> routines from timers, interruptes etc.
>>>
>>> The PHY library calls these routines from its state machine workqueue
>>> for that reason, or from process context (when invoked via ethtool
>>> ioctl). The only special case is phy_mac_interrupt() which is callable
>>> from interrupt context, but schedules the state machine workqueue anyway
>>> to circumvent the "in-interrupt" context.
>>>
>>> If we were not doing that, there would be a number of things broken, for
>>> instance the per-MDIO bus mutex would not protect us from anything.
>> 
>> Does the link state polling timer use a workqueue in this manner as
>> well?
> 
> Yes, the state machine re-schedules its own delayed workqueue at the end
> of its state processing, no timer/hrtimer is used.

Ok, thanks for explaining.

I'm apply this patch, therefore, thanks.

  reply	other threads:[~2015-04-24 16:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-22 17:06 [PATCH] net: mdio-gpio: support access that may sleep Vivien Didelot
2015-04-24 15:04 ` David Miller
2015-04-24 15:56   ` Florian Fainelli
2015-04-24 16:01     ` David Miller
2015-04-24 16:19       ` Florian Fainelli
2015-04-24 16:25         ` David Miller [this message]
2015-04-24 17:25     ` Sergei Shtylyov
2015-04-24 17:36       ` Florian Fainelli
2015-04-24 17:42         ` Sergei Shtylyov

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=20150424.122514.1993790707568222542.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@savoirfairelinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.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;
as well as URLs for NNTP newsgroup(s).