netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PING^2] [PATCH] srandom32 fixes for networking
@ 2008-04-01 11:34 Andi Kleen
  2008-04-02  7:18 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2008-04-01 11:34 UTC (permalink / raw)
  To: davem; +Cc: netdev


Still missing from net-2.6.26

http://marc.info/?l=linux-netdev&m=120519912215170&w=2

Please add or justify rejection.

Thanks,
-Andi


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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-01 11:34 [PING^2] [PATCH] srandom32 fixes for networking Andi Kleen
@ 2008-04-02  7:18 ` David Miller
  2008-04-02  7:50   ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2008-04-02  7:18 UTC (permalink / raw)
  To: andi; +Cc: netdev

From: Andi Kleen <andi@firstfloor.org>
Date: Tue, 1 Apr 2008 13:34:08 +0200

> Still missing from net-2.6.26
> 
> http://marc.info/?l=linux-netdev&m=120519912215170&w=2
> 
> Please add or justify rejection.

Please fix this patch so that the arch/x86/mm/pageattr-test.c
build doesn't get broken by it.

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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-02  7:18 ` David Miller
@ 2008-04-02  7:50   ` Andi Kleen
  2008-04-02  8:03     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2008-04-02  7:50 UTC (permalink / raw)
  To: David Miller; +Cc: andi, netdev

On Wed, Apr 02, 2008 at 12:18:24AM -0700, David Miller wrote:
> From: Andi Kleen <andi@firstfloor.org>
> Date: Tue, 1 Apr 2008 13:34:08 +0200
> 
> > Still missing from net-2.6.26
> > 
> > http://marc.info/?l=linux-netdev&m=120519912215170&w=2
> > 
> > Please add or justify rejection.
> 
> Please fix this patch so that the arch/x86/mm/pageattr-test.c
> build doesn't get broken by it.

Can you send me your config please? I don't see any build problem
here with the patch on top of -rc7-git something on either i386 nor x86-64.

-Andi
> 

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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-02  7:50   ` Andi Kleen
@ 2008-04-02  8:03     ` David Miller
  2008-04-02  8:21       ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2008-04-02  8:03 UTC (permalink / raw)
  To: andi; +Cc: netdev

From: Andi Kleen <andi@firstfloor.org>
Date: Wed, 2 Apr 2008 09:50:11 +0200

> Can you send me your config please? I don't see any build problem
> here with the patch on top of -rc7-git something on either i386 nor x86-64.

I found it with "git grep srandom32", I guess I'm quite old school in
that I actually check the tree when interfaces are being changed.

Even if this code is not built into the tree somehow, knowingly
breaking code like this is not very nice.

It does seem to get built with CONFIG_CPA_DEBUG, which
is available from arch/x86/Kconfig.debug

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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-02  8:21       ` Andi Kleen
@ 2008-04-02  8:20         ` David Miller
  2008-04-02  9:44           ` Andi Kleen
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2008-04-02  8:20 UTC (permalink / raw)
  To: andi; +Cc: netdev

From: Andi Kleen <andi@firstfloor.org>
Date: Wed, 2 Apr 2008 10:21:03 +0200

> On Wed, Apr 02, 2008 at 01:03:24AM -0700, David Miller wrote:
> > From: Andi Kleen <andi@firstfloor.org>
> > Date: Wed, 2 Apr 2008 09:50:11 +0200
> > 
> > > Can you send me your config please? I don't see any build problem
> > > here with the patch on top of -rc7-git something on either i386 nor x86-64.
> > 
> > I found it with "git grep srandom32", I guess I'm quite old school in
> > that I actually check the tree when interfaces are being changed.
> 
> Ah I see the problem now.  The patch requires 
> 
> ftp://firstfloor.org/pub/ak/misc/patches/pageattr-own-random
> 
> applied first to remove this reference. Sorry should 
> have made that more clear.  The original post had both
> patches, but in the reposts the reference to the dependency
> got dropped somehow, sorry.

You have to decide how to submit this without introducing
the build failure then.

I would suggest getting your first change in, and when that
happens, resubmit this one.

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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-02  8:03     ` David Miller
@ 2008-04-02  8:21       ` Andi Kleen
  2008-04-02  8:20         ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Andi Kleen @ 2008-04-02  8:21 UTC (permalink / raw)
  To: David Miller; +Cc: andi, netdev

On Wed, Apr 02, 2008 at 01:03:24AM -0700, David Miller wrote:
> From: Andi Kleen <andi@firstfloor.org>
> Date: Wed, 2 Apr 2008 09:50:11 +0200
> 
> > Can you send me your config please? I don't see any build problem
> > here with the patch on top of -rc7-git something on either i386 nor x86-64.
> 
> I found it with "git grep srandom32", I guess I'm quite old school in
> that I actually check the tree when interfaces are being changed.

Ah I see the problem now.  The patch requires 

ftp://firstfloor.org/pub/ak/misc/patches/pageattr-own-random

applied first to remove this reference. Sorry should 
have made that more clear.  The original post had both
patches, but in the reposts the reference to the dependency
got dropped somehow, sorry.

-Andi

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

* Re: [PING^2] [PATCH] srandom32 fixes for networking
  2008-04-02  8:20         ` David Miller
@ 2008-04-02  9:44           ` Andi Kleen
  0 siblings, 0 replies; 7+ messages in thread
From: Andi Kleen @ 2008-04-02  9:44 UTC (permalink / raw)
  To: David Miller; +Cc: andi, netdev

> You have to decide how to submit this without introducing
> the build failure then.
> 
> I would suggest getting your first change in, and when that
> happens, resubmit this one.

I did a new version that just updates all CPUs without the rename,
so no dependency.

I will resubmit the rename later after the x86 maintainers
apply the patch to remove the call in pageattr-test.c (they unfortunately 
usually need at least three pings too..)

--- 
srandom32 fixes for networking v2

- Let it update the state of all CPUs. The network stack goes
into pains to feed the current IP addresses in, but it is not very
effective if that is only done for some random CPU instead of all.
So change it to feed bits into all CPUs.  I decided to do that lockless 
because well somewhat random results are ok.

v2: Dropped rename for now

Signed-off-by: Andi Kleen <ak@suse.de>
---
 include/linux/net.h    |    2 +-
 include/linux/random.h |    2 +-
 lib/random32.c         |   19 ++++++++++++-------
 3 files changed, 14 insertions(+), 9 deletions(-)

Index: linux/lib/random32.c
===================================================================
--- linux.orig/lib/random32.c
+++ linux/lib/random32.c
@@ -97,13 +97,18 @@ EXPORT_SYMBOL(random32);
  *	@seed: seed value
  *
  *	Add some additional seeding to the random32() pool.
- *	Note: this pool is per cpu so it only affects current CPU.
  */
 void srandom32(u32 entropy)
 {
-	struct rnd_state *state = &get_cpu_var(net_rand_state);
-	__set_random32(state, state->s1 ^ entropy);
-	put_cpu_var(state);
+	int i;
+	/*
+	 * No locking on the CPUs, but then somewhat random results are, well,
+	 * expected.
+	 */
+	for_each_possible_cpu (i) {
+		struct rnd_state *state = &per_cpu(net_rand_state, i);
+		__set_random32(state, state->s1 ^ entropy);
+	}
 }
 EXPORT_SYMBOL(srandom32);
 



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

end of thread, other threads:[~2008-04-02  9:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01 11:34 [PING^2] [PATCH] srandom32 fixes for networking Andi Kleen
2008-04-02  7:18 ` David Miller
2008-04-02  7:50   ` Andi Kleen
2008-04-02  8:03     ` David Miller
2008-04-02  8:21       ` Andi Kleen
2008-04-02  8:20         ` David Miller
2008-04-02  9:44           ` Andi Kleen

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).