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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57AC2C433F5 for ; Fri, 19 Nov 2021 12:01:49 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 21B1A615A4 for ; Fri, 19 Nov 2021 12:01:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 21B1A615A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CfoKbvoELzficF9bXhV4eAAZSAaU97aOJr/e/caFx3Q=; b=2ikBHAL4Bz5uvtX1lLxUB4yD/c eXvJz1dZxwG4LstAQCaoPCFzazvKnhs+p8W9MUwjVudnlc/Qu3NiIS8MJhZtNZm+4tGGWmB6tTQHy KuI8Xbs9tX48x30dytAyzlJeK4bbSvjPmbgK86iYzHQcUl483Ds0TMOeRlRdAw9/dS3a9IM4gBIu9 JHw3f2q/U2Ijnb7KgyMFHw8g8Fyid9Vzp6msTvkLy7PeIjC1H/D9CMAOaSgEzJoc1be35GXok0eaY gceByQPIbISa7NHPw5iKmIFIZIpGbsPJaYz0UpA5EB/y6eAFh+TYNppbYzecL5WcaknQkWfs2j7+M Bz+ol+RQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mo2Yx-00AKSt-9h; Fri, 19 Nov 2021 12:00:15 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mo2Ys-00AKS9-Qu for linux-arm-kernel@lists.infradead.org; Fri, 19 Nov 2021 12:00:12 +0000 From: Kurt Kanzenbach DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637323208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sdbaeAzAumO+KcyRL4vQdqQsFXeSKwO+n/U/wDXKb68=; b=fC/WjJk50ipTbXMKrxg28jn/7Zt7B2/a6wn5/g6Xc4HVYOZT1/TvyDtB3epocjikMpidIz A06SQ9WG3eo430UpRP7aVXx7bSohKRE918LHhnDNQP/nhPIFOihzpwoz8I5VH1p3T5EH3r pieERrVt1lEuHlKmfuL6RX7f4yYFfkEPN7Fy6Kty7aWTpDQCwmoSGMB+9Y1jnn+myMBZvz bHXlQkLE3FGa/6GieOw8XHkbq0F0O1KxabpPnbhAwf2c8fkm0xK5GWmzn1Lzk/VbMCbLcQ 7yPPr7zO5iT4Hu9P83lkaQkYCkj6tKEwiUO0IsZFMNN9/G4m7UaBmKrAmUs/RA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637323208; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sdbaeAzAumO+KcyRL4vQdqQsFXeSKwO+n/U/wDXKb68=; b=3MqHbQayFJ0Q/h6Al/wXRWYw0YlHYqmV3mGGiqb8RqOlN/re8Hlcg7bLrRWrLIP1C8ZAXf OvUVUDEWY4eu2iCA== To: Thomas Gleixner , "David S. Miller" , Jakub Kicinski Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Voon Weifeng , Ong Boon Leong , Wong Vee Khee , Tan Tee Min , "Wong, Vee Khee" , Xiaoliang Yang , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Benedikt Spranger Subject: Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once In-Reply-To: <87mtm0l5z6.ffs@tglx> References: <20211119081010.27084-1-kurt@linutronix.de> <87mtm0l5z6.ffs@tglx> Date: Fri, 19 Nov 2021 13:00:06 +0100 Message-ID: <87y25kwe2h.fsf@kurt> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211119_040011_043401_63A9C627 X-CRM114-Status: GOOD ( 17.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============9118622791453928541==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============9118622791453928541== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain On Fri Nov 19 2021, Thomas Gleixner wrote: > Kurt, > > On Fri, Nov 19 2021 at 09:10, Kurt Kanzenbach wrote: > >> The clock domain crossing error (CDC) is calculated at every fetch of Tx or Rx >> timestamps. It includes a division. Especially on arm32 based systems it is >> expensive. It also saves the two conditionals. > > This does not make sense. What you want to say here is: > > It also requires two conditionals in the hotpath. Yeah, I realized after sending that the last sentence is bogus. > >> Therefore, move the calculation to the PTP initialization code and just use the >> cached value in the timestamp retrieval functions. > > Maybe: > > Add a compensation value cache to struct plat_stmmacenet_data and > subtract it unconditionally in the RX/TX functions which spares the > conditionals. > > The value is initialized to 0 and if supported calculated in the PTP > initialization code. Sounds better, thanks. > > or something to that effect. > >> + /* Calculate the clock domain crossing (CDC) error if necessary */ >> + priv->plat->cdc_error_adj = 0; >> + if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate) >> + priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) / >> + priv->plat->clk_ptp_rate; > > Nit. Just let stick it out. We lifted the 80 char limitation some time ago. Good to know. Will do. I'll wait for further comments or test results and will resend next week. Thanks, Kurt --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJHBAEBCgAxFiEEooWgvezyxHPhdEojeSpbgcuY8KYFAmGXkcYTHGt1cnRAbGlu dXRyb25peC5kZQAKCRB5KluBy5jwpsDQEACEkuky635/SgrRDmmS0IUGEQsftOuX eRwpnkjAJrezKqQt0xAac7tK+GOi+q4zmg2fKO6Ml+Em/Ni4WnYlMpkVds9fusub uChqtQUCLlTjtEutCEz5L0ptlcig69ssdvfFB8hP3s+Ac6JuZ1bj4hDk65jG9KjT SxR1lXylSXfp6exFHC87bBiTuiZXbh/vQFd+/AEBqNOT/oCdqpojuMPh4gWCG5R/ PkwNA3UY00Jb95H6cCR9Mcrze7ZvI8KVdCF/daCOSMW7G3zarT14iRerZ3me0oJe 5HjJ6WJGTee+kC+O5Y6wQ4mHRxCinHP6Fr+3J7MBrdcCRXlBRaGF3/OTtP+AwNAm BA2cOHUZIjmTbDSXG9ny0I7MzWbJRFFMOXL5cpt14Z2OYyNYVJHiywbnsEqOmzjY 5gBUZDbRkPe7hznje7my1xg7QOtvg1D+I5eHgk3IU6GmRMfEJZlufv03CN+Tzz0q +RhOvY0sNXBuP5EMcLPkk+SgwEC7jwk4L4NZ01NpJyfgcH+jT05lOUN9nB0qTStx aZ43LKxosCDDczdgaKX/nJUJkreLnuSgCmEFF4oepCAz3pbwXflV06AKYlNproMP RqmQlZj7UaSLJh25OkKYygDa/XkmIUIs87nT+Zn8MJfhveJErge3cWMJhYCHN9Ab bgp2AAMgBbLVgg== =jKFZ -----END PGP SIGNATURE----- --=-=-=-- --===============9118622791453928541== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============9118622791453928541==--