[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20140514.003755.1614849153032517878.davem@davemloft.net>
Date: Wed, 14 May 2014 00:37:55 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: hannes@...essinduktion.org
Cc: netdev@...r.kernel.org, torvalds@...ux-foundation.org
Subject: Re: [PATCH net] net: avoid dependency of net_get_random_once on
nop patching
From: Hannes Frederic Sowa <hannes@...essinduktion.org>
Date: Sun, 11 May 2014 22:59:30 +0200
> net_get_random_once depends on the static keys infrastructure to patch up
> the branch to the slow path during boot. This was realized by abusing the
> static keys api and defining a new initializer to not enable the call
> site while still indicating that the branch point should get patched
> up. This was needed to have the fast path considered likely by gcc.
>
> The static key initialization during boot up normally walks through all
> the registered keys and either patches in ideal nops or enables the jump
> site but omitted that step on x86 if ideal nops where already placed at
> static_key branch points. Thus net_get_random_once branches not always
> became active.
>
> This patch switches net_get_random_once to the ordinary static_key
> api and thus places the kernel fast path in the - by gcc considered -
> unlikely path. Microbenchmarks on Intel and AMD x86-64 showed that
> the unlikely path actually beats the likely path in terms of cycle cost
> and that different nop patterns did not make much difference, thus this
> switch should not be noticeable.
>
> Fixes: a48e42920ff38b ("net: introduce new macro net_get_random_once")
> Reported-by: Tuomas Räsänen <tuomasjjrasanen@...r.fi>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@...essinduktion.org>
Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists