From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 298ABC433F5 for ; Thu, 3 Feb 2022 16:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352392AbiBCQok (ORCPT ); Thu, 3 Feb 2022 11:44:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352386AbiBCQoh (ORCPT ); Thu, 3 Feb 2022 11:44:37 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2FDEC061714; Thu, 3 Feb 2022 08:44:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jThIhFNBrb3xj2YQLkczkGqkTy9wIvQP7gVhgnzkrew=; b=zGqOR7+LqSrG510WGhf1Ch1m+Q zInXDUP+4zUsUrFPitgFSW+BwbHex8XmIlJT7thj0wp4BGrUyfHA+/mkPSu8CAYR2a8B7LsJpIVbA N5gpuO+O7H3tPq8CUi8kGBhgqdRTkcgxmXICWE+dL+up2T1R+KeuuXYuzT7Gp4Cuf1mw3+s6E46yj lg6bKHZlj4VFjSRnTYgs2sGXT/CoQbquXe3QK9Wwygp0lxg2M8kzhI/PcsZALiYg8Eqq511/Xxd+m yInasAcEDOvhjUF3etd1bOFnYK37Zl3SlsnaKMYrH5FZyOWqqY69AUQdLoYSsrGcGv+5TW1HIoyo+ JgXhnVbQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:57016) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nFfDf-0002s5-AV; Thu, 03 Feb 2022 16:44:27 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1nFfDc-00049q-6H; Thu, 03 Feb 2022 16:44:24 +0000 Date: Thu, 3 Feb 2022 16:44:24 +0000 From: "Russell King (Oracle)" To: Yannick Vignon Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin , Rayagond Kokatanur , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sebastien.laveze@oss.nxp.com, Vladimir Oltean , Xiaoliang Yang , mingkai.hu@nxp.com, Joakim Zhang , Yannick Vignon Subject: Re: [PATCH net] net: stmmac: ensure PTP time register reads are consistent Message-ID: References: <20220203160025.750632-1-yannick.vignon@oss.nxp.com> <13dc6f72-8ef4-6990-1c67-2b92c6894e87@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13dc6f72-8ef4-6990-1c67-2b92c6894e87@oss.nxp.com> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Feb 03, 2022 at 05:38:10PM +0100, Yannick Vignon wrote: > On 2/3/2022 5:28 PM, Russell King (Oracle) wrote: > > On Thu, Feb 03, 2022 at 05:00:25PM +0100, Yannick Vignon wrote: > > > From: Yannick Vignon > > > > > > Even if protected from preemption and interrupts, a small time window > > > remains when the 2 register reads could return inconsistent values, > > > each time the "seconds" register changes. This could lead to an about > > > 1-second error in the reported time. > > > > Have you checked whether the hardware protects against this (i.o.w. the > > hardware latches the PTP_STSR value when PTP_STNSR is read, or vice > > versa? Several PTP devices I've looked at do this to allow consistent > > reading. > > > > It doesn't. I was able to observe inconsistent values doing reads in either > order, and we had already observed the issue with that same IP on another > device (Cortex-M based, not running Linux). It's not easy to reproduce, the > time window is small, but it's there. Okay, thanks. Reviewed-by: Russell King (Oracle) -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!