From owner-svn-src-head@FreeBSD.ORG Mon Nov 29 06:50:31 2010 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 1F3DE1065670; Mon, 29 Nov 2010 06:50:31 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DEBD8FC12; Mon, 29 Nov 2010 06:50:31 +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 oAT6oUmO005297; Mon, 29 Nov 2010 06:50:30 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAT6oUE2005295; Mon, 29 Nov 2010 06:50:30 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201011290650.oAT6oUE2005295@svn.freebsd.org> From: Colin Percival Date: Mon, 29 Nov 2010 06:50:30 +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: r216041 - head/sys/i386/i386 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: Mon, 29 Nov 2010 06:50:31 -0000 Author: cperciva Date: Mon Nov 29 06:50:30 2010 New Revision: 216041 URL: http://svn.freebsd.org/changeset/base/216041 Log: Fix bug introduced by r194784: Under XEN, the page(s) allocated to dpcpu for CPU #0 weren't being properly reserved. Under VM pressure this would cause problems when the dpcpu structures were overwritten by arbitrary data; the most common symptom was a panic when netisr attempted to lock a mutex. For some reason the XEN code keeps track of the start of available memory in the variables 'first', 'physfree', and 'init_first'; as far as I can tell, we always have first == physfree == init_first * PAGE_SIZE. The earlier commit adjusted 'first' (which, on !XEN, is the only variable which tracks this value) but not the other two variables. Exercise for reader: Eliminate two of these three variables. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Mon Nov 29 05:50:20 2010 (r216040) +++ head/sys/i386/i386/machdep.c Mon Nov 29 06:50:30 2010 (r216041) @@ -2576,6 +2576,8 @@ init386(first) pmap_kenter(pa + KERNBASE, pa); dpcpu_init((void *)(first + KERNBASE), 0); first += DPCPU_SIZE; + physfree += DPCPU_SIZE; + init_first += DPCPU_SIZE / PAGE_SIZE; PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0);