mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clocksource: omit seeding of RNG in PBL
@ 2025-04-24  8:48 Ahmad Fatoum
  2025-04-25  5:39 ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2025-04-24  8:48 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

We do not maintain a PRNG in the PBL, so we should omit the call to
srand_xor in PBL, otherwise it expands to BUG() and breaks the newly
introduced PBL clocksource support.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/clock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/clock.c b/common/clock.c
index 517116e3b9a3..50941fb00822 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -228,7 +228,8 @@ int init_clock(struct clocksource *cs)
 	cs->cycle_last = cs->read() & cs->mask;
 	current_clock = cs;
 
-	srand_xor(cs->cycle_last);
+	if (IN_PROPER)
+		srand_xor(cs->cycle_last);
 
 	return 0;
 }
-- 
2.39.5




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

* Re: [PATCH] clocksource: omit seeding of RNG in PBL
  2025-04-24  8:48 [PATCH] clocksource: omit seeding of RNG in PBL Ahmad Fatoum
@ 2025-04-25  5:39 ` Sascha Hauer
  2025-04-29  9:53   ` Ahmad Fatoum
  0 siblings, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2025-04-25  5:39 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 24 Apr 2025 10:48:33 +0200, Ahmad Fatoum wrote:
> We do not maintain a PRNG in the PBL, so we should omit the call to
> srand_xor in PBL, otherwise it expands to BUG() and breaks the newly
> introduced PBL clocksource support.
> 
> 

Applied, thanks!

[1/1] clocksource: omit seeding of RNG in PBL
      https://git.pengutronix.de/cgit/barebox/commit/?id=a6e031cc425d (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

* Re: [PATCH] clocksource: omit seeding of RNG in PBL
  2025-04-25  5:39 ` Sascha Hauer
@ 2025-04-29  9:53   ` Ahmad Fatoum
  2025-04-29 15:03     ` Sascha Hauer
  0 siblings, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2025-04-29  9:53 UTC (permalink / raw)
  To: Sascha Hauer, barebox

Hello Sascha,

On 4/25/25 07:39, Sascha Hauer wrote:
> 
> On Thu, 24 Apr 2025 10:48:33 +0200, Ahmad Fatoum wrote:
>> We do not maintain a PRNG in the PBL, so we should omit the call to
>> srand_xor in PBL, otherwise it expands to BUG() and breaks the newly
>> introduced PBL clocksource support.
>>
>>
> 
> Applied, thanks!

While the patch is correct, I think it would be better to just drop the
BUG() in the header instead of littering IN_PROPER around.

If the patch isn't pushed yet, can you drop it?
I just sent out an alternative.

Thanks,
Ahmad

> 
> [1/1] clocksource: omit seeding of RNG in PBL
>       https://git.pengutronix.de/cgit/barebox/commit/?id=a6e031cc425d (link may not be stable)
> 
> Best regards,

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




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

* Re: [PATCH] clocksource: omit seeding of RNG in PBL
  2025-04-29  9:53   ` Ahmad Fatoum
@ 2025-04-29 15:03     ` Sascha Hauer
  0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-04-29 15:03 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Tue, Apr 29, 2025 at 11:53:07AM +0200, Ahmad Fatoum wrote:
> Hello Sascha,
> 
> On 4/25/25 07:39, Sascha Hauer wrote:
> > 
> > On Thu, 24 Apr 2025 10:48:33 +0200, Ahmad Fatoum wrote:
> >> We do not maintain a PRNG in the PBL, so we should omit the call to
> >> srand_xor in PBL, otherwise it expands to BUG() and breaks the newly
> >> introduced PBL clocksource support.
> >>
> >>
> > 
> > Applied, thanks!
> 
> While the patch is correct, I think it would be better to just drop the
> BUG() in the header instead of littering IN_PROPER around.
> 
> If the patch isn't pushed yet, can you drop it?
> I just sent out an alternative.

I dropped it.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2025-04-29 15:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-24  8:48 [PATCH] clocksource: omit seeding of RNG in PBL Ahmad Fatoum
2025-04-25  5:39 ` Sascha Hauer
2025-04-29  9:53   ` Ahmad Fatoum
2025-04-29 15:03     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox