From owner-freebsd-net@FreeBSD.ORG Sun Oct 18 23:26:52 2009 Return-Path: Delivered-To: net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E45B106566C; Sun, 18 Oct 2009 23:26:52 +0000 (UTC) (envelope-from inpcb.harsha@gmail.com) Received: from mail-px0-f118.google.com (mail-px0-f118.google.com [209.85.216.118]) by mx1.freebsd.org (Postfix) with ESMTP id C72698FC08; Sun, 18 Oct 2009 23:26:51 +0000 (UTC) Received: by pxi16 with SMTP id 16so93708pxi.3 for ; Sun, 18 Oct 2009 16:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NYuFS6Rx0uafcSZwOF5SE9Q+h9tgQ6Zz/A2+FpP4xhU=; b=RjNbSpuvJbfcYoXr+VUe8WFrUgJuIPSVtmXButmSQRE6LqE/HJK8SMfdC5DI9HIa5P dnYulw0217OVHzqiXoXK28h4zJOOfRa3MXQEb/fjg8jJOLM/AR/HEF4BoXqXowSDJtLg lq7Rr/qhOUfR+bcgJSINHCliBt06ItRE9okJ0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=a0oSu8ECtw0s1ul6YUKebKuWQh3tJTpbcRVoCC1PWpnNrHuJ0l9SthTlNV8NlRWicD juAbsAnSE3aAbgcabLFkFxJnubsRJnuI4gyAev2yDafGElN6bFVEhpudDE1h32J98BhV 1kdnwWNAxuutivwG2QK7M2HuBzOaL3C5tOMVs= MIME-Version: 1.0 Received: by 10.140.133.7 with SMTP id g7mr1515311rvd.169.1255908411404; Sun, 18 Oct 2009 16:26:51 -0700 (PDT) In-Reply-To: <4ADAB8E0.3090502@elischer.org> References: <4ADAB8E0.3090502@elischer.org> Date: Sun, 18 Oct 2009 16:26:51 -0700 Message-ID: From: Harsha To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, "Robert N. M. Watson" , net@freebsd.org Subject: Re: Page fault in IFNET_WLOCK_ASSERT [if.c and pccbb.c] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2009 23:26:52 -0000 On Sat, Oct 17, 2009 at 11:42 PM, Julian Elischer wro= te: > Harsha wrote: >> wrote: >>> >>> Looks like a NULL pointer dereference, so perhaps a more traditional bu= g >>> -- >>> could you convert ifindex_alloc_locked+0x71 to a line of code? You can = do >>> this using kgdb on the kernel symbols file, perhaps "l >>> *ifindex_alloc_locked+0x71". >> >> It is the for loop in ifindex_alloc_locked() function- >> =A0for (idx =3D 1; idx <=3D V_if_index; idx++) >> >> idx is a local variable, so I figured it is V_if_index is what is >> causing the page fault. It does look like a NULL pointer reference - I >> see that V_if_index comes from that =A0vnet instance's value and uses >> the macro VNET_VNET_PTR() down the chain. Since the call chain is >> coming from a new thread cbb_event_thread, I believe that this >> thread's vnet context needs to be set using CURVNET_SET(). > > but only if you have options VIMAGE defined. if not then CURVNET_SET() > is a NOP I do have the VIMAGE options turned on. Can someone tell me what is the right way to add the vnet context to cbb_event_thread? I tried adding context in two locations- 1. In cbb_insert() as- CURVNET_SET(TD_TO_VNET(curthread)); 2. In if_alloc() as- CURVNET_SET(TD_TO_VNET(curthread)); or as ifp =3D malloc(sizeof(struct ifnet), M_IFNET, M_WAITOK|M_ZERO); #ifdef VIMAGE ifp->if_vnet =3D curvnet; if (ifp->if_home_vnet =3D=3D NULL) ifp->if_home_vnet =3D curvnet; CURVNET_SET(ifp->if_vnet); #endif But in all the cases I get a warning/error about unused variable 'saved_vnet' like this- cc1: warnings being treated as errors /usr/src/sys/net/if.c: In function 'if_alloc': /usr/src/sys/net/if.c:418: warning: unused variable 'saved_vnet' The backtrace is in the link I posted earlier. Thanks, Harsha