From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Luis Claudio R. Goncalves" Subject: ebt_do_table calls smp_processor_id() in preemptible Date: Sat, 27 Nov 2010 13:04:05 -0200 Message-ID: <20101127150404.GA20613@uudg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE To: linux-rt-users@vger.kernel.org Return-path: Received: from mail-yw0-f46.google.com ([209.85.213.46]:44469 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541Ab0K0PEK (ORCPT ); Sat, 27 Nov 2010 10:04:10 -0500 Received: by ywl5 with SMTP id 5so1344217ywl.19 for ; Sat, 27 Nov 2010 07:04:10 -0800 (PST) Content-Disposition: inline Sender: linux-rt-users-owner@vger.kernel.org List-ID: Thomas, I added a patch by the end of this email with one possible way to fix t= he issue. Not througly thought but it is surviving for more than 4h now. ebt_do_table: fix smp_processor_id() usage I have been seeing several variations of this BUG message: BUG: using smp_processor_id() in preemptible [00000000] code: ... caller is ebt_do_table+0x94/0x60c [ebtables] Backtrace: BUG: using smp_processor_id() in preemptible [00000000] code: cupsd/135= 3 caller is ebt_do_table+0x94/0x60c [ebtables] Pid: 1353, comm: cupsd Not tainted 2.6.33.7-rt29 #51 Call Trace: [] debug_smp_processor_id+0xd7/0xf0 [] ? ebt_do_table+0x6f/0x60c [ebtables] [] ebt_do_table+0x94/0x60c [ebtables] [] ? ebt_do_table+0x5e5/0x60c [ebtables] [] ? rcu_read_lock+0x0/0x3a [] ebt_nat_out+0x1c/0x20 [ebtable_nat] [] nf_iterate+0x46/0x89 [] ? br_dev_queue_push_xmit+0x0/0x88 [bridge] [] nf_hook_slow+0x78/0xe0 [] ? br_dev_queue_push_xmit+0x0/0x88 [bridge] [] ? genl_register_mc_group+0x175/0x1c6 [] ? br_forward_finish+0x0/0x58 [bridge] [] ? __br_deliver+0x0/0x5b [bridge] [] br_forward_finish+0x44/0x58 [bridge] [] __br_deliver+0x54/0x5b [bridge] [] br_flood+0xb0/0xc9 [bridge] [] br_flood_deliver+0x15/0x17 [bridge] [] br_dev_xmit+0x81/0x8e [bridge] [] dev_hard_start_xmit+0x246/0x305 [] dev_queue_xmit+0x399/0x495 [] ? dev_queue_xmit+0x175/0x495 [] ip_finish_output2+0x26a/0x2b3 [] ip_finish_output+0x6d/0x6f [] ip_mc_output+0x1ee/0x1fd [] ip_local_out+0x25/0x29 [] ip_push_pending_frames+0x2e3/0x345 [] udp_push_pending_frames+0x2de/0x362 [] udp_sendmsg+0x565/0x680 [] ? rt_spin_lock_slowlock+0x38/0x272 [] inet_sendmsg+0x57/0x60 [] __sock_sendmsg+0x61/0x6c [] ? rt_spin_lock_slowlock+0x38/0x272 [] sock_sendmsg+0xa8/0xc1 [] ? debug_rt_mutex_free_waiter+0x18/0xca [] ? rt_spin_lock_slowlock+0x248/0x272 [] ? rt_spin_lock_slowunlock+0x23/0x7e [] ? might_fault+0x1c/0x1e [] ? move_addr_to_kernel+0x49/0x4e [] sys_sendto+0x116/0x15b [] ? rt_spin_unlock+0x4d/0x51 [] ? lockdep_sys_exit_thunk+0x35/0x67 [] ? audit_syscall_entry+0x11e/0x14a [] system_call_fastpath+0x16/0x1b Signed-off-by: Luis Claudio R. Gon=E7alves diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebt= ables.c index 0b7f262..2ffdd86 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -153,7 +153,7 @@ unsigned int ebt_do_table (unsigned int hook, struc= t sk_buff *skb, const struct net_device *in, const struct net_device *out, struct ebt_table *table) { - int i, nentries; + int i, nentries, cpu; struct ebt_entry *point; struct ebt_counter *counter_base, *cb_base; struct ebt_entry_target *t; @@ -174,12 +174,14 @@ unsigned int ebt_do_table (unsigned int hook, str= uct sk_buff *skb, =20 read_lock_bh(&table->lock); private =3D table->private; - cb_base =3D COUNTER_BASE(private->counters, private->nentries, - smp_processor_id()); + preempt_disable_rt(); + cpu =3D smp_processor_id(); + cb_base =3D COUNTER_BASE(private->counters, private->nentries, cpu); if (private->chainstack) - cs =3D private->chainstack[smp_processor_id()]; + cs =3D private->chainstack[cpu]; else cs =3D NULL; + preempt_enable_rt(); chaininfo =3D private->hook_entry[hook]; nentries =3D private->hook_entry[hook]->nentries; point =3D (struct ebt_entry *)(private->hook_entry[hook]->data); --=20 [ Luis Claudio R. Goncalves Bass - Gospel - RT ] [ Fingerprint: 4FDD B8C4 3C59 34BD 8BE9 2696 7203 D980 A448 C8F8 ] -- To unsubscribe from this list: send the line "unsubscribe linux-rt-user= s" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html