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]
Message-ID: <e78256f2-9ad6-49e1-9cd5-02a28c92d2fc@lunn.ch>
Date: Mon, 12 Aug 2024 22:22:20 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Sean Anderson <sean.anderson@...ux.dev>
Cc: Radhey Shyam Pandey <radhey.shyam.pandey@....com>,
	netdev@...r.kernel.org, Simon Horman <horms@...nel.org>,
	Jakub Kicinski <kuba@...nel.org>,
	Russell King <linux@...linux.org.uk>,
	"David S . Miller" <davem@...emloft.net>,
	linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	Paolo Abeni <pabeni@...hat.com>,
	Michal Simek <michal.simek@....com>,
	Eric Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 2/2] net: xilinx: axienet: Add statistics
 support

>  static int __axienet_device_reset(struct axienet_local *lp)
>  {
>  	u32 value;
>  	int ret;
>  
> +	/* Save statistics counters in case they will be reset */
> +	guard(mutex)(&lp->stats_lock);
> +	if (lp->features & XAE_FEATURE_STATS)
> +		axienet_stats_update(lp, true);

My understanding of guard() is that the mutex is held until the
function completes. That is much longer than you need. A
scoped_guard() would be better here, and it makes it clear when the
mutex will be released.

> +
>  	/* Reset Axi DMA. This would reset Axi Ethernet core as well. The reset
>  	 * process of Axi DMA takes a while to complete as all pending
>  	 * commands/transfers will be flushed or completed during this
> @@ -551,6 +595,23 @@ static int __axienet_device_reset(struct axienet_local *lp)
>  		return ret;
>  	}
>  
> +	/* Update statistics counters with new values */
> +	if (lp->features & XAE_FEATURE_STATS) {
> +		enum temac_stat stat;
> +
> +		write_seqcount_begin(&lp->hw_stats_seqcount);
> +		lp->reset_in_progress = false;
> +		for (stat = 0; stat < STAT_COUNT; stat++) {
> +			u32 counter =
> +				axienet_ior(lp, XAE_STATS_OFFSET + stat * 8);
> +
> +			lp->hw_stat_base[stat] +=
> +				lp->hw_last_counter[stat] - counter;
> +			lp->hw_last_counter[stat] = counter;
> +		}
> +		write_seqcount_end(&lp->hw_stats_seqcount);
> +	}
> +
>  	return 0;
>  }
>  

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ