netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback
@ 2025-07-13 20:21 Markus Blöchl
  2025-07-14 11:02 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Markus Blöchl @ 2025-07-13 20:21 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Alexandre Torgue, Thomas Gleixner
  Cc: Lakshmi Sowjanya D, Richard Cochran, John Stultz, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, markus.bloechl,
	Markus Blöchl

get_time_fn() callback implementations are expected to fill out the
entire system_counterval_t struct as it may be initially uninitialized.

This broke with the removal of convert_art_to_tsc() helper functions
which left use_nsecs uninitialized.

Initially assign the entire struct with default values.

Fixes: f5e1d0db3f02 ("stmmac: intel: Remove convert_art_to_tsc()")
Cc: stable@vger.kernel.org
Signed-off-by: Markus Blöchl <markus@blochl.de>
---
Notes:
    Related-To: <https://lore.kernel.org/lkml/txyrr26hxe3xpq3ebqb5ewkgvhvp7xalotaouwludjtjifnah2@7tmgczln4aoo/>
    Related-To: <https://lore.kernel.org/lkml/20250709-e1000e_crossts-v2-1-2aae94384c59@blochl.de/>
    Only compile tested
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
index 9a47015254bbe60b806b00b80dbd5b1d8f78a7c6..ea33ae39be6bbca5dc32c73e6d02e86a9d8d6e62 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
@@ -433,6 +433,12 @@ static int intel_crosststamp(ktime_t *device,
 		return -ETIMEDOUT;
 	}
 
+	*system = (struct system_counterval_t) {
+		.cycles = 0,
+		.cs_id = CSID_X86_ART,
+		.use_nsecs = false,
+	};
+
 	num_snapshot = (readl(ioaddr + GMAC_TIMESTAMP_STATUS) &
 			GMAC_TIMESTAMP_ATSNS_MASK) >>
 			GMAC_TIMESTAMP_ATSNS_SHIFT;
@@ -448,7 +454,7 @@ static int intel_crosststamp(ktime_t *device,
 	}
 
 	system->cycles *= intel_priv->crossts_adj;
-	system->cs_id = CSID_X86_ART;
+
 	priv->plat->flags &= ~STMMAC_FLAG_INT_SNAPSHOT_EN;
 
 	return 0;

---
base-commit: 3cd752194e2ec2573d0e740f4a1edbfcc28257f5
change-id: 20250713-stmmac_crossts-34d8ab89901a

Best regards,
-- 
Markus Blöchl <markus@blochl.de>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback
  2025-07-13 20:21 [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback Markus Blöchl
@ 2025-07-14 11:02 ` Simon Horman
  2025-07-15 23:40 ` patchwork-bot+netdevbpf
  2025-07-19 20:00 ` Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-07-14 11:02 UTC (permalink / raw)
  To: Markus Blöchl
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Maxime Coquelin, Alexandre Torgue, Thomas Gleixner,
	Lakshmi Sowjanya D, Richard Cochran, John Stultz, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, markus.bloechl

On Sun, Jul 13, 2025 at 10:21:41PM +0200, Markus Blöchl wrote:
> get_time_fn() callback implementations are expected to fill out the
> entire system_counterval_t struct as it may be initially uninitialized.
> 
> This broke with the removal of convert_art_to_tsc() helper functions
> which left use_nsecs uninitialized.
> 
> Initially assign the entire struct with default values.
> 
> Fixes: f5e1d0db3f02 ("stmmac: intel: Remove convert_art_to_tsc()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Blöchl <markus@blochl.de>

Reviewed-by: Simon Horman <horms@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback
  2025-07-13 20:21 [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback Markus Blöchl
  2025-07-14 11:02 ` Simon Horman
@ 2025-07-15 23:40 ` patchwork-bot+netdevbpf
  2025-07-19 20:00 ` Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-15 23:40 UTC (permalink / raw)
  To: =?utf-8?b?TWFya3VzIEJsw7ZjaGwgPG1hcmt1c0BibG9jaGwuZGU+?=
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
	alexandre.torgue, tglx, lakshmi.sowjanya.d, richardcochran,
	jstultz, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
	markus.bloechl

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Sun, 13 Jul 2025 22:21:41 +0200 you wrote:
> get_time_fn() callback implementations are expected to fill out the
> entire system_counterval_t struct as it may be initially uninitialized.
> 
> This broke with the removal of convert_art_to_tsc() helper functions
> which left use_nsecs uninitialized.
> 
> Initially assign the entire struct with default values.
> 
> [...]

Here is the summary with links:
  - [net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback
    https://git.kernel.org/netdev/net/c/e6176ab107ec

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback
  2025-07-13 20:21 [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback Markus Blöchl
  2025-07-14 11:02 ` Simon Horman
  2025-07-15 23:40 ` patchwork-bot+netdevbpf
@ 2025-07-19 20:00 ` Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2025-07-19 20:00 UTC (permalink / raw)
  To: Markus Blöchl, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue
  Cc: Lakshmi Sowjanya D, Richard Cochran, John Stultz, netdev,
	linux-stm32, linux-arm-kernel, linux-kernel, markus.bloechl,
	Markus Blöchl

On Sun, Jul 13 2025 at 22:21, Markus Blöchl wrote:
> get_time_fn() callback implementations are expected to fill out the
> entire system_counterval_t struct as it may be initially uninitialized.
>
> This broke with the removal of convert_art_to_tsc() helper functions
> which left use_nsecs uninitialized.

Sigh. As I explained in the other thread, the proper fix is to
zero initialize the data structure at the call site and fix this whole
class of issues in one go.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-19 20:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-13 20:21 [PATCH net] net: stmmac: intel: populate entire system_counterval_t in get_time_fn() callback Markus Blöchl
2025-07-14 11:02 ` Simon Horman
2025-07-15 23:40 ` patchwork-bot+netdevbpf
2025-07-19 20:00 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).