Subject: Re: [PATCH net v3] net: lwtunnel: disable BHs when required

From: Simon Horman <[email-masked]>
Date: Mon, 21 Apr 2025 14:44:43 +0100

On Wed, Apr 16, 2025 at 06:07:16PM +0200, Justin Iurman wrote:
> v3:
> - removed unrelated code cleanups
> v2:
> - https://lore.kernel.org/netdev/[email-masked]/
> v1:
> - https://lore.kernel.org/netdev/[email-masked]/

Hi Justin,

There is probably no need to resend because of this,
but the changelog above belongs below the scissors ("---")
which will preserve it in mailing list archives and so on,
while excluding it from git history.

> 
> In lwtunnel_{output|xmit}(), dev_xmit_recursion() may be called in
> preemptible scope for PREEMPT kernels. This patch disables BHs before
> calling dev_xmit_recursion(). BHs are re-enabled only at the end, since
> we must ensure the same CPU is used for both dev_xmit_recursion_inc()
> and dev_xmit_recursion_dec() (and any other recursion levels in some
> cases) in order to maintain valid per-cpu counters.
> 
> Reported-by: Alexei Starovoitov <[email-masked]>
> Closes: https://lore.kernel.org/netdev/CAADnVQJFWn3dBFJtY+ci6oN1pDFL=[email-masked]/
> Reported-by: Eduard Zingerman <[email-masked]>
> Closes: https://lore.kernel.org/netdev/[email-masked]/
> Fixes: 986ffb3a57c5 ("net: lwtunnel: fix recursion loops")
> Signed-off-by: Justin Iurman <[email-masked]>

I agree that this patch is in keeping with the solution discussed
at the links above.

Reviewed-by: Simon Horman <[email-masked]>