From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: BUG: using smp_processor_id() in preemptible [00000000] code: avahi-daemon: caller is netif_rx Date: Thu, 15 Apr 2010 21:07:58 +0200 Message-ID: <1271358478.16881.2939.camel@edumazet-laptop> References: <1271100042.9831.20.camel@localhost> <1271101251.16881.135.camel@edumazet-laptop> <1271337401.16881.2563.camel@edumazet-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: netdev@vger.kernel.org, Tom Herbert To: Eric Paris , David Miller Return-path: Received: from mail-bw0-f225.google.com ([209.85.218.225]:42681 "EHLO mail-bw0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754982Ab0DOTII (ORCPT ); Thu, 15 Apr 2010 15:08:08 -0400 Received: by bwz25 with SMTP id 25so2032668bwz.28 for ; Thu, 15 Apr 2010 12:08:06 -0700 (PDT) In-Reply-To: <1271337401.16881.2563.camel@edumazet-laptop> Sender: netdev-owner@vger.kernel.org List-ID: Le jeudi 15 avril 2010 =C3=A0 15:16 +0200, Eric Dumazet a =C3=A9crit : > Le lundi 12 avril 2010 =C3=A0 21:40 +0200, Eric Dumazet a =C3=A9crit = : > > Good spot, RPS changed a bit netif_rx() requirements. > >=20 > > I would change ip_dev_loopback_xmit() to call netif_rx_ni() instead= =2E.. > >=20 > > David, Tom ? > >=20 > > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c > > index c65f18e..d1bcc9f 100644 > > --- a/net/ipv4/ip_output.c > > +++ b/net/ipv4/ip_output.c > > @@ -120,7 +120,7 @@ static int ip_dev_loopback_xmit(struct sk_buff = *newskb) > > newskb->pkt_type =3D PACKET_LOOPBACK; > > newskb->ip_summed =3D CHECKSUM_UNNECESSARY; > > WARN_ON(!skb_dst(newskb)); > > - netif_rx(newskb); > > + netif_rx_ni(newskb); > > return 0; > > } > > =20 >=20 > After some confusion, it seems this was the right fix after all :) >=20 > [PATCH] ip: Fix ip_dev_loopback_xmit() >=20 > Eric Paris got following trace with a linux-next kernel >=20 > [ 14.203970] BUG: using smp_processor_id() in preemptible [00000000= ] > code: avahi-daemon/2093 > [ 14.204025] caller is netif_rx+0xfa/0x110 > [ 14.204035] Call Trace: > [ 14.204064] [] debug_smp_processor_id+0x105/0x1= 10 > [ 14.204070] [] netif_rx+0xfa/0x110 > [ 14.204090] [] ip_dev_loopback_xmit+0x71/0xa0 > [ 14.204095] [] ip_mc_output+0x192/0x2c0 > [ 14.204099] [] ip_local_out+0x20/0x30 > [ 14.204105] [] ip_push_pending_frames+0x28d/0x3= d0 > [ 14.204119] [] udp_push_pending_frames+0x14c/0x= 400 > [ 14.204125] [] udp_sendmsg+0x39c/0x790 > [ 14.204137] [] inet_sendmsg+0x45/0x80 > [ 14.204149] [] sock_sendmsg+0xf1/0x110 > [ 14.204189] [] sys_sendmsg+0x20c/0x380 > [ 14.204233] [] system_call_fastpath+0x16/0x1b >=20 > While current linux-2.6 kernel doesnt emit this warning, bug is laten= t > and might cause unexpected failures. >=20 > ip_dev_loopback_xmit() runs in process context, preemption enabled, s= o > must call netif_rx_ni() instead of netif_rx(), to make sure that we > process pending software interrupt. >=20 > Reported-by: Eric Paris > Signed-off-by: Eric Dumazet > --- > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c > index c65f18e..d1bcc9f 100644 > --- a/net/ipv4/ip_output.c > +++ b/net/ipv4/ip_output.c > @@ -120,7 +120,7 @@ static int ip_dev_loopback_xmit(struct sk_buff *n= ewskb) > newskb->pkt_type =3D PACKET_LOOPBACK; > newskb->ip_summed =3D CHECKSUM_UNNECESSARY; > WARN_ON(!skb_dst(newskb)); > - netif_rx(newskb); > + netif_rx_ni(newskb); > return 0; > } > =20 Oops silly me, I forgot ipv6 updated patch in a couple of minutes