From: Richard Cochran <richardcochran-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Krzysztof Halasa <khc-9GfyWEdoJtJmR6Xm/wNWPw@public.gmane.org>
Subject: Re: [PATCH 05/12] phylib: Allow reading and writing a mii bus from atomic context.
Date: Wed, 16 Jun 2010 08:20:19 +0200 [thread overview]
Message-ID: <20100616062019.GB2887@riccoc20.at.omicron.at> (raw)
In-Reply-To: <AANLkTin8RI4UKzA58k_qER_urdwnD037u5GZrVQS8IoS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
> That's right, and I fully agree with that change. To me, going back
> to allowing spin locks is a regression because it adds a new source of
> scheduling latency.
I think that the change was not about reducing scheduling
latency. Rather, the idea was simply to allow mdio bus drivers that
sleep. Here is the change log message:
commit 35b5f6b1a82b5c586e0b24c711dc6ba944e88ef1
PHYLIB: Locking fixes for PHY I/O potentially sleeping
PHY read/write functions can potentially sleep (e.g., a PHY accessed
via I2C). The following changes were made to account for this:
* Change spin locks to mutex locks
* Add a BUG_ON() to phy_read() phy_write() to warn against
calling them from an interrupt context.
* Use work queue for PHY state machine handling since
it can potentially sleep
* Change phydev lock from spinlock to mutex
The fundamental issue is this: Fro the SO_TIMESTAMPING API, receive
timestamps must appear in a control message along with the packet
data. Only the MAC driver (or the PHY driver) knows how to get the
timestamp. The stack calls the MAC driver via its napi poll
function. During the call, the driver must provide the skb with Rx
timestamp.
The only reasonable way to do this is to have the driver fetch the
timestamp durng the napi poll function. For MAC drivers with fast
register access, the performance penalty is small. For PHY drivers
with must go via the MDIO bus, the performance penalty is obviously
larger, and the user must be willing to live with it.
You might suggest the alternate that the driver would defer the
netif_receive_skb() callback until a work queue completes, providing
the Rx timestamp. The driver would then call netif_receive_skb() at
some later time.
However, there are a number of problems with this idea:
1. It is really icky for the drivers to be creating new skb queues for
this purpose. MAC drivers would have to maintain such queues on
behalf of the PHY drivers, but only when the PHYs support
timestamping. Yuck.
2. There is a (soft) real time constraint on the delivery of the PTP
packets to the user space application. Basicly, delays and jitter
in the time to receive the packet negatively affect the clock servo
loop.
3. It cannot work for many kinds of PTP timestamping hardware. Some of
hardware only timestamps PTP packets. That means that not every
received packet will have a timestamp. Such hardware provides some
key data from the packet (like PTP UUID and sequence number) with
the timestamp. Software must match this information to a particular
packet. In order to defer a skb, the driver must first obtain the
timestamp information. This is a catch-22.
Having said all that, I am still open to suggestions...
Richard
next prev parent reply other threads:[~2010-06-16 6:20 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 16:06 [PATCH v4 00/12] ptp: IEEE 1588 clock support Richard Cochran
2010-06-15 16:07 ` [PATCH 01/12] phylib: preserve ifreq parameter when calling generic phy_mii_ioctl() Richard Cochran
2010-06-15 16:07 ` [PATCH 02/12] phylib: do not filter phy_mii_ioctl() Richard Cochran
2010-06-15 16:26 ` Grant Likely
2010-06-15 16:08 ` [PATCH 03/12] phylib: add a driver method for the SIOCSHWTSTAMP ioctl Richard Cochran
2010-06-15 16:27 ` Grant Likely
2010-06-15 16:34 ` Richard Cochran
2010-06-15 16:49 ` Grant Likely
2010-06-15 16:53 ` Grant Likely
2010-06-15 16:08 ` [PATCH 04/12] phylib: add a way to make PHY time stamps possible Richard Cochran
[not found] ` <27c0ad283f025c2bb71e7ceb71be07f969939429.1276615626.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-06-15 16:33 ` Grant Likely
2010-06-16 5:40 ` Richard Cochran
2010-06-16 6:29 ` Richard Cochran
2010-06-17 1:03 ` David Miller
2010-06-15 16:08 ` [PATCH 05/12] phylib: Allow reading and writing a mii bus from atomic context Richard Cochran
2010-06-15 16:43 ` Grant Likely
2010-06-15 17:08 ` Richard Cochran
2010-06-15 18:29 ` Grant Likely
[not found] ` <AANLkTin8RI4UKzA58k_qER_urdwnD037u5GZrVQS8IoS-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-16 6:20 ` Richard Cochran [this message]
2010-06-15 16:09 ` [PATCH 06/12] ptp: add a BPF to help drivers detect PTP packets Richard Cochran
2010-06-15 16:09 ` [PATCH 07/12] phylib: support the National Semiconductor DP83640 PHY Richard Cochran
2010-06-15 16:09 ` [PATCH 08/12] ptp: Added a brand new class driver for ptp clocks Richard Cochran
2010-06-15 17:00 ` Grant Likely
2010-06-16 14:22 ` Richard Cochran
2010-06-15 19:11 ` Grant Likely
2010-08-13 9:34 ` Richard Cochran
2010-08-13 23:54 ` Grant Likely
2010-06-15 16:09 ` [PATCH 09/12] ptp: Added a clock that uses the Linux system time Richard Cochran
2010-06-15 16:10 ` [PATCH 10/12] ptp: Added a clock that uses the eTSEC found on the MPC85xx Richard Cochran
2010-06-15 17:20 ` Grant Likely
[not found] ` <AANLkTikFc15j-Qhw9M2CnKLKq58Wi1xD7E2dtVNsVgeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-16 6:45 ` Richard Cochran
2010-06-15 16:10 ` [PATCH 11/12] ptp: Added a clock driver for the IXP46x Richard Cochran
[not found] ` <0c03ef3e283c6b3ef58feaf1f77ccb0fd605010b.1276615626.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-06-15 18:41 ` Grant Likely
2010-06-16 6:54 ` Richard Cochran
2010-06-15 16:10 ` [PATCH 12/12] ptp: Added a clock driver for the National Semiconductor PHYTER Richard Cochran
2010-06-15 18:49 ` Grant Likely
2010-06-16 10:05 ` Richard Cochran
[not found] ` <20100616100539.GA3569-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-06-16 15:10 ` Grant Likely
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=20100616062019.GB2887@riccoc20.at.omicron.at \
--to=richardcochran-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=khc-9GfyWEdoJtJmR6Xm/wNWPw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
/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