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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Apr 2023 15:35:49 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
        pabeni@...hat.com, alexander.duyck@...il.com, hkallweit1@...il.com,
        andrew@...n.ch, willemb@...gle.com, michael.chan@...adcom.com,
        jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com
Subject: Re: [PATCH net-next v3 7/7] net: piggy back on the memory barrier in
 bql when waking queues

On Wed, Apr 05, 2023 at 03:31:34PM -0700, Jakub Kicinski wrote:
>					\
> @@ -82,10 +82,26 @@
>  		_res;							\
>  	})								\
>  
> +/* Variant of netdev_tx_completed_queue() which guarantees smp_mb() if
> + * @bytes != 0, regardless of kernel config.
> + */
> +static inline void
> +netdev_txq_completed_mb(struct netdev_queue *dev_queue,
> +			unsigned int pkts, unsigned int bytes)
> +{
> +#ifdef CONFIG_BQL
> +	netdev_tx_completed_queue(dev_queue, pkts, bytes);
> +#else
> +	if (bytes)
> +		smp_mb();
> +#endif
> +}

Minor nit, I would write this as

	if (IS_ENABLED(CONFIG_BQL))
		netdev_tx_completed_queue(dev_queue, pkts, bytes);
	else if (bytes)
		smp_mb();

Actually, why is this checking bytes while the caller is checking
pkts? Do we need to check them at all? If pkts/bytes is commonly
non-zero, then we should just do a barrier unconditionally and make
the uncommon path pay the penalty.

Thanks,
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ