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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2E19C432C3 for ; Wed, 27 Nov 2019 21:43:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7999520869 for ; Wed, 27 Nov 2019 21:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574891025; bh=U/6tRCUAgN7vLtq1CMV91hKOfrocRssLaPKmD5mtqa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=k5c5zTR9yKrYqR7TJ12DGbWDW2D7Dg0A9NEjTCjP1kVAWwSNCSiGlFxI8t7s+6Cgy 0+xbk5R0UiPVrEE1Oo1Xuwz0JRpXxftwxgIpF8dib0TQeu7gPi0YWtiDC20GG5bude wkFNyx6jCNPS2ewoV12BdrfhAg7WkWFJvdVcU3UY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727897AbfK0Uia (ORCPT ); Wed, 27 Nov 2019 15:38:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:42120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfK0Ui2 (ORCPT ); Wed, 27 Nov 2019 15:38:28 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D0241215A5; Wed, 27 Nov 2019 20:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887108; bh=U/6tRCUAgN7vLtq1CMV91hKOfrocRssLaPKmD5mtqa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7XLWrcwbiLnCNYzq4Sw8RtNsriDXh9oyTh8QGk3ki0VCKtYxN2LixR6tJtEjvV9k 6pmEmoe6ymfZA6XI6Ddpqyr9FWS2NCzmvarsNaR+ajK+0798UK6NES5DztkO8SM4AC cJX3qccXN7YtKG062jnxFee9CvKRBI4PRLUeLQfw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacob Keller , Richard Cochran , Thomas Gleixner , Miroslav Lichvar , Aaron Brown , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.4 073/132] igb: shorten maximum PHC timecounter update interval Date: Wed, 27 Nov 2019 21:31:04 +0100 Message-Id: <20191127203007.942579295@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127202857.270233486@linuxfoundation.org> References: <20191127202857.270233486@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miroslav Lichvar [ Upstream commit 094bf4d0e9657f6ea1ee3d7e07ce3970796949ce ] The timecounter needs to be updated at least once per ~550 seconds in order to avoid a 40-bit SYSTIM timestamp to be misinterpreted as an old timestamp. Since commit 500462a9d ("timers: Switch to a non-cascading wheel"), scheduling of delayed work seems to be less accurate and a requested delay of 540 seconds may actually be longer than 550 seconds. Shorten the delay to 480 seconds to be sure the timecounter is updated in time. This fixes an issue with HW timestamps on 82580/I350/I354 being off by ~1100 seconds for few seconds every ~9 minutes. Cc: Jacob Keller Cc: Richard Cochran Cc: Thomas Gleixner Signed-off-by: Miroslav Lichvar Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_ptp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index c44df87c38de2..5e65d8a78c3ed 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -65,9 +65,15 @@ * * The 40 bit 82580 SYSTIM overflows every * 2^40 * 10^-9 / 60 = 18.3 minutes. + * + * SYSTIM is converted to real time using a timecounter. As + * timecounter_cyc2time() allows old timestamps, the timecounter + * needs to be updated at least once per half of the SYSTIM interval. + * Scheduling of delayed work is not very accurate, so we aim for 8 + * minutes to be sure the actual interval is shorter than 9.16 minutes. */ -#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 9) +#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8) #define IGB_PTP_TX_TIMEOUT (HZ * 15) #define INCPERIOD_82576 (1 << E1000_TIMINCA_16NS_SHIFT) #define INCVALUE_82576_MASK ((1 << E1000_TIMINCA_16NS_SHIFT) - 1) -- 2.20.1