* Patch "ip_tunnel: disable preemption when updating per-cpu tstats" has been added to the 3.14-stable tree
@ 2015-12-11 16:48 gregkh
2015-12-15 20:03 ` Jiri Slaby
0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2015-12-11 16:48 UTC (permalink / raw)
To: Jason, davem, gregkh, hannes; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
ip_tunnel: disable preemption when updating per-cpu tstats
to the 3.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
ip_tunnel-disable-preemption-when-updating-per-cpu-tstats.patch
and it can be found in the queue-3.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From foo@baz Fri Dec 11 11:39:46 EST 2015
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
Date: Thu, 12 Nov 2015 17:35:58 +0100
Subject: ip_tunnel: disable preemption when updating per-cpu tstats
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
[ Upstream commit b4fe85f9c9146f60457e9512fb6055e69e6a7a65 ]
Drivers like vxlan use the recently introduced
udp_tunnel_xmit_skb/udp_tunnel6_xmit_skb APIs. udp_tunnel6_xmit_skb
makes use of ip6tunnel_xmit, and ip6tunnel_xmit, after sending the
packet, updates the struct stats using the usual
u64_stats_update_begin/end calls on this_cpu_ptr(dev->tstats).
udp_tunnel_xmit_skb makes use of iptunnel_xmit, which doesn't touch
tstats, so drivers like vxlan, immediately after, call
iptunnel_xmit_stats, which does the same thing - calls
u64_stats_update_begin/end on this_cpu_ptr(dev->tstats).
While vxlan is probably fine (I don't know?), calling a similar function
from, say, an unbound workqueue, on a fully preemptable kernel causes
real issues:
[ 188.434537] BUG: using smp_processor_id() in preemptible [00000000] code: kworker/u8:0/6
[ 188.435579] caller is debug_smp_processor_id+0x17/0x20
[ 188.435583] CPU: 0 PID: 6 Comm: kworker/u8:0 Not tainted 4.2.6 #2
[ 188.435607] Call Trace:
[ 188.435611] [<ffffffff8234e936>] dump_stack+0x4f/0x7b
[ 188.435615] [<ffffffff81915f3d>] check_preemption_disabled+0x19d/0x1c0
[ 188.435619] [<ffffffff81915f77>] debug_smp_processor_id+0x17/0x20
The solution would be to protect the whole
this_cpu_ptr(dev->tstats)/u64_stats_update_begin/end blocks with
disabling preemption and then reenabling it.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/net/ip6_tunnel.h | 3 ++-
include/net/ip_tunnels.h | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -79,11 +79,12 @@ static inline void ip6tunnel_xmit(struct
err = ip6_local_out(skb);
if (net_xmit_eval(err) == 0) {
- struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+ struct pcpu_sw_netstats *tstats = get_cpu_ptr(dev->tstats);
u64_stats_update_begin(&tstats->syncp);
tstats->tx_bytes += pkt_len;
tstats->tx_packets++;
u64_stats_update_end(&tstats->syncp);
+ put_cpu_ptr(tstats);
} else {
stats->tx_errors++;
stats->tx_aborted_errors++;
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -166,12 +166,13 @@ static inline void iptunnel_xmit_stats(i
struct pcpu_sw_netstats __percpu *stats)
{
if (err > 0) {
- struct pcpu_sw_netstats *tstats = this_cpu_ptr(stats);
+ struct pcpu_sw_netstats *tstats = get_cpu_ptr(stats);
u64_stats_update_begin(&tstats->syncp);
tstats->tx_bytes += err;
tstats->tx_packets++;
u64_stats_update_end(&tstats->syncp);
+ put_cpu_ptr(tstats);
} else if (err < 0) {
err_stats->tx_errors++;
err_stats->tx_aborted_errors++;
Patches currently in stable-queue which might be from Jason@zx2c4.com are
queue-3.14/ip_tunnel-disable-preemption-when-updating-per-cpu-tstats.patch
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Patch "ip_tunnel: disable preemption when updating per-cpu tstats" has been added to the 3.14-stable tree
2015-12-11 16:48 Patch "ip_tunnel: disable preemption when updating per-cpu tstats" has been added to the 3.14-stable tree gregkh
@ 2015-12-15 20:03 ` Jiri Slaby
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2015-12-15 20:03 UTC (permalink / raw)
To: gregkh, Jason, davem, hannes; +Cc: stable, stable-commits
On 12/11/2015, 05:48 PM, gregkh@linuxfoundation.org wrote:
>
> This is a note to let you know that I've just added the patch titled
>
> ip_tunnel: disable preemption when updating per-cpu tstats
...
> From: "Jason A. Donenfeld" <Jason@zx2c4.com>
> Date: Thu, 12 Nov 2015 17:35:58 +0100
> Subject: ip_tunnel: disable preemption when updating per-cpu tstats
>
> From: "Jason A. Donenfeld" <Jason@zx2c4.com>
>
> [ Upstream commit b4fe85f9c9146f60457e9512fb6055e69e6a7a65 ]
>
> Drivers like vxlan use the recently introduced
> udp_tunnel_xmit_skb/udp_tunnel6_xmit_skb APIs.
According to this, the patch does not seem to be applicable to pre-3.18.
But should neither hurt, I think?
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-12-15 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-11 16:48 Patch "ip_tunnel: disable preemption when updating per-cpu tstats" has been added to the 3.14-stable tree gregkh
2015-12-15 20:03 ` Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).