Netdev List
 help / color / mirror / Atom feed
From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com
Subject: Re: [PATCH net-next 2/2] net: initialize hashrnd in flow_dissector with net_get_random_once
Date: Wed, 23 Oct 2013 16:13:09 +0200	[thread overview]
Message-ID: <20131023141309.GC26236@order.stressinduktion.org> (raw)
In-Reply-To: <1382536714.7572.18.camel@edumazet-glaptop.roam.corp.google.com>

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:
> > 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 <hannes@stressinduktion.org>
> > ---
> 
> 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

  reply	other threads:[~2013-10-23 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 11:12 [PATCH net-next 2/2] net: initialize hashrnd in flow_dissector with net_get_random_once Hannes Frederic Sowa
2013-10-23 13:58 ` Eric Dumazet
2013-10-23 14:13   ` Hannes Frederic Sowa [this message]
2013-10-23 18:06 ` [PATCH net-next v2 " Hannes Frederic Sowa
2013-10-25 23:04 ` [PATCH net-next " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131023141309.GC26236@order.stressinduktion.org \
    --to=hannes@stressinduktion.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox