[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1285785794.2813.292.camel@edumazet-laptop>
Date: Wed, 29 Sep 2010 20:43:14 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Jesse Gross <jesse@...ira.com>
Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next-2.6] ip_gre: lockless xmit
Le mercredi 29 septembre 2010 à 10:33 -0700, Jesse Gross a écrit :
> The tx lock has another use here: to break local loops. With this
> change, a misconfigured tunnel can bring down the machine with a stack
> overflow. There are clearly other ways to fix this that don't require
> a lock that restricts parallelism, such as a loop counter, but that's
> the way it is now.
Thats a very good point !
We could use a loop counter in the skb, but this use a bit of ram,
or percpu counters in tunnel drivers, to avoid a given level of
recursion.
/* this should be shared by all tunnels */
DEFINE_PER_CPU(tunnel_xmit_count);
tunnel_xmit()
{
if (__this_cpu_read(tunnel_xmit_count) >= LIMIT)
goto tx_error;
__this_cpu_inc(tunnel_xmit_count);
....
__IPTUNNEL_XMIT(tstats, &dev->stats);
__this_cpu_dec(tunnel_xmit_count),
return NETDEV_TX_OK;
}
--
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