netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: richardcochran@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 4/4] phylib: Allow reading and writing a mii bus from atomic context.
Date: Mon, 05 Jul 2010 19:05:47 -0700 (PDT)	[thread overview]
Message-ID: <20100705.190547.28805625.davem@davemloft.net> (raw)
In-Reply-To: <a06cf09ed5096bf8f9434d90828adfa70586e936.1278307573.git.richard.cochran@omicron.at>

From: Richard Cochran <richardcochran@gmail.com>
Date: Mon, 5 Jul 2010 07:33:14 +0200

> 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.
> 
> Signed-off-by: Richard Cochran <richard.cochran@omicron.at>

Ok, I'm not to happy about this one, to be honest.

Conditional locking is always a problem waiting to happen.

Question: What context can you call mdiobus_lock() in?

Answer: You absolutely cannot know.

Therefore every piece of code, except those with special knowledge
of what kind of device is behind the mdiobus object, have to assume
the worst which is that the interface can only be called in sleepable
contexts.

We need to find another way to accomodate this, I really don't want to
see this kind of situation where the locking facility type is
conditional upon the device sitting behind the interface.

  reply	other threads:[~2010-07-06  2:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  5:30 [PATCH v2 0/4] Extend Time Stamping Richard Cochran
2010-07-05  5:31 ` [PATCH 1/4] net: add driver hooks for time stamping Richard Cochran
2010-07-06  2:03   ` David Miller
2010-07-06  2:39     ` David Miller
2010-07-05  5:32 ` [PATCH 2/4] phylib: add a way to make PHY time stamps possible Richard Cochran
2010-07-06  2:03   ` David Miller
2010-07-05  5:33 ` [PATCH 3/4] phylib: preserve ifreq parameter when calling generic phy_mii_ioctl() Richard Cochran
2010-07-06  2:03   ` David Miller
2010-07-05  5:33 ` [PATCH 4/4] phylib: Allow reading and writing a mii bus from atomic context Richard Cochran
2010-07-06  2:05   ` David Miller [this message]
2010-07-06 17:09   ` Andy Fleming
2010-07-07  7:18     ` Richard Cochran
2010-07-16 11:25       ` Richard Cochran
2010-07-16 11:49         ` Richard Cochran
  -- strict thread matches above, loose matches on Subject: below --
2010-06-28 15:33 [PATCH 0/4] Extend Time Stamping Richard Cochran
2010-06-28 15:35 ` [PATCH 4/4] phylib: Allow reading and writing a mii bus from atomic context Richard Cochran

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=20100705.190547.28805625.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.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).