From owner-svn-src-head@FreeBSD.ORG Tue Oct 20 21:27:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3EFFC106566C; Tue, 20 Oct 2009 21:27:04 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2E6AB8FC08; Tue, 20 Oct 2009 21:27:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9KLR37W078965; Tue, 20 Oct 2009 21:27:03 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9KLR3Vl078963; Tue, 20 Oct 2009 21:27:03 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200910202127.n9KLR3Vl078963@svn.freebsd.org> From: Qing Li Date: Tue, 20 Oct 2009 21:27:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198306 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2009 21:27:04 -0000 Author: qingli Date: Tue Oct 20 21:27:03 2009 New Revision: 198306 URL: http://svn.freebsd.org/changeset/base/198306 Log: The flow-table function flowtable_route_flush() may be called during system initialization time. Since the flow-table is designed to maintain per CPU flow cache, the existing code did not check whether "smp_started" is true before calling sched_bind() and sched_unbind(), which triggers a page fault. Reviewed by: jeff MFC after: immediately Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Tue Oct 20 21:08:32 2009 (r198305) +++ head/sys/net/flowtable.c Tue Oct 20 21:27:03 2009 (r198306) @@ -930,16 +930,20 @@ flowtable_route_flush(struct flowtable * for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; - - thread_lock(curthread); - sched_bind(curthread, i); - thread_unlock(curthread); + + if (smp_started == 1) { + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + } flowtable_free_stale(ft, rt); - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); + if (smp_started == 1) { + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } } } else { flowtable_free_stale(ft, rt);