lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87y25kwe2h.fsf@kurt>
Date:   Fri, 19 Nov 2021 13:00:06 +0100
From:   Kurt Kanzenbach <kurt@...utronix.de>
To:     Thomas Gleixner <tglx@...utronix.de>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>
Cc:     Giuseppe Cavallaro <peppe.cavallaro@...com>,
        Alexandre Torgue <alexandre.torgue@...s.st.com>,
        Jose Abreu <joabreu@...opsys.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Voon Weifeng <weifeng.voon@...el.com>,
        Ong Boon Leong <boon.leong.ong@...el.com>,
        Wong Vee Khee <vee.khee.wong@...ux.intel.com>,
        Tan Tee Min <tee.min.tan@...el.com>,
        "Wong, Vee Khee" <vee.khee.wong@...el.com>,
        Xiaoliang Yang <xiaoliang.yang_1@....com>,
        netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org,
        Benedikt Spranger <b.spranger@...utronix.de>
Subject: Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain
 crossing error only once

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

Download attachment "signature.asc" of type "application/pgp-signature" (862 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ