linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Richard Cochran <richardcochran@gmail.com>,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org, linux-api@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>, Christoph Lameter <cl@linux.com>,
	David Miller <davem@davemloft.net>,
	Krzysztof Halasa <khc@pm.waw.pl>,
	Peter Zijlstra <peterz@infradead.org>,
	Rodolfo Giometti <giometti@linux.it>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v6 0/8] ptp: IEEE 1588 hardware clock support
Date: Thu, 23 Sep 2010 15:03:40 -0700	[thread overview]
Message-ID: <1285279420.2587.175.camel@localhost.localdomain> (raw)
In-Reply-To: <20100923223025.2877cce2@lxorguk.ukuu.org.uk>

On Thu, 2010-09-23 at 22:30 +0100, Alan Cox wrote:
> O> I don't see how this is a problem, as it exposes the multiple hardware
> > clocks via different posix clock ids. So in the boundary clock case, you
> > can configure which side is the client and which side is the master in a
> > config file and the PTPd will appropriately steer them individually.
> 
> They may all be slaves - that means you can't treat them as part of
> system time.

Sure, and that's something one would configure. So I'm not sure I see
how exposing the different hardware bits via a clock_id is problematic.
They're just clocks that are being exposed. The steering of system time
to PTP or PTP to system time  (or just PTP to other PTP clocks).


> > on module unload, but I don't think we need a use-count to prevent the
> > module from being unloaded.
> > 
> > My question would be: How do we handle a USB network device ($14.99 now
> > with PTP!) being unplugged? We can't say "Sorry! That's in use!". So we
> > note the hardware is gone, and return the proper error code.
> > 
> > Or am I missing something else?
> 
> Open list
> Oh number 31 appears to be the device I want
> Close list
> 
> 	USB unplugged
> 	Random other device plugged
> 
> clock_op(31, ....)
> 
> Oh bugger I've just reprogrammed the wrong time source.

Ok. So its just the issue of clock_id reuse. I was confusing it with
some sort of module use counting issue.  And yea, I can see how it might
be  easier to re-use the file descriptor then re-implementing the reuse
logic in the posix-clock registration.


> We don't have stop the device being removed, instead of a disaster you get
> 
> 	clock_op(fd, blah)
> 	-ENODEV
> 
> which btw is how just about everything else USB works when you pull the
> hardware.

Right, which was what I was thinking as well, but assuming we didn't
re-use clockids quickly.
 
> > So, I don't really see how that's so different from what is being
> > proposed. The clock_id is dynamically assigned per registered clock, and
> > exposed via the sysfs interface from ptp hardware entry.
> > 
> > The only difference is the open/close reference counting, which I don't
> > think is necessary here (since we can't always keep the hardware from
> > going away).
> 
> It is absolutely neccessary in order that you can be sure that two calls
> actually relate to the *same* device. It's as fundamental as the
> difference betweeh chmod and fchmod although with the added ugliness of
> some random numeric identifier stuck in the middle.
> 
> It also btw makes it much easier to fix up the existing random collection
> of /dev/rtc devices - because you can open them and issue fclock_adjtime
> if we are careful how we do it and it makes sense.

Wait, you're suggesting we add new fclock_* calls that duplicate the
posix interface? That doesn't sound great to me.

What did you think of Kyle Moffett's suggestion of utilizing the fd to
map to the clock_id which could then be used by the posix clocks
interface?

Although I'm still not sure if it wouldn't be so hard to just simply
increment the id on each registration and index to a clock through a
reasonably small hash table. I suspect that would solve the
enumeration/reuse issue without much trouble (but again, I'm open to
being corrected if I'm missing something larger).

But yes, in summary, this is an issue to be addressed one way or
another.

thanks
-john

  reply	other threads:[~2010-09-23 22:03 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 17:30 [PATCH v6 0/8] ptp: IEEE 1588 hardware clock support Richard Cochran
2010-09-23 17:31 ` [PATCH 1/8] posix clocks: introduce a syscall for clock tuning Richard Cochran
     [not found]   ` <b94ef1cd9c04ef3ad5964408bd0af7251add78de.1285261534.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-23 19:48     ` john stultz
     [not found]       ` <1285271331.2587.56.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-24  7:29         ` Richard Cochran
     [not found]           ` <20100924072946.GA5043-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-24 17:55             ` john stultz
2010-09-23 22:03     ` Benjamin Herrenschmidt
2010-09-23 22:12       ` Thomas Gleixner
     [not found]         ` <alpine.LFD.2.00.1009240008390.2416-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-24  1:20           ` Benjamin Herrenschmidt
2010-09-24  7:55       ` Richard Cochran
     [not found]         ` <20100924075534.GB5043-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-24 22:12           ` Benjamin Herrenschmidt
2010-09-23 17:31 ` [PATCH 2/8] posix clocks: dynamic clock ids Richard Cochran
2010-09-23 17:31 ` [PATCH 3/8] posix clocks: introduce a sysfs presence Richard Cochran
     [not found] ` <cover.1285261533.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-23 17:32   ` [PATCH 4/8] ptp: Added a brand new class driver for ptp clocks Richard Cochran
2010-09-23 17:32 ` [PATCH 5/8] ptp: Added a simulated PTP hardware clock Richard Cochran
2010-09-23 17:33 ` [PATCH 6/8] ptp: Added a clock that uses the eTSEC found on the MPC85xx Richard Cochran
     [not found]   ` <57b64051c816dc9cb856bbb9f38fc901c9d3d651.1285261535.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-23 19:17     ` Christoph Lameter
     [not found]       ` <alpine.DEB.2.00.1009231348150.2962-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-23 20:43         ` Alan Cox
     [not found]           ` <20100923214359.3f287b11-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-09-23 20:32             ` Christoph Lameter
2010-09-23 21:26           ` Christian Riesch
2010-09-24 11:52             ` Alan Cox
2010-09-24  8:49         ` Richard Cochran
2010-09-23 17:33 ` [PATCH 7/8] ptp: Added a clock driver for the IXP46x Richard Cochran
2010-09-23 17:34 ` [PATCH 8/8] ptp: Added a clock driver for the National Semiconductor PHYTER Richard Cochran
2010-09-23 17:53 ` [PATCH v6 0/8] ptp: IEEE 1588 hardware clock support Christoph Lameter
2010-09-23 18:21   ` Jacob Keller
2010-09-23 18:36     ` Christoph Lameter
     [not found]   ` <alpine.DEB.2.00.1009231238170.2962-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-23 18:59     ` john stultz
     [not found]       ` <1285268380.2587.11.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-23 19:15         ` Christoph Lameter
2010-09-23 20:28           ` john stultz
2010-09-23 20:49             ` Christoph Lameter
     [not found]               ` <alpine.DEB.2.00.1009231533040.7522-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-23 21:34                 ` Alan Cox
2010-09-23 21:34                   ` Christian Riesch
     [not found]                     ` <4C9BC7CE.8020400-U4+xqT1Vg0VeoWH0uzbU5w@public.gmane.org>
2010-09-27 15:37                       ` Christoph Lameter
2010-09-30  3:50                         ` Christian Riesch
2010-10-02  1:44                         ` M. Warner Losh
2010-09-23 21:42                 ` john stultz
     [not found]                   ` <1285278136.2587.154.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-27 15:52                     ` Christoph Lameter
2010-09-27 16:14                       ` M. Warner Losh
     [not found]                         ` <20100927.101423.702773873740300798.imp-uzTCJ5RojNnQT0dZR+AlfA@public.gmane.org>
2010-09-28  6:34                           ` Richard Cochran
2010-09-24  8:33     ` Richard Cochran
2010-09-23 19:38 ` john stultz
     [not found]   ` <1285270733.2587.46.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-24 13:50     ` Richard Cochran
     [not found]       ` <20100924135001.GB3113-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-24 14:57         ` Alan Cox
2010-09-23 20:36 ` Alan Cox
2010-09-23 20:49   ` john stultz
     [not found]     ` <1285274952.2587.113.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-23 21:30       ` Alan Cox
2010-09-23 22:03         ` john stultz [this message]
     [not found]   ` <20100923213654.0c64b047-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-09-24 13:14     ` Richard Cochran
     [not found]       ` <20100924131407.GA3113-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-24 14:02         ` Alan Cox
2010-09-24 14:07           ` Alan Cox
2010-09-27 15:56           ` Christoph Lameter
2010-09-27 17:05             ` Alan Cox
2010-09-28  6:47               ` 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=1285279420.2587.175.camel@localhost.localdomain \
    --to=johnstul@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=cl@linux.com \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=giometti@linux.it \
    --cc=khc@pm.waw.pl \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /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).