Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752219AbbKPKEZ (ORCPT ); Mon, 16 Nov 2015 05:04:25 -0500 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:41390 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752050AbbKPKEV (ORCPT ); Mon, 16 Nov 2015 05:04:21 -0500 Message-Id: <1447668260.141421.440863153.156433F8@webmail.messagingengine.com> X-Sasl-Enc: 6ytdvxJ3snfLuhu1L291ShM8DGTCgyd2TUiJhe8EvEhB 1447668260 From: Hannes Frederic Sowa To: "Jason A. Donenfeld" , Netdev , LKML , David Miller , tgraf@suug.ch, Tom Herbert , Jiri Benc , Alexey Kuznetsov MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-37ba1837 Subject: Re: [PATCH v2] ip_tunnel: disable preemption when updating per-cpu tstats Date: Mon, 16 Nov 2015 11:04:20 +0100 In-Reply-To: <1447346158-19257-1-git-send-email-Jason@zx2c4.com> References: <1447342212-5543-1-git-send-email-Jason@zx2c4.com> <1447346158-19257-1-git-send-email-Jason@zx2c4.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 39 On Thu, Nov 12, 2015, at 17:35, Jason A. Donenfeld wrote: > 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] [] dump_stack+0x4f/0x7b > [ 188.435615] [] > check_preemption_disabled+0x19d/0x1c0 > [ 188.435619] [] 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 Acked-by: Hannes Frederic Sowa Thanks! -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/