Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5993493ybc; Wed, 27 Nov 2019 13:04:21 -0800 (PST) X-Google-Smtp-Source: APXvYqwj99EKGFDDg7yeiiT+zH6AtIyZNdnmoPRZM8G5OhzIFMZ5Y+EzBhdQBq3Zx9Oo/8ffhlVc X-Received: by 2002:aa7:cd87:: with SMTP id x7mr34604276edv.153.1574888661510; Wed, 27 Nov 2019 13:04:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888661; cv=none; d=google.com; s=arc-20160816; b=A8Lo1QLNrNiUV/1MJkEAuaP+mDGT3IJNUprmFPIMcNJZ2xmeFX0uBI629aaPa8YMI+ WIOHuzMIqL8IQHSHLmFT6II7Rak3H/I5nh6MMEsjiINDdQZjGQvBII5L4SesjRIlgPOy mrnX07kTn34SlGrMtg29rZuTHgVdRKLkJYy1Vl/Xc97cmUzikoR+rgusZ/8M8t+STmpP 8SM0KpfPkiygVH1WS92ybZax7yX6KIqpnc6zu4Djs/iSFhdyrWL3vSaPPJwHlmG9UW2N z/sMrR2oHMKPnZGv01yVnLr5aQC6et6i0dxjO7+dWmucEE0Io0IOXAD0tiujRG/CP4zx XNlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yg4pylDm90oFh4Da4XJLbWM4t4CE/Zf5lVQp8gliXiQ=; b=JRJx874E4yqr2/f1naXdug693QB7NdQ/0rcypcNO84uodVzcH23caDhpxbSNBtvrZ/ VwRARAaAGO97B0Nw/3WnNRb06WJ9o1ooUBBFSQQa0bhpA5EaatkcaPmgGWZasspfBZ7R 1Z6EAuTHSX1pMaaCKsVEx8+94c7M/LMA23iRr2l7SQVQ3HDCVmF3Yet6CTTcwyqpx5Vx COCuoLlXJI/pzJAA9hx9tejcO3Lr24zE3QLyHmRf3bJ2S97pUa+10whJ1weKMFm15SC8 HJgJDD1zW8hINXeaUzIGvHcbLBfHWu/cVJDvXtswohZixuo3skxHZJcaJUAWlQT4evsT NYIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TWl7F2/j"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z4si10440810eju.105.2019.11.27.13.03.55; Wed, 27 Nov 2019 13:04:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TWl7F2/j"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731600AbfK0VCw (ORCPT + 99 others); Wed, 27 Nov 2019 16:02:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:55786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731950AbfK0VCt (ORCPT ); Wed, 27 Nov 2019 16:02:49 -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 CEDFD217AB; Wed, 27 Nov 2019 21:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888569; bh=IX6ejNhOzqzCr1fBgCEaKvxLcJCK6m+OsCxX9zF9tQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWl7F2/jaqf5xW4CVKLZWI/HosMDp6RS0joOuf3oAYxH8BrBA5LaYvfxAJ9qw35sP +xwfhwUJcTXPT5MJ18JgJgFcqOMpHhYx/kpr902kcYZ8eLqEOb+b4gdOKYNPfKfhii 0in6+3lOr/yGC6+B0eHCPxjK3B99abUP3uoBTZeA= 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.19 183/306] igb: shorten maximum PHC timecounter update interval Date: Wed, 27 Nov 2019 21:30:33 +0100 Message-Id: <20191127203128.670305382@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 9f4d700e09df3..29ced6b74d364 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -51,9 +51,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 BIT(E1000_TIMINCA_16NS_SHIFT) #define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0) -- 2.20.1