Thread (5 messages) flat view 5 messages, 3 authors, 2013-10-25

Re: [PATCH net-next 2/2] net: initialize hashrnd in flow_dissector with net_get_random_once

From: Hannes Frederic Sowa <hidden>
Date: 2013-10-23 14:13:10

On Wed, Oct 23, 2013 at 06:58:34AM -0700, Eric Dumazet wrote:
On Wed, 2013-10-23 at 13:12 +0200, Hannes Frederic Sowa wrote:
quoted
We also can defer the initialization of hashrnd in flow_dissector
to its first use. Since net_get_random_once is irqsave now we don't
have to audit the call paths if one of this functions get called by an
interrupt handler.

Cc: David S. Miller <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: Hannes Frederic Sowa <redacted>
---
This really works well if CONFIG_JUMP_LABEL=y

I am afraid some arches do not really have this.
This is the problem with all users of net_get_random_once.

If an architecture does not have JUMP_LABEL or gcc does not provide
CC_HAVE_ASM_GOTO we have an unlikely branch in the code path and branch
to the epilogue of the function to generate the hash for the first
time. After that it's "just" a likely atomic boolean test.

I guess it is not that important to have a good secret hash key here as
this is solely used to dispatch the packets to cpus and does not store
anything in tables.

Greetings,

  Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help