From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820Ab0IXIdj (ORCPT ); Fri, 24 Sep 2010 04:33:39 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:54764 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835Ab0IXIdh (ORCPT ); Fri, 24 Sep 2010 04:33:37 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=SrRJXcIQfoHQAd0yFKzIxPe6dnLPLeePzQiGldGtj2QS3V2lZ9CFdBcIKDKcrO9MKs iUMbV7e6tj7B2X/fQrzZSveZUQAgvRami62sLMRRZ0O3HydTKOWu0Aa4IC9CrPTGXr17 2yZd/TLAUadP+edByNWnabtI4fAIEMwHigjyo= Date: Fri, 24 Sep 2010 10:33:35 +0200 From: Richard Cochran To: Christoph Lameter Cc: 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 , David Miller , John Stultz , Krzysztof Halasa , Peter Zijlstra , Rodolfo Giometti , Thomas Gleixner Subject: Re: [PATCH v6 0/8] ptp: IEEE 1588 hardware clock support Message-ID: <20100924083335.GA13272@riccoc20.at.omicron.at> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 23, 2010 at 12:53:20PM -0500, Christoph Lameter wrote: > On Thu, 23 Sep 2010, Richard Cochran wrote: > > 3.3 Synchronizing the Linux System Time > > ======================================== > > > > One could offer a PHC as a combined clock source and clock event > > device. The advantage of this approach would be that it obviates > > the need for synchronization when the PHC is selected as the system > > timer. However, some PHCs, namely the PHY based clocks, cannot be > > used in this way. > > Why not? Do PHY based clock not at least provide a counter that increments > in synchronized intervals throughout the network? The counter in the PHY is accessed via the MDIO bus. One 16 bit read takes anywhere from 25 to 40 microseconds. Reading the 64 bit time value requires four reads, so we're talking about 100 to 160 microseconds, just for a single time reading. In addition to that, reading MDIO bus can sleep. So, we can't (in general) to offer PHCs as clock sources. > > Instead, the patch set provides a way to offer a Pulse Per Second > > (PPS) event from the PHC to the Linux PPS subsystem. A user space > > application can read the PPS events and tune the system clock, just > > like when using other external time sources like radio clocks or > > GPS. > > User space is subject to various latencies created by the OS etc. I would > that in order to have fine grained (read microsecond) accurary we would > have to run the portions that are relevant to obtaining the desired > accuracy in the kernel. The time-critical operations are all performed in hardware (packet timestamp), or in kernel space (input PPS timestamp). User space only runs the servo (using hardware or kernel timestamps as input) and performs the clock correction. With a sample rate of 1 PPS, the small user space induced delay (a few dozen microseconds) between sample time and clock correction is not an issue. Thanks, Richard