From owner-freebsd-emulation@FreeBSD.ORG Mon Feb 20 11:06:56 2012 Return-Path: Delivered-To: emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AF321065670 for ; Mon, 20 Feb 2012 11:06:56 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 70B3D8FC28 for ; Mon, 20 Feb 2012 11:06:56 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1KB6u02089984 for ; Mon, 20 Feb 2012 11:06:56 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1KB6tNx089982 for emulation@FreeBSD.org; Mon, 20 Feb 2012 11:06:55 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 20 Feb 2012 11:06:55 GMT Message-Id: <201202201106.q1KB6tNx089982@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: emulation@FreeBSD.org Cc: Subject: Current problem reports assigned to emulation@FreeBSD.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2012 11:06:56 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o ports/165215 emulation www/linux-f10-flashplugin11 is vulnerable 1 problem total. From owner-freebsd-emulation@FreeBSD.ORG Mon Feb 20 11:07:03 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D025D1065673 for ; Mon, 20 Feb 2012 11:07:03 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id A48928FC1C for ; Mon, 20 Feb 2012 11:07:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1KB73Pv090084 for ; Mon, 20 Feb 2012 11:07:03 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1KB73S9090082 for freebsd-emulation@FreeBSD.org; Mon, 20 Feb 2012 11:07:03 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 20 Feb 2012 11:07:03 GMT Message-Id: <201202201107.q1KB73S9090082@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-emulation@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-emulation@FreeBSD.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2012 11:07:03 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/159646 emulation [linux] [patch] bump Linux version in linuxulator f kern/156691 emulation [vmware] [panic] panic when using hard disks as RAW de o kern/156353 emulation [ibcs2] ibcs2 binaries that execute on 4.x not working o kern/155577 emulation [boot] BTX halted after install. Reboot during install o kern/155040 emulation [linux] [patch] Linux recvfrom doesn't handle proto fa o kern/153990 emulation [hyper-v]: Will not install into Hyper-V on Server 200 o kern/153887 emulation [linux] Linux emulator not understand STB_GNU_UNIQUE b o kern/153243 emulation [ibcs2] Seg fault whne running COFF binary using iBCS2 o kern/151714 emulation [linux] print/acroread9 not usable due to lack of supp a bin/150262 emulation [patch] truss(1) -f doesn't follow descendants of the a kern/150186 emulation [parallels] [panic] Parallels Desktop: CDROM disconnec o ports/148097 emulation [patch] suggested addition to linux_base-* packages to o ports/148096 emulation emulators/linux_base-* can not be built from ports on o kern/147793 emulation [vmware] [panic] cdrom handling, panic, possible race o kern/146237 emulation [linux] Linux binaries not reading directories mounted p kern/144584 emulation [linprocfs][patch] bogus values in linprocfs o ports/142837 emulation [patch] emulators/linux_base-* packages fails to insta o kern/140156 emulation [linux] cdparanoia fails to read drive data f kern/138944 emulation [parallels] [regression] Parallels no longer works in o kern/138880 emulation [linux] munmap segfaults after linux_mmap2 stresstest o ports/135337 emulation [PATCH] emulators/linux_base-f10: incorrect bash usage s kern/133144 emulation [linux] linuxulator 2.6 crashes with nvidias libGL.so. o kern/129169 emulation [linux] [patch] Linux Emulation ENOTCONN error using n o kern/126232 emulation [linux] Linux ioctl TCGETS (0x5401) always fails o kern/86619 emulation [linux] linux emulator interacts oddly with cp a kern/72920 emulation [linux] path "prefixing" is not done on unix domain so o kern/41543 emulation [patch] [request] easier wine/w23 support o kern/39201 emulation [linux] [patch] ptrace(2) and rfork(RFLINUXTHPN) confu o kern/36952 emulation [patch] [linux] ldd(1) command of linux does not work o kern/11165 emulation [ibcs2] IBCS2 doesn't work correctly with PID_MAX 9999 30 problems total. From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 00:57:21 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF2E0106566C; Tue, 21 Feb 2012 00:57:21 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 151ED8FC15; Tue, 21 Feb 2012 00:57:20 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q1L0vFbq002061; Tue, 21 Feb 2012 04:57:18 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q1L0vC1V002058; Tue, 21 Feb 2012 04:57:13 +0400 (MSK) (envelope-from ache) Date: Tue, 21 Feb 2012 04:57:09 +0400 From: Andrey Chernov To: ports@freebsd.org, emulation@freebsd.org Message-ID: <20120221005707.GB1781@vniz.net> Mail-Followup-To: Andrey Chernov , ports@freebsd.org, emulation@freebsd.org References: <20120215164722.GA1693@vniz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120215164722.GA1693@vniz.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: linux-f10-flashplugin11 not works for 9-stable (Linuxulator?) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 00:57:21 -0000 Just in case it may help somebody: the cause (but not the root) of the problem is found and workaround too. The cause of the problem is ::1 localhost localhost.my.domain line from our _standard_ /usr/src/etc/hosts which comes first before 127.0.0.1 localhost localhost.my.domain line. Linux takes the first match on localhost, i.e. ::1, then tries 8605 npviewer.bin STRU struct sockaddr { AF_INET6, [::1]:6010 } it was last command from npviewer.bin, then it immeditelly terminates: 8605 npviewer.bin RET linux_socketcall -1 errno 4 Interrupted system call 8605 npviewer.bin PSIG SIGTERM SIG_DFL code=0x10001 The workaround is to switch lines order in /etc/hosts, i.e. 127.0.0.1 localhost ::1 localhost to make IPv4 one comes first. Flash works afterwards. The bug affects IPv6-enabled machines with IPv4 over IPv6 preferred or maybe IPv4 too I don't know, but since we don't have such reports in mass, I think IPv4-only setup is fine. On Wed, Feb 15, 2012 at 08:47:22PM +0400, Andrey Chernov wrote: > Having 9-stable and ports from Feb 14, all builded from sources, I get > this commonly looking error attempting to view flash in FF 10.0.1: > > *** NSPlugin Wrapper *** ERROR: failed to initialize plugin-side RPC > client connection > NOTE: child process received `Goodbye', closing down > > Looking into ktrace I found error reason: > > 82037 plugin-container CALL connect(0x16,0x2c04f9d4,0x42) > 82037 plugin-container STRU struct sockaddr { AF_LOCAL, invalid } > 82037 plugin-container NAMI > "/tmp/_org_wrapper_NSPlugins_libflashplayer.so_82037-2_1804289383" > 82037 plugin-container RET connect -1 errno 2 No such file or directory > > (repeated several times). > > This "invalid" in sockaddr looks familiar as for some time ago added > sockaddr length checks our kernel, but as bz@ says this should be > already fixed. > > Does anybody runs flash successfly on 9-stable? If yes, where else the > problem can be? -- http://ache.vniz.net/ From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 08:29:09 2012 Return-Path: Delivered-To: emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88E5E1065680 for ; Tue, 21 Feb 2012 08:29:09 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from portsmonj.FreeBSD.org (portsmonj.freebsd.org [69.147.83.46]) by mx1.freebsd.org (Postfix) with ESMTP id 782B38FC28 for ; Tue, 21 Feb 2012 08:29:09 +0000 (UTC) Received: from portsmonj.freebsd.org (portsmonj.freebsd.org [69.147.83.46]) by portsmonj.FreeBSD.org (8.14.5/8.14.4) with ESMTP id q1L8T9CI078642 for ; Tue, 21 Feb 2012 08:29:09 GMT (envelope-from linimon@FreeBSD.org) Date: Tue, 21 Feb 2012 08:29:09 GMT Message-Id: <201202210829.q1L8T9CI078642@portsmonj.FreeBSD.org> From: linimon@FreeBSD.org To: emulation@FreeBSD.org Cc: Subject: FreeBSD ports that you maintain which are currently scheduled for deletion X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: portmgr-feedback@FreeBSD.org List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 08:29:09 -0000 Dear FreeBSD port maintainer: As part of an ongoing effort to reduce the number of problems in the FreeBSD ports system, we periodically schedule removal of ports that have been judged to have outlived their usefulness. Often, this is due to a better alternative having become available and/or the cessation of development on the existing port. In some cases, ports are marked for removal because they fail to build and install correctly from their sources, or otherwise fail in operation. The ports, and the reason and date that they have been scheduled for removal, are listed below. If no one has stepped forward before that time to propose a way to fix the problems (such as via a PR), the ports will be deleted. portname: graphics/linux-tiff description: TIFF library, Linux/i386 binary maintainer: emulation@FreeBSD.org status: FORBIDDEN deprecated because: expiration date: 2011-10-14 build errors: none. overview: http://portsmon.FreeBSD.org/portoverview.py?category=graphics&portname=linux-tiff portname: x11-toolkits/linux-pango description: Linux pango binary maintainer: emulation@FreeBSD.org status: FORBIDDEN deprecated because: expiration date: 2011-10-14 build errors: none. overview: http://portsmon.FreeBSD.org/portoverview.py?category=x11-toolkits&portname=linux-pango If this problem is one that you are already aware of, please accept our apologies and ignore this message. On the other hand, if you no longer wish to maintain this port (or ports), please reply with a message stating that, and accept our thanks for your efforts in the past. Thanks for your efforts to help improve FreeBSD. From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 08:29:25 2012 Return-Path: Delivered-To: emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D4B31065674 for ; Tue, 21 Feb 2012 08:29:25 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from portsmonj.FreeBSD.org (portsmonj.freebsd.org [69.147.83.46]) by mx1.freebsd.org (Postfix) with ESMTP id 8CF458FC23 for ; Tue, 21 Feb 2012 08:29:25 +0000 (UTC) Received: from portsmonj.freebsd.org (portsmonj.freebsd.org [69.147.83.46]) by portsmonj.FreeBSD.org (8.14.5/8.14.4) with ESMTP id q1L8TPFr081313 for ; Tue, 21 Feb 2012 08:29:25 GMT (envelope-from linimon@FreeBSD.org) Date: Tue, 21 Feb 2012 08:29:25 GMT Message-Id: <201202210829.q1L8TPFr081313@portsmonj.FreeBSD.org> From: linimon@FreeBSD.org To: emulation@FreeBSD.org Cc: Subject: FreeBSD ports that you maintain which are currently marked forbidden X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: portmgr-feedback@FreeBSD.org List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 08:29:25 -0000 Dear FreeBSD port maintainer: As part of an ongoing effort to reduce the number of problems in the FreeBSD ports system, we periodically notify users about ports that are marked as "forbidden" in their Makefiles. Often, these ports are so marked due to security concerns, such as known exploits. An overview of each port, including errors seen on the build farm, is included below. portname: graphics/linux-tiff forbidden because: Vulnerable since 2004-10-13, http://portaudit.freebsd.org/8816bf3a-7929-11df-bcce-0018f3e2eb82.html build errors: none. overview: http://portsmon.FreeBSD.org/portoverview.py?category=graphics&portname=linux-tiff portname: x11-toolkits/linux-pango forbidden because: Vulnerable since 2009-05-13, http://portaudit.freebsd.org/4b172278-3f46-11de-becb-001cc0377035.html build errors: none. overview: http://portsmon.FreeBSD.org/portoverview.py?category=x11-toolkits&portname=linux-pango If this problem is one that you are already aware of, please accept our apologies and ignore this message. On the other hand, if you no longer wish to maintain this port (or ports), please reply with a message stating that, and accept our thanks for your efforts in the past. Thanks for your efforts to help improve FreeBSD. From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 09:48:40 2012 Return-Path: Delivered-To: freebsd-emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91A671065672; Tue, 21 Feb 2012 09:48:40 +0000 (UTC) (envelope-from arundel@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 651068FC21; Tue, 21 Feb 2012 09:48:40 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1L9meqo074366; Tue, 21 Feb 2012 09:48:40 GMT (envelope-from arundel@freefall.freebsd.org) Received: (from arundel@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1L9meS7074362; Tue, 21 Feb 2012 09:48:40 GMT (envelope-from arundel) Date: Tue, 21 Feb 2012 09:48:40 GMT Message-Id: <201202210948.q1L9meS7074362@freefall.freebsd.org> To: arundel@FreeBSD.org, emulation@FreeBSD.org, freebsd-emulation@FreeBSD.org From: arundel@FreeBSD.org Cc: Subject: Re: ports/165215: www/linux-f10-flashplugin11 is vulnerable X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 09:48:40 -0000 Synopsis: www/linux-f10-flashplugin11 is vulnerable Responsible-Changed-From-To: emulation->freebsd-emulation Responsible-Changed-By: arundel Responsible-Changed-When: Tue Feb 21 09:47:09 UTC 2012 Responsible-Changed-Why: Assign to freebsd-emulation@, rather than emulation@. http://www.freebsd.org/cgi/query-pr.cgi?pr=165215 From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 09:48:40 2012 Return-Path: Delivered-To: emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91A671065672; Tue, 21 Feb 2012 09:48:40 +0000 (UTC) (envelope-from arundel@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 651068FC21; Tue, 21 Feb 2012 09:48:40 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1L9meqo074366; Tue, 21 Feb 2012 09:48:40 GMT (envelope-from arundel@freefall.freebsd.org) Received: (from arundel@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1L9meS7074362; Tue, 21 Feb 2012 09:48:40 GMT (envelope-from arundel) Date: Tue, 21 Feb 2012 09:48:40 GMT Message-Id: <201202210948.q1L9meS7074362@freefall.freebsd.org> To: arundel@FreeBSD.org, emulation@FreeBSD.org, freebsd-emulation@FreeBSD.org From: arundel@FreeBSD.org Cc: Subject: Re: ports/165215: www/linux-f10-flashplugin11 is vulnerable X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 09:48:40 -0000 Synopsis: www/linux-f10-flashplugin11 is vulnerable Responsible-Changed-From-To: emulation->freebsd-emulation Responsible-Changed-By: arundel Responsible-Changed-When: Tue Feb 21 09:47:09 UTC 2012 Responsible-Changed-Why: Assign to freebsd-emulation@, rather than emulation@. http://www.freebsd.org/cgi/query-pr.cgi?pr=165215 From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 10:07:52 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239FE106564A; Tue, 21 Feb 2012 10:07:52 +0000 (UTC) (envelope-from c.kworr@gmail.com) Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 49A288FC15; Tue, 21 Feb 2012 10:07:51 +0000 (UTC) Received: by eekb47 with SMTP id b47so2805680eek.13 for ; Tue, 21 Feb 2012 02:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=C4pRrxj5Y/vgwLXlHk8kDttQL0S9psJrKWbafnPj11I=; b=Tf/QRzjn5LCh/YRJCOiE0Oe5AfVPYhLzJsxBfQSuB+XrD45JfoPuU75jf/bJV7SwF5 YT/Qii9yVhqAu0uonKjcdc3tm8pu3rjlx6NYyT+8F5+kFyoFP+mxQv+yuIDspBFEsMaL r6J2EgAfAqztm1ZExac0iGUWbzSyaPPBiCWb0= Received: by 10.213.28.75 with SMTP id l11mr2707898ebc.47.1329818870349; Tue, 21 Feb 2012 02:07:50 -0800 (PST) Received: from green.tandem.local (158-209-200-46.pool.ukrtel.net. [46.200.209.158]) by mx.google.com with ESMTPS id n56sm88476924eeh.6.2012.02.21.02.07.47 (version=SSLv3 cipher=OTHER); Tue, 21 Feb 2012 02:07:48 -0800 (PST) Message-ID: <4F436CF2.2060601@gmail.com> Date: Tue, 21 Feb 2012 12:07:46 +0200 From: Volodymyr Kostyrko User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120220 Firefox/10.0.2 SeaMonkey/2.7.2 MIME-Version: 1.0 To: Andrey Chernov , ports@freebsd.org, emulation@freebsd.org References: <20120215164722.GA1693@vniz.net> <20120221005707.GB1781__27803.6550422714$1329785890$gmane$org@vniz.net> In-Reply-To: <20120221005707.GB1781__27803.6550422714$1329785890$gmane$org@vniz.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: Re: linux-f10-flashplugin11 not works for 9-stable (Linuxulator?) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 10:07:52 -0000 Andrey Chernov wrote: > Just in case it may help somebody: the cause (but not the root) of the > problem is found and workaround too. > > The cause of the problem is > ::1 localhost localhost.my.domain > line from our _standard_ /usr/src/etc/hosts which comes first before > 127.0.0.1 localhost localhost.my.domain > line. > > Linux takes the first match on localhost, i.e. ::1, then tries > 8605 npviewer.bin STRU struct sockaddr { AF_INET6, [::1]:6010 } > it was last command from npviewer.bin, then it immeditelly terminates: > 8605 npviewer.bin RET linux_socketcall -1 errno 4 Interrupted system call > 8605 npviewer.bin PSIG SIGTERM SIG_DFL code=0x10001 > > The workaround is to switch lines order in /etc/hosts, i.e. > 127.0.0.1 localhost > ::1 localhost > to make IPv4 one comes first. Flash works afterwards. > > The bug affects IPv6-enabled machines with IPv4 over IPv6 preferred or > maybe IPv4 too I don't know, but since we don't have such reports in mass, > I think IPv4-only setup is fine. Can you clarify this a bit? I have at least one machine with vanilla /etc/hosts connected to IPv4/IPv6 network (i.e. some internal hosts resolve to IPv6) and flash works fine there. The DEPEND list on www/nspluginwrapper lists ftp/curl as a dependence. And this port can be built without IPv6. Can you check your ports configuration about enabling IPv6 support? -- Sphinx of black quartz judge my vow. From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 10:43:50 2012 Return-Path: Delivered-To: emulation@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 671F71065676; Tue, 21 Feb 2012 10:43:50 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id CB3768FC1E; Tue, 21 Feb 2012 10:43:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q1LAhlwb006264; Tue, 21 Feb 2012 14:43:47 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q1LAhlR4006263; Tue, 21 Feb 2012 14:43:47 +0400 (MSK) (envelope-from ache) Date: Tue, 21 Feb 2012 14:43:46 +0400 From: Andrey Chernov To: Volodymyr Kostyrko Message-ID: <20120221104346.GA6099@vniz.net> Mail-Followup-To: Andrey Chernov , Volodymyr Kostyrko , ports@FreeBSD.ORG, emulation@FreeBSD.ORG References: <20120215164722.GA1693@vniz.net> <20120221005707.GB1781__27803.6550422714$1329785890$gmane$org@vniz.net> <4F436CF2.2060601@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F436CF2.2060601@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ports@FreeBSD.ORG, emulation@FreeBSD.ORG Subject: Re: linux-f10-flashplugin11 not works for 9-stable (Linuxulator?) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 10:43:50 -0000 On Tue, Feb 21, 2012 at 12:07:46PM +0200, Volodymyr Kostyrko wrote: > Andrey Chernov wrote: > > Just in case it may help somebody: the cause (but not the root) of the > > problem is found and workaround too. > > > > The cause of the problem is > > ::1 localhost localhost.my.domain > > line from our _standard_ /usr/src/etc/hosts which comes first before > > 127.0.0.1 localhost localhost.my.domain > > line. > > > > Linux takes the first match on localhost, i.e. ::1, then tries > > 8605 npviewer.bin STRU struct sockaddr { AF_INET6, [::1]:6010 } > > it was last command from npviewer.bin, then it immeditelly terminates: > > 8605 npviewer.bin RET linux_socketcall -1 errno 4 Interrupted system call > > 8605 npviewer.bin PSIG SIGTERM SIG_DFL code=0x10001 > > > > The workaround is to switch lines order in /etc/hosts, i.e. > > 127.0.0.1 localhost > > ::1 localhost > > to make IPv4 one comes first. Flash works afterwards. > > > > The bug affects IPv6-enabled machines with IPv4 over IPv6 preferred or > > maybe IPv4 too I don't know, but since we don't have such reports in mass, > > I think IPv4-only setup is fine. > > Can you clarify this a bit? I have at least one machine with vanilla > /etc/hosts connected to IPv4/IPv6 network (i.e. some internal hosts > resolve to IPv6) and flash works fine there. I can't - I don't know why npviewer.bin is killed by SIGTERM immediatelly when it socketcall to [::1]:6010 in Linuxulator and why it works normally when it socketcall to 127.0.0.1:6010. I remember when I had FF 7, Flash works with ::1 first, but Linuxulator not yet have any length checks at those times as it have now (or perhaps other recent fixes). > The DEPEND list on www/nspluginwrapper lists ftp/curl as a dependence. > And this port can be built without IPv6. Can you check your ports > configuration about enabling IPv6 support? This is not the case, all my ports which have IPv6 capability are builded with IPv6 as the system too. -- http://ache.vniz.net/ From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 10:51:26 2012 Return-Path: Delivered-To: emulation@FreeBSD.ORG Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id A5D701065676; Tue, 21 Feb 2012 10:51:26 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 6557A152373; Tue, 21 Feb 2012 10:51:26 +0000 (UTC) Message-ID: <4F43772E.4030908@FreeBSD.org> Date: Tue, 21 Feb 2012 02:51:26 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andrey Chernov , Volodymyr Kostyrko , ports@FreeBSD.ORG, emulation@FreeBSD.ORG References: <20120215164722.GA1693@vniz.net> <20120221005707.GB1781__27803.6550422714$1329785890$gmane$org@vniz.net> <4F436CF2.2060601@gmail.com> <20120221104346.GA6099@vniz.net> In-Reply-To: <20120221104346.GA6099@vniz.net> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: Re: linux-f10-flashplugin11 not works for 9-stable (Linuxulator?) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 10:51:26 -0000 On 02/21/2012 02:43, Andrey Chernov wrote: > I can't - I don't know why npviewer.bin is killed by SIGTERM immediatelly > when it socketcall to [::1]:6010 in Linuxulator and why it works > normally when it socketcall to 127.0.0.1:6010. I remember when I had > FF 7, Flash works with ::1 first, but Linuxulator not yet have any length > checks at those times as it have now (or perhaps other recent fixes). I have an IPv6 connection and listing ::1 first works for me as well. Try closing down firefox, rm -r ~/.macromedia, rebuilding www/nspluginwrapper and www/linux-f10-flashplugin11, then rm ~/.mozilla/plugins/npwrapper.libflashplayer.so and reinstall. (I just use, nspluginwrapper -i /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so personally) Then restart firefox and check out about:plugins Good luck, Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 11:27:05 2012 Return-Path: Delivered-To: emulation@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6B351065672; Tue, 21 Feb 2012 11:27:05 +0000 (UTC) (envelope-from ache@vniz.net) Received: from vniz.net (vniz.net [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id 4CFD78FC13; Tue, 21 Feb 2012 11:27:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by vniz.net (8.14.5/8.14.5) with ESMTP id q1LBR077009896; Tue, 21 Feb 2012 15:27:00 +0400 (MSK) (envelope-from ache@vniz.net) Received: (from ache@localhost) by localhost (8.14.5/8.14.5/Submit) id q1LBQwx2009894; Tue, 21 Feb 2012 15:26:58 +0400 (MSK) (envelope-from ache) Date: Tue, 21 Feb 2012 15:26:58 +0400 From: Andrey Chernov To: Doug Barton Message-ID: <20120221112658.GA9647@vniz.net> Mail-Followup-To: Andrey Chernov , Doug Barton , Volodymyr Kostyrko , ports@FreeBSD.ORG, emulation@FreeBSD.ORG References: <20120215164722.GA1693@vniz.net> <20120221005707.GB1781__27803.6550422714$1329785890$gmane$org@vniz.net> <4F436CF2.2060601@gmail.com> <20120221104346.GA6099@vniz.net> <4F43772E.4030908@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F43772E.4030908@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ports@FreeBSD.ORG, emulation@FreeBSD.ORG, Volodymyr Kostyrko Subject: Re: linux-f10-flashplugin11 not works for 9-stable (Linuxulator?) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 11:27:05 -0000 On Tue, Feb 21, 2012 at 02:51:26AM -0800, Doug Barton wrote: > On 02/21/2012 02:43, Andrey Chernov wrote: > > I can't - I don't know why npviewer.bin is killed by SIGTERM immediatelly > > when it socketcall to [::1]:6010 in Linuxulator and why it works > > normally when it socketcall to 127.0.0.1:6010. I remember when I had > > FF 7, Flash works with ::1 first, but Linuxulator not yet have any length > > checks at those times as it have now (or perhaps other recent fixes). > > I have an IPv6 connection and listing ::1 first works for me as well. > > Try closing down firefox, rm -r ~/.macromedia, rebuilding > www/nspluginwrapper and www/linux-f10-flashplugin11, then rm > ~/.mozilla/plugins/npwrapper.libflashplayer.so and reinstall. (I just > use, nspluginwrapper -i > /usr/local/lib/npapi/linux-f10-flashplugin/libflashplayer.so personally) > > Then restart firefox and check out about:plugins I already do all the above first, rebuild everything etc. Nothing helps excepting moving ::1 down (moving it down works even with FF is already running - on the next page reload). BTW, Flash is shown in about:plugins normally in either case, just not works due to misteriosly killed npviewer.bin in ::1 first case. -- http://ache.vniz.net/ From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 15:50:02 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EE9D106564A for ; Tue, 21 Feb 2012 15:50:02 +0000 (UTC) (envelope-from freebsd-emulation@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4219C8FC15 for ; Tue, 21 Feb 2012 15:50:01 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rzrk2-0000p0-Vc for freebsd-emulation@freebsd.org; Tue, 21 Feb 2012 16:34:58 +0100 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Feb 2012 16:34:58 +0100 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Feb 2012 16:34:58 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-emulation@freebsd.org From: Ivan Voras Date: Tue, 21 Feb 2012 16:34:49 +0100 Lines: 48 Message-ID: References: <20120213122740.ed3bcf29.siefke_listen@web.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigD3F9F49CC193DF955F32141E" X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0) Gecko/20120213 Thunderbird/10.0 In-Reply-To: <20120213122740.ed3bcf29.siefke_listen@web.de> X-Enigmail-Version: 1.3.5 Subject: Re: Linux compatibility X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 15:50:02 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigD3F9F49CC193DF955F32141E Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 13/02/2012 12:27, siefke_listen@web.de wrote: > $ /usr/local/bin/linux-firefox > /usr/local/lib/linux-firefox/firefox: symbol lookup error: /usr/lib/lib= stdc++.so.6: undefined symbol: _ZNSt8messagesIcE2idE, version GLIBCXX_3.4= >=20 > $ /usr/local/bin/eagle > /usr/local/share/eagle5/bin/eagle: symbol lookup error: /usr/lib/libstd= c++.so.6: undefined symbol: _ZNSt8messagesIcE2idE, version GLIBCXX_3.4 >=20 > $ googleearth > ./googleearth-bin: symbol lookup error: ./libge_net.so: undefined symbo= l: _ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE, version G= LIBCXX_3.4 >=20 > Does anyone a idea where is the mistake? I suspect you already know: you have tried to run a binary compiled with a different version of glibc++ than what you have installed. The Linux binary will need the Linux glibc, glibc++ and all other libraries - they are installed by the linux* ports. So, either find a statically linked executable or try to install the libraries which are required by your binaries. --------------enigD3F9F49CC193DF955F32141E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9DuZkACgkQldnAQVacBchRXwCg7N9ZyldvO6izmnuFTClEDWTG xjoAnjj0w0J1kbrIgb9ZnQb7y6AAuK+8 =Un9w -----END PGP SIGNATURE----- --------------enigD3F9F49CC193DF955F32141E-- From owner-freebsd-emulation@FreeBSD.ORG Tue Feb 21 22:02:43 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 60AAA106566C; Tue, 21 Feb 2012 22:02:43 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 7F2E3158D92; Tue, 21 Feb 2012 22:02:36 +0000 (UTC) Message-ID: <4F44147C.8050905@FreeBSD.org> Date: Tue, 21 Feb 2012 14:02:36 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: decke@FreeBSD.org X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, FreeBSD ports list , Andriy Gapon Subject: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2012 22:02:43 -0000 Howdy, I had the previous version of virtualbox working just fine on my up-to-date 8-stable i386 system, and upgraded to 4.1.8 today. When I attempt to load vboxdrv it instantly panics my system: panic: vm_object_deallocate: object deallocated too many times: 4 cpuid = 1 KDB: stack backtrace: db_trace_self_wrapper(c08f2883,1,c118de58,1,c7c08e58,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c0918c49,1,c091164e,eacfb8ac,1,...) at kdb_backtrace+0x2a panic(c091164e,4,c09112d7,1e9,0,...) at panic+0x117 vm_object_deallocate(c7c08e58,e8ba3000,e8ba5000,0,eacfb918,...) at vm_object_deallocate+0x347 FreeBSDAllocHelper(1,3,0,2000,0,...) at FreeBSDAllocHelper+0x11e rtR0MemObjNativeAllocCont(c6731b20,2000,0,c672a5b2,1,...) at rtR0MemObjNativeAllocCont+0x56 supdrvInitDevExt(c6731ae0,33c,7a,c740b380,c67315e8,...) at supdrvInitDevExt+0xdd VBoxDrvFreeBSDModuleEvent(c740b380,0,0,75,0,...) at VBoxDrvFreeBSDModuleEvent+0x46 module_register_init(c67315e8,0,c08ebecc,e7,0,...) at module_register_init+0xa7 linker_load_module(0,eacfbc34,c08ebecc,3fa,0,...) at linker_load_module+0xa05 kern_kldload(c7bd3580,c62e4800,eacfbc5c,0,c7befac0,...) at kern_kldload+0xca kldload(c7bd3580,eacfbcec,0,c,246,...) at kldload+0x74 syscall(eacfbd28) at syscall+0x270 Xint0x80_syscall() at Xint0x80_syscall+0x21 --- syscall (304, FreeBSD ELF32, kldload), eip = 0x280d69fb, esp = 0xbfbfe70c, ebp = 0xbfbfebf8 --- KDB: enter: panic Full core.text.2 is at freefall:~dougb/ -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 00:05:58 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06781106566B for ; Wed, 22 Feb 2012 00:05:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id B63A28FC16 for ; Wed, 22 Feb 2012 00:05:56 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA15902; Wed, 22 Feb 2012 01:52:33 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1RzzVY-000MdW-Ak; Wed, 22 Feb 2012 01:52:32 +0200 Message-ID: <4F442E1E.4010501@FreeBSD.org> Date: Wed, 22 Feb 2012 01:51:58 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Doug Barton References: <4F44147C.8050905@FreeBSD.org> In-Reply-To: <4F44147C.8050905@FreeBSD.org> X-Enigmail-Version: 1.3.5 Content-Type: multipart/mixed; boundary="------------070004020305000508040709" Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 00:05:58 -0000 This is a multi-part message in MIME format. --------------070004020305000508040709 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit on 22/02/2012 00:02 Doug Barton said the following: > Howdy, > > I had the previous version of virtualbox working just fine on my > up-to-date 8-stable i386 system, and upgraded to 4.1.8 today. When I > attempt to load vboxdrv it instantly panics my system: > > panic: vm_object_deallocate: object deallocated too many times: 4 > cpuid = 1 > KDB: stack backtrace: > db_trace_self_wrapper(c08f2883,1,c118de58,1,c7c08e58,...) at > db_trace_self_wrapper+0x26 > kdb_backtrace(c0918c49,1,c091164e,eacfb8ac,1,...) at kdb_backtrace+0x2a > panic(c091164e,4,c09112d7,1e9,0,...) at panic+0x117 > vm_object_deallocate(c7c08e58,e8ba3000,e8ba5000,0,eacfb918,...) at > vm_object_deallocate+0x347 > FreeBSDAllocHelper(1,3,0,2000,0,...) at FreeBSDAllocHelper+0x11e > rtR0MemObjNativeAllocCont(c6731b20,2000,0,c672a5b2,1,...) at > rtR0MemObjNativeAllocCont+0x56 Ah, embarrassing. Could you please substitute the attached patch file for the corresponding file in the port and re-test the port? > supdrvInitDevExt(c6731ae0,33c,7a,c740b380,c67315e8,...) at > supdrvInitDevExt+0xdd > VBoxDrvFreeBSDModuleEvent(c740b380,0,0,75,0,...) at > VBoxDrvFreeBSDModuleEvent+0x46 > module_register_init(c67315e8,0,c08ebecc,e7,0,...) at > module_register_init+0xa7 > linker_load_module(0,eacfbc34,c08ebecc,3fa,0,...) at > linker_load_module+0xa05 > kern_kldload(c7bd3580,c62e4800,eacfbc5c,0,c7befac0,...) at kern_kldload+0xca > kldload(c7bd3580,eacfbcec,0,c,246,...) at kldload+0x74 > syscall(eacfbd28) at syscall+0x270 > Xint0x80_syscall() at Xint0x80_syscall+0x21 > --- syscall (304, FreeBSD ELF32, kldload), eip = 0x280d69fb, esp = > 0xbfbfe70c, ebp = 0xbfbfebf8 --- > KDB: enter: panic > > > Full core.text.2 is at freefall:~dougb/ > > -- Andriy Gapon --------------070004020305000508040709 Content-Type: text/plain; name="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-12-19 15:01:31.000000000 +0200 +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2012-02-22 01:48:41.528856970 +0200 @@ -5,6 +5,7 @@ /* * Copyright (c) 2007 knut st. osmundsen + * Copyright (c) 2011 Andriy Gapon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -54,23 +55,8 @@ /** The core structure. */ RTR0MEMOBJINTERNAL Core; /** Type dependent data */ - union - { - /** Non physical memory allocations */ - struct - { - /** The VM object associated with the allocation. */ - vm_object_t pObject; - } NonPhys; - /** Physical memory allocations */ - struct - { - /** Number of pages */ - uint32_t cPages; - /** Array of pages - variable */ - vm_page_t apPages[1]; - } Phys; - } u; + /** The VM object associated with the allocation. */ + vm_object_t pObject; } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; @@ -125,25 +111,14 @@ switch (pMemFreeBSD->Core.enmType) { - case RTR0MEMOBJTYPE_CONT: - contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOBJ); - break; - case RTR0MEMOBJTYPE_PAGE: + case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_CONT: { rc = vm_map_remove(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); - - vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - } - vm_page_unlock_queues(); break; } @@ -165,8 +140,8 @@ case RTR0MEMOBJTYPE_RES_VIRT: { vm_map_t pMap = kernel_map; - if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) - pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map; + if (pMemFreeBSD->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS) + pMap = &((struct proc *)pMemFreeBSD->Core.u.ResVirt.R0Process)->p_vmspace->vm_map; rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -180,7 +155,6 @@ if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) pMap = &((struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process)->p_vmspace->vm_map; - rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -191,26 +165,21 @@ case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) + for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); + pPage != NULL; + pPage = vm_page_next(pPage)) { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; vm_page_unwire(pPage, 0); - vm_page_free(pPage); } vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + vm_object_deallocate(pMemFreeBSD->pObject); break; } -#ifdef USE_KMEM_ALLOC_ATTR - case RTR0MEMOBJTYPE_LOW: - { - kmem_free(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb); - break; - } -#else - case RTR0MEMOBJTYPE_LOW: /* unused */ -#endif default: AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); return VERR_INTERNAL_ERROR; @@ -220,183 +189,165 @@ } -DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) -{ - int rc; - size_t cPages = cb >> PAGE_SHIFT; - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), - RTR0MEMOBJTYPE_PAGE, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - pMemFreeBSD->u.Phys.cPages = cPages; +static vm_page_t FreeBSDContigPhysAllocHelper(vm_object_t pObject, vm_pindex_t iPIndex, + u_long cPages, vm_paddr_t VmPhysAddrHigh, + u_long uAlignment, bool fWire) +{ + vm_page_t pPages; +#if __FreeBSD_version > 1000000 + int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY; + if (fWire) + flags |= VM_ALLOC_WIRED; + VM_OBJECT_LOCK(pObject); + pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); + VM_OBJECT_UNLOCK(pObject); + return pPages; +#else + pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); + if (!pPages) + return pPages; + VM_OBJECT_LOCK(pObject); + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = pPages + iPage; + vm_page_insert(pPage, pObject, iPIndex + iPage); + pPage->valid = VM_PAGE_BITS_ALL; + if (fWire) + { + pPage->wire_count = 1; + atomic_add_int(&cnt.v_wire_count, 1); + } + } + VM_OBJECT_UNLOCK(pObject); + return pPages; +#endif +} - vm_offset_t MapAddress = vm_map_min(kernel_map); - rc = vm_map_find(kernel_map, /* map */ - NULL, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - TRUE, /* find_space */ - fExecutable /* protection */ - ? VM_PROT_ALL - : VM_PROT_RW, - VM_PROT_ALL, /* max(_prot) */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) +static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, + vm_paddr_t VmPhysAddrHigh, u_long uAlignment, + bool fContiguous, bool fWire) +{ + if (fContiguous) { - rc = VINF_SUCCESS; + if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL) + return VINF_SUCCESS; + else + return VERR_NO_MEMORY; + } - for (size_t iPage = 0; iPage < cPages; iPage++) + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire); + if (!pPage) { - vm_page_t pPage; - - pPage = vm_page_alloc(NULL, iPage, - VM_ALLOC_SYSTEM | - VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); - - if (!pPage) + /* Free all allocated pages */ + VM_OBJECT_LOCK(pObject); + while (iPage-- > 0) { - /* - * Out of pages - * Remove already allocated pages - */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); + pPage = vm_page_lookup(pObject, iPage); + vm_page_lock_queues(); + if (fWire) vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; + vm_page_free(pPage); + vm_page_unlock_queues(); } - - pPage->valid = VM_PAGE_BITS_ALL; - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; + VM_OBJECT_UNLOCK(pObject); + return VERR_NO_MEMORY; } + } + return VINF_SUCCESS; +} - if (rc == VINF_SUCCESS) - { - vm_offset_t AddressDst = MapAddress; +static int FreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable, + vm_paddr_t VmPhysAddrHigh, bool fContiguous) +{ + int rc; + size_t cPages = atop(pMemFreeBSD->Core.cb); - for (size_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + vm_offset_t MapAddress = vm_map_min(kernel_map); - MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage, - fExecutable - ? VM_PROT_ALL - : VM_PROT_RW, - TRUE); + // no additional object reference for auto-deallocation upon unmapping + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); - AddressDst += PAGE_SIZE; - } + if (rc == KERN_SUCCESS) + { + rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, PAGE_SIZE, fContiguous, false); + if (RT_SUCCESS(rc)) { + vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); /* Store start address */ pMemFreeBSD->Core.pv = (void *)MapAddress; - *ppMem = &pMemFreeBSD->Core; return VINF_SUCCESS; } - } - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ - rtR0MemObjDelete(&pMemFreeBSD->Core); + vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb); + } + else + { + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + vm_object_deallocate(pMemFreeBSD->pObject); + } return rc; } - -DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { -#ifdef USE_KMEM_ALLOC_ATTR - /* - * Use kmem_alloc_attr, fExectuable is not needed because the - * memory will be executable by default - */ - NOREF(fExecutable); - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_PAGE, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->Core.pv = (void *)kmem_alloc_attr(kernel_map, /* Kernel */ - cb, /* Amount */ - M_ZERO, /* Zero memory */ - 0, /* Low physical address */ - _4G - PAGE_SIZE, /* Highest physical address */ - VM_MEMATTR_DEFAULT); /* Default memory attributes */ - if (!pMemFreeBSD->Core.pv) - return VERR_NO_MEMORY; - - *ppMem = &pMemFreeBSD->Core; - - return VINF_SUCCESS; -#else - /* - * Try a Alloc first and see if we get luck, if not try contigmalloc. - * Might wish to try find our own pages or something later if this - * turns into a problemspot on AMD64 boxes. - */ - int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable); - if (RT_SUCCESS(rc)) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false); + if (RT_FAILURE(rc)) { - size_t iPage = cb >> PAGE_SHIFT; - while (iPage-- > 0) - if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE_SIZE)) - { - RTR0MemObjFree(*ppMem, false); - *ppMem = NULL; - rc = VERR_NO_MEMORY; - break; - } + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - if (RT_FAILURE(rc)) - rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); + + *ppMem = &pMemFreeBSD->Core; return rc; -#endif } -DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_LOW, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - PAGE_SIZE, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false); + if (RT_FAILURE(rc)) { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - NOREF(fExecutable); - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; + *ppMem = &pMemFreeBSD->Core; + return rc; } -static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - pPage->wire_count = 1; - pPage->pindex = iPage; - pPage->act_count = 0; - pPage->oflags = 0; - pPage->flags = PG_UNMANAGED; - atomic_add_int(&cnt.v_wire_count, 1); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_CONT, NULL, cb); + if (!pMemFreeBSD) + return VERR_NO_MEMORY; + + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true); + if (RT_FAILURE(rc)) + { + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; + } + + pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); + *ppMem = &pMemFreeBSD->Core; + return rc; } @@ -405,69 +356,36 @@ RTHCPHYS PhysHighest, size_t uAlignment, bool fContiguous) { - int rc = VINF_SUCCESS; - uint32_t cPages = cb >> PAGE_SHIFT; + uint32_t cPages = atop(cb); vm_paddr_t VmPhysAddrHigh; /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->u.Phys.cPages = cPages; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); if (PhysHighest != NIL_RTHCPHYS) VmPhysAddrHigh = PhysHighest; else VmPhysAddrHigh = ~(vm_paddr_t)0; - if (fContiguous) - { - vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); + int rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, uAlignment, fContiguous, true); - if (pPage) - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - rtR0MemObjFreeBSDPhysPageInit(&pPage[iPage], iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = &pPage[iPage]; - } - else - rc = VERR_NO_MEMORY; - } - else - { - /* Allocate page by page */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0); - - if (!pPage) - { - /* Free all allocated pages */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; - } - rtR0MemObjFreeBSDPhysPageInit(pPage, iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; - } - } - - if (RT_FAILURE(rc)) + if (RT_FAILURE(rc)) { + vm_object_deallocate(pMemFreeBSD->pObject); rtR0MemObjDelete(&pMemFreeBSD->Core); + } else { - if (enmType == RTR0MEMOBJTYPE_PHYS) + if (fContiguous) { - pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[0]); + Assert(enmType == RTR0MEMOBJTYPE_PHYS); + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.fAllocated = true; } @@ -480,42 +398,13 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true); -#else - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - uAlignment, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) - { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; - } - - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; -#endif } DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false); -#else - return VERR_NOT_SUPPORTED; -#endif } @@ -625,49 +514,41 @@ if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* - * Allocate an empty VM object and map it into the requested map. - */ - pMemFreeBSD->u.NonPhys.pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT); - if (pMemFreeBSD->u.NonPhys.pObject) + vm_offset_t MapAddress = pvFixed != (void *)-1 + ? (vm_offset_t)pvFixed + : vm_map_min(pMap); + if (pvFixed != (void *)-1) + vm_map_remove(pMap, + MapAddress, + MapAddress + cb); + + rc = vm_map_find(pMap, /* map */ + NULL, /* object */ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ + VM_PROT_ALL, /* max(_prot) ?? */ + 0); /* cow (copy-on-write) */ + if (rc == KERN_SUCCESS) { - vm_offset_t MapAddress = pvFixed != (void *)-1 - ? (vm_offset_t)pvFixed - : vm_map_min(pMap); - if (pvFixed != (void *)-1) - vm_map_remove(pMap, - MapAddress, - MapAddress + cb); - - rc = vm_map_find(pMap, /* map */ - pMemFreeBSD->u.NonPhys.pObject, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - pvFixed == (void *)-1, /* find_space */ - VM_PROT_NONE, /* protection */ - VM_PROT_ALL, /* max(_prot) ?? */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) + if (R0Process != NIL_RTR0PROCESS) { - if (R0Process != NIL_RTR0PROCESS) - { - rc = vm_map_inherit(pMap, - MapAddress, - MapAddress + cb, - VM_INHERIT_SHARE); - AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - } - pMemFreeBSD->Core.pv = (void *)MapAddress; - pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rc = vm_map_inherit(pMap, + MapAddress, + MapAddress + cb, + VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); } - vm_object_deallocate(pMemFreeBSD->u.NonPhys.pObject); - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + pMemFreeBSD->Core.pv = (void *)MapAddress; + pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; } - else - rc = VERR_NO_MEMORY; + + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ rtR0MemObjDelete(&pMemFreeBSD->Core); return rc; @@ -690,7 +571,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub) { - AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); +// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); /* @@ -699,21 +580,68 @@ if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; -/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/source/i386/i386/pmap.c?v=RELENG62#L2860) */ -/** @todo finish the implementation. */ + int rc; + PRTR0MEMOBJFREEBSD pMemToMapFreeBSD = (PRTR0MEMOBJFREEBSD)pMemToMap; - return VERR_NOT_SUPPORTED; + /* calc protection */ + vm_prot_t ProtectionFlags = 0; + if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) + ProtectionFlags = VM_PROT_NONE; + if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ) + ProtectionFlags |= VM_PROT_READ; + if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE) + ProtectionFlags |= VM_PROT_WRITE; + if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC) + ProtectionFlags |= VM_PROT_EXECUTE; + + vm_offset_t Addr = vm_map_min(kernel_map); + if (cbSub == 0) + cbSub = pMemToMap->cb - offSub; + + vm_object_reference(pMemToMapFreeBSD->pObject); + rc = vm_map_find(kernel_map, /* Map to insert the object in */ + pMemToMapFreeBSD->pObject, /* Object to map */ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ + 0); /* copy-on-write and similar flags */ + + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbSub, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); + + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(RTR0MEMOBJFREEBSD), + RTR0MEMOBJTYPE_MAPPING, + (void *)Addr, + cbSub); + if (pMemFreeBSD) + { + Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr); + pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; + } + rc = vm_map_remove(kernel_map, Addr, Addr + cbSub); + AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); + } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); + + return VERR_NO_MEMORY; } -/* see http://markmail.org/message/udhq33tefgtyfozs */ -DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, + unsigned fProt, RTR0PROCESS R0Process) { /* * Check for unsupported stuff. */ AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); - AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; @@ -734,62 +662,38 @@ ProtectionFlags |= VM_PROT_EXECUTE; /* calc mapping address */ - PROC_LOCK(pProc); - vm_offset_t AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); - PROC_UNLOCK(pProc); + vm_offset_t AddrR3; + if (R3PtrFixed == (RTR3PTR)-1) + { + // is this needed? + PROC_LOCK(pProc); + AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); + PROC_UNLOCK(pProc); + } + else + AddrR3 = (vm_offset_t)R3PtrFixed; - /* Insert the object in the map. */ + /* Insert the pObject in the map. */ + vm_object_reference(pMemToMapFreeBSD->pObject); rc = vm_map_find(pProcMap, /* Map to insert the object in */ - NULL, /* Object to map */ + pMemToMapFreeBSD->pObject, /* Object to map */ 0, /* Start offset in the object */ &AddrR3, /* Start address IN/OUT */ pMemToMap->cb, /* Size of the mapping */ - TRUE, /* Whether a suitable address should be searched for first */ + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ ProtectionFlags, /* protection flags */ VM_PROT_ALL, /* Maximum protection flags */ - 0); /* Copy on write */ + 0); /* copy-on-write and similar flags */ - /* Map the memory page by page into the destination map. */ if (rc == KERN_SUCCESS) { - size_t cPages = pMemToMap->cb >> PAGE_SHIFT;; - pmap_t pPhysicalMap = pProcMap->pmap; - vm_offset_t AddrR3Dst = AddrR3; - - if ( pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS - || pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS_NC - || pMemToMap->enmType == RTR0MEMOBJTYPE_PAGE) - { - /* Mapping physical allocations */ - Assert(cPages == pMemToMapFreeBSD->u.Phys.cPages); + rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - /* Insert the memory page by page into the mapping. */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemToMapFreeBSD->u.Phys.apPages[iPage]; + rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - } - } - else - { - /* Mapping cont or low memory types */ - vm_offset_t AddrToMap = (vm_offset_t)pMemToMap->pv; - - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = PHYS_TO_VM_PAGE(vtophys(AddrToMap)); - - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - AddrToMap += PAGE_SIZE; - } - } - } - - if (RT_SUCCESS(rc)) - { /* * Create a mapping object for it. */ @@ -805,9 +709,11 @@ return VINF_SUCCESS; } - rc = vm_map_remove(pProcMap, ((vm_offset_t)AddrR3), ((vm_offset_t)AddrR3) + pMemToMap->cb); + rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb); AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); return VERR_NO_MEMORY; } @@ -855,49 +761,47 @@ return NIL_RTHCPHYS; } - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Lock.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } case RTR0MEMOBJTYPE_MAPPING: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) { struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } return vtophys(pb); } - case RTR0MEMOBJTYPE_CONT: - return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); - - case RTR0MEMOBJTYPE_PHYS: - return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT); - case RTR0MEMOBJTYPE_PAGE: - case RTR0MEMOBJTYPE_PHYS_NC: - return VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[iPage]); - -#ifdef USE_KMEM_ALLOC_ATTR case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_PHYS_NC: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); - return vtophys(pb); + RTHCPHYS addr; + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + return addr; } -#else - case RTR0MEMOBJTYPE_LOW: -#endif + + case RTR0MEMOBJTYPE_PHYS: + return pMemFreeBSD->Core.u.Cont.Phys + ptoa(iPage); + + case RTR0MEMOBJTYPE_CONT: + return pMemFreeBSD->Core.u.Phys.PhysBase + ptoa(iPage); + case RTR0MEMOBJTYPE_RES_VIRT: default: return NIL_RTHCPHYS; --------------070004020305000508040709-- From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 03:34:06 2012 Return-Path: Delivered-To: freebsd-emulation@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F2231065670; Wed, 22 Feb 2012 03:34:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 310E38FC12; Wed, 22 Feb 2012 03:34:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1M3Y6Z3073850; Wed, 22 Feb 2012 03:34:06 GMT (envelope-from eadler@freefall.freebsd.org) Received: (from eadler@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1M3Y5RV073845; Wed, 22 Feb 2012 03:34:05 GMT (envelope-from eadler) Date: Wed, 22 Feb 2012 03:34:05 GMT Message-Id: <201202220334.q1M3Y5RV073845@freefall.freebsd.org> To: turutani@scphys.kyoto-u.ac.jp, eadler@FreeBSD.org, freebsd-emulation@FreeBSD.org From: eadler@FreeBSD.org Cc: Subject: Re: ports/165215: www/linux-f10-flashplugin11 is vulnerable X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 03:34:06 -0000 Synopsis: www/linux-f10-flashplugin11 is vulnerable State-Changed-From-To: open->closed State-Changed-By: eadler State-Changed-When: Wed Feb 22 03:34:05 UTC 2012 State-Changed-Why: Committed. Thanks! http://www.freebsd.org/cgi/query-pr.cgi?pr=165215 From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 03:40:02 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 1D15D106566C; Wed, 22 Feb 2012 03:40:02 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id C380414DE48; Wed, 22 Feb 2012 03:40:01 +0000 (UTC) Message-ID: <4F446391.4070101@FreeBSD.org> Date: Tue, 21 Feb 2012 19:40:01 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andriy Gapon References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> In-Reply-To: <4F442E1E.4010501@FreeBSD.org> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 03:40:02 -0000 On 02/21/2012 15:51, Andriy Gapon wrote: > Could you please substitute the attached patch file for the corresponding file > in the port and re-test the port? Good news, the kernel didn't panic. Bad news: supdrvGipCreate: failed to allocate the GIP page. rc=-8 vboxdrv: supdrvInitDevExt failed, rc=-8 module_register_init: MOD_LOAD (vboxdrv, 0xc66f33e0, 0) error 12 and although kldstat shows the module as loaded, and the control panel starts, when I try to launch a vm I get this: Kernel driver not installed (rc=-1908) Make sure the kernel module has been loaded successfully. hth, Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 09:20:54 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF96A1065673; Wed, 22 Feb 2012 09:20:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 606488FC0C; Wed, 22 Feb 2012 09:20:52 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA22974; Wed, 22 Feb 2012 11:20:51 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S08NX-000PQf-6K; Wed, 22 Feb 2012 11:20:51 +0200 Message-ID: <4F44B362.7000103@FreeBSD.org> Date: Wed, 22 Feb 2012 11:20:34 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Doug Barton References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> In-Reply-To: <4F446391.4070101@FreeBSD.org> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 09:20:54 -0000 on 22/02/2012 05:40 Doug Barton said the following: > On 02/21/2012 15:51, Andriy Gapon wrote: >> Could you please substitute the attached patch file for the corresponding file >> in the port and re-test the port? > > Good news, the kernel didn't panic. Bad news: > > supdrvGipCreate: failed to allocate the GIP page. rc=-8 > vboxdrv: supdrvInitDevExt failed, rc=-8 > module_register_init: MOD_LOAD (vboxdrv, 0xc66f33e0, 0) error 12 Yeah, I kind of expected something like this, because the original panic was in a memory allocation failure path. As to why the memory allocation fails I have no immediate insights. Maybe you genuinely don't have enough contiguous pages below 4GB boundary... Perhaps you can add a printf in src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c right after the vm_phys_alloc_contig() call to examine/validate its input parameters and return value. > and although kldstat shows the module as loaded, and the control panel > starts, when I try to launch a vm I get this: It's a long standing general FreeBSD issue that there is a disconnect between module loading and module initialization errors. > Kernel driver not installed (rc=-1908) > Make sure the kernel module has been loaded successfully. -- Andriy Gapon From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 09:26:24 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id EAD131065672; Wed, 22 Feb 2012 09:26:24 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id A2BA614F123; Wed, 22 Feb 2012 09:26:24 +0000 (UTC) Message-ID: <4F44B4BF.5070402@FreeBSD.org> Date: Wed, 22 Feb 2012 01:26:23 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andriy Gapon References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> In-Reply-To: <4F44B362.7000103@FreeBSD.org> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 09:26:25 -0000 On 02/22/2012 01:20, Andriy Gapon wrote: > on 22/02/2012 05:40 Doug Barton said the following: >> On 02/21/2012 15:51, Andriy Gapon wrote: >>> Could you please substitute the attached patch file for the corresponding file >>> in the port and re-test the port? >> >> Good news, the kernel didn't panic. Bad news: >> >> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >> vboxdrv: supdrvInitDevExt failed, rc=-8 >> module_register_init: MOD_LOAD (vboxdrv, 0xc66f33e0, 0) error 12 > > Yeah, I kind of expected something like this, because the original panic was in > a memory allocation failure path. > As to why the memory allocation fails I have no immediate insights. Maybe you > genuinely don't have enough contiguous pages below 4GB boundary... It's i386, no PAE, so you could be on to something. I do have more than 4G in the box though: real memory = 6442450944 (6144 MB) avail memory = 3148255232 (3002 MB) Meanwhile, the 4.0 version worked on this same system ... > Perhaps you can add a printf in > src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c right after the > vm_phys_alloc_contig() call to examine/validate its input parameters and return > value. patch? I am sort of short on time atm. Either way, thanks again for looking into it. -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 09:41:33 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69137106566B; Wed, 22 Feb 2012 09:41:33 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from groupware.itac.at (groupware.itac.at [91.205.172.99]) by mx1.freebsd.org (Postfix) with ESMTP id E6E3C8FC12; Wed, 22 Feb 2012 09:41:32 +0000 (UTC) Received: from home.bluelife.at (93.104.210.95) by groupware.itac.at (Axigen) with (AES256-SHA encrypted) ESMTPSA id 27382E; Wed, 22 Feb 2012 10:41:34 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Feb 2012 10:41:31 +0100 From: Bernhard Froehlich To: Doug Barton In-Reply-To: <4F44B4BF.5070402@FreeBSD.org> References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> Message-ID: <19b299e2e143bc8fa04b6f606539928f@bluelife.at> X-Sender: decke@FreeBSD.org User-Agent: Roundcube Webmail/0.7.1 X-AxigenSpam-Level: 1 X-CTCH-RefID: str=0001.0A0B0204.4F44B84B.020B,ss=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown Cc: freebsd-emulation@freebsd.org, FreeBSD ports list , Andriy Gapon Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 09:41:33 -0000 On 22.02.2012 10:26, Doug Barton wrote: > On 02/22/2012 01:20, Andriy Gapon wrote: >> on 22/02/2012 05:40 Doug Barton said the following: >>> On 02/21/2012 15:51, Andriy Gapon wrote: >>>> Could you please substitute the attached patch file for the >>>> corresponding file >>>> in the port and re-test the port? >>> >>> Good news, the kernel didn't panic. Bad news: >>> >>> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >>> vboxdrv: supdrvInitDevExt failed, rc=-8 >>> module_register_init: MOD_LOAD (vboxdrv, 0xc66f33e0, 0) error 12 >> >> Yeah, I kind of expected something like this, because the original >> panic was in >> a memory allocation failure path. >> As to why the memory allocation fails I have no immediate insights. >> Maybe you >> genuinely don't have enough contiguous pages below 4GB boundary... > > It's i386, no PAE, so you could be on to something. I do have more > than > 4G in the box though: > > real memory = 6442450944 (6144 MB) > avail memory = 3148255232 (3002 MB) > > Meanwhile, the 4.0 version worked on this same system ... The 4.0.16 version is still available as emulators/virtualbox-ose-legacy and doesn't include the memobj r0 patch so it should still work. (you will need to switch to devel/kBuild for that) -- Bernhard Froehlich http://www.bluelife.at/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 09:46:06 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 50263106566B; Wed, 22 Feb 2012 09:46:06 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 4F9951513BB; Wed, 22 Feb 2012 09:46:05 +0000 (UTC) Message-ID: <4F44B95D.8080106@FreeBSD.org> Date: Wed, 22 Feb 2012 01:46:05 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Bernhard Froehlich References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <19b299e2e143bc8fa04b6f606539928f@bluelife.at> In-Reply-To: <19b299e2e143bc8fa04b6f606539928f@bluelife.at> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@freebsd.org, Andriy Gapon , FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 09:46:06 -0000 On 02/22/2012 01:41, Bernhard Froehlich wrote: > The 4.0.16 version is still available as emulators/virtualbox-ose-legacy I know, that, but kind of beside the point, right? -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 09:57:05 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DFEC1065673; Wed, 22 Feb 2012 09:57:05 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from groupware.itac.at (groupware.itac.at [91.205.172.99]) by mx1.freebsd.org (Postfix) with ESMTP id 98EEA8FC18; Wed, 22 Feb 2012 09:57:04 +0000 (UTC) Received: from home.bluelife.at (93.104.210.95) by groupware.itac.at (Axigen) with (AES256-SHA encrypted) ESMTPSA id 31AEF6; Wed, 22 Feb 2012 10:57:06 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Feb 2012 10:57:03 +0100 From: Bernhard Froehlich To: Doug Barton In-Reply-To: <4F44B95D.8080106@FreeBSD.org> References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <19b299e2e143bc8fa04b6f606539928f@bluelife.at> <4F44B95D.8080106@FreeBSD.org> Message-ID: <6a982175d926f43f6978702c2772ea8c@bluelife.at> X-Sender: decke@FreeBSD.org User-Agent: Roundcube Webmail/0.7.1 X-AxigenSpam-Level: 1 X-CTCH-RefID: str=0001.0A0B0201.4F44BBEF.025B,ss=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown Cc: freebsd-emulation@freebsd.org, Andriy Gapon , FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 09:57:05 -0000 On 22.02.2012 10:46, Doug Barton wrote: > On 02/22/2012 01:41, Bernhard Froehlich wrote: >> The 4.0.16 version is still available as >> emulators/virtualbox-ose-legacy > > I know, that, but kind of beside the point, right? Yes, but some people depend on a working virtualbox and that is their safety net until the problem is sorted out. -- Bernhard Froehlich http://www.bluelife.at/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 10:24:12 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12842106564A; Wed, 22 Feb 2012 10:24:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4E2548FC08; Wed, 22 Feb 2012 10:24:09 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id MAA24002; Wed, 22 Feb 2012 12:24:08 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S09Ml-000PSe-S2; Wed, 22 Feb 2012 12:24:08 +0200 Message-ID: <4F44C228.5030507@FreeBSD.org> Date: Wed, 22 Feb 2012 12:23:36 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Doug Barton References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> In-Reply-To: <4F44B4BF.5070402@FreeBSD.org> X-Enigmail-Version: 1.3.5 Content-Type: multipart/mixed; boundary="------------060304060006020605090701" Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 10:24:12 -0000 This is a multi-part message in MIME format. --------------060304060006020605090701 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit on 22/02/2012 11:26 Doug Barton said the following: > Meanwhile, the 4.0 version worked on this same system ... The attached patched should try to grab the memory harder. -- Andriy Gapon --------------060304060006020605090701 Content-Type: text/plain; name="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-12-19 15:01:31.000000000 +0200 +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2012-02-22 12:21:05.833875547 +0200 @@ -5,6 +5,7 @@ /* * Copyright (c) 2007 knut st. osmundsen + * Copyright (c) 2011 Andriy Gapon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -54,23 +55,8 @@ /** The core structure. */ RTR0MEMOBJINTERNAL Core; /** Type dependent data */ - union - { - /** Non physical memory allocations */ - struct - { - /** The VM object associated with the allocation. */ - vm_object_t pObject; - } NonPhys; - /** Physical memory allocations */ - struct - { - /** Number of pages */ - uint32_t cPages; - /** Array of pages - variable */ - vm_page_t apPages[1]; - } Phys; - } u; + /** The VM object associated with the allocation. */ + vm_object_t pObject; } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; @@ -125,25 +111,14 @@ switch (pMemFreeBSD->Core.enmType) { - case RTR0MEMOBJTYPE_CONT: - contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOBJ); - break; - case RTR0MEMOBJTYPE_PAGE: + case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_CONT: { rc = vm_map_remove(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); - - vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - } - vm_page_unlock_queues(); break; } @@ -165,8 +140,8 @@ case RTR0MEMOBJTYPE_RES_VIRT: { vm_map_t pMap = kernel_map; - if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) - pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map; + if (pMemFreeBSD->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS) + pMap = &((struct proc *)pMemFreeBSD->Core.u.ResVirt.R0Process)->p_vmspace->vm_map; rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -180,7 +155,6 @@ if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) pMap = &((struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process)->p_vmspace->vm_map; - rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -191,26 +165,21 @@ case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) + for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); + pPage != NULL; + pPage = vm_page_next(pPage)) { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; vm_page_unwire(pPage, 0); - vm_page_free(pPage); } vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + vm_object_deallocate(pMemFreeBSD->pObject); break; } -#ifdef USE_KMEM_ALLOC_ATTR - case RTR0MEMOBJTYPE_LOW: - { - kmem_free(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb); - break; - } -#else - case RTR0MEMOBJTYPE_LOW: /* unused */ -#endif default: AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); return VERR_INTERNAL_ERROR; @@ -220,183 +189,183 @@ } -DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) -{ - int rc; - size_t cPages = cb >> PAGE_SHIFT; - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), - RTR0MEMOBJTYPE_PAGE, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - pMemFreeBSD->u.Phys.cPages = cPages; +static vm_page_t FreeBSDContigPhysAllocHelper(vm_object_t pObject, vm_pindex_t iPIndex, + u_long cPages, vm_paddr_t VmPhysAddrHigh, + u_long uAlignment, bool fWire) +{ + vm_page_t pPages; + int tries = 0; +#if __FreeBSD_version > 1000000 + int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY; + + if (fWire) + flags |= VM_ALLOC_WIRED; + while (1) + { + VM_OBJECT_LOCK(pObject); + pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); + VM_OBJECT_UNLOCK(pObject); + if (pPages || tries >= 1) + break; + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); + tries++; + } + return pPages; +#else - vm_offset_t MapAddress = vm_map_min(kernel_map); - rc = vm_map_find(kernel_map, /* map */ - NULL, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - TRUE, /* find_space */ - fExecutable /* protection */ - ? VM_PROT_ALL - : VM_PROT_RW, - VM_PROT_ALL, /* max(_prot) */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) + while (1) { - rc = VINF_SUCCESS; - - for (size_t iPage = 0; iPage < cPages; iPage++) + pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); + if (pPages || tries >= 1) + break; + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); + tries++; + } + if (!pPages) + return pPages; + VM_OBJECT_LOCK(pObject); + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = pPages + iPage; + vm_page_insert(pPage, pObject, iPIndex + iPage); + pPage->valid = VM_PAGE_BITS_ALL; + if (fWire) { - vm_page_t pPage; + pPage->wire_count = 1; + atomic_add_int(&cnt.v_wire_count, 1); + } + } + VM_OBJECT_UNLOCK(pObject); + return pPages; +#endif +} - pPage = vm_page_alloc(NULL, iPage, - VM_ALLOC_SYSTEM | - VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); +static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, + vm_paddr_t VmPhysAddrHigh, u_long uAlignment, + bool fContiguous, bool fWire) +{ + if (fContiguous) + { + if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL) + return VINF_SUCCESS; + else + return VERR_NO_MEMORY; + } - if (!pPage) + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire); + if (!pPage) + { + /* Free all allocated pages */ + VM_OBJECT_LOCK(pObject); + while (iPage-- > 0) { - /* - * Out of pages - * Remove already allocated pages - */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); + pPage = vm_page_lookup(pObject, iPage); + vm_page_lock_queues(); + if (fWire) vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; + vm_page_free(pPage); + vm_page_unlock_queues(); } - - pPage->valid = VM_PAGE_BITS_ALL; - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; + VM_OBJECT_UNLOCK(pObject); + return VERR_NO_MEMORY; } + } + return VINF_SUCCESS; +} - if (rc == VINF_SUCCESS) - { - vm_offset_t AddressDst = MapAddress; +static int FreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable, + vm_paddr_t VmPhysAddrHigh, bool fContiguous) +{ + int rc; + size_t cPages = atop(pMemFreeBSD->Core.cb); - for (size_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + vm_offset_t MapAddress = vm_map_min(kernel_map); - MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage, - fExecutable - ? VM_PROT_ALL - : VM_PROT_RW, - TRUE); + // no additional object reference for auto-deallocation upon unmapping + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); - AddressDst += PAGE_SIZE; - } + if (rc == KERN_SUCCESS) + { + rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, PAGE_SIZE, fContiguous, false); + if (RT_SUCCESS(rc)) + { + vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); /* Store start address */ pMemFreeBSD->Core.pv = (void *)MapAddress; - *ppMem = &pMemFreeBSD->Core; return VINF_SUCCESS; } - } - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ - rtR0MemObjDelete(&pMemFreeBSD->Core); + vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb); + } + else + { + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + vm_object_deallocate(pMemFreeBSD->pObject); + } return rc; } - -DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { -#ifdef USE_KMEM_ALLOC_ATTR - /* - * Use kmem_alloc_attr, fExectuable is not needed because the - * memory will be executable by default - */ - NOREF(fExecutable); - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_PAGE, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->Core.pv = (void *)kmem_alloc_attr(kernel_map, /* Kernel */ - cb, /* Amount */ - M_ZERO, /* Zero memory */ - 0, /* Low physical address */ - _4G - PAGE_SIZE, /* Highest physical address */ - VM_MEMATTR_DEFAULT); /* Default memory attributes */ - if (!pMemFreeBSD->Core.pv) - return VERR_NO_MEMORY; - - *ppMem = &pMemFreeBSD->Core; - - return VINF_SUCCESS; -#else - /* - * Try a Alloc first and see if we get luck, if not try contigmalloc. - * Might wish to try find our own pages or something later if this - * turns into a problemspot on AMD64 boxes. - */ - int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable); - if (RT_SUCCESS(rc)) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false); + if (RT_FAILURE(rc)) { - size_t iPage = cb >> PAGE_SHIFT; - while (iPage-- > 0) - if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE_SIZE)) - { - RTR0MemObjFree(*ppMem, false); - *ppMem = NULL; - rc = VERR_NO_MEMORY; - break; - } + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - if (RT_FAILURE(rc)) - rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); + + *ppMem = &pMemFreeBSD->Core; return rc; -#endif } -DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_LOW, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - PAGE_SIZE, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, false); + if (RT_FAILURE(rc)) { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - NOREF(fExecutable); - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; + *ppMem = &pMemFreeBSD->Core; + return rc; } -static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - pPage->wire_count = 1; - pPage->pindex = iPage; - pPage->act_count = 0; - pPage->oflags = 0; - pPage->flags = PG_UNMANAGED; - atomic_add_int(&cnt.v_wire_count, 1); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_CONT, NULL, cb); + if (!pMemFreeBSD) + return VERR_NO_MEMORY; + + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G, true); + if (RT_FAILURE(rc)) + { + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; + } + + pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); + *ppMem = &pMemFreeBSD->Core; + return rc; } @@ -405,69 +374,36 @@ RTHCPHYS PhysHighest, size_t uAlignment, bool fContiguous) { - int rc = VINF_SUCCESS; - uint32_t cPages = cb >> PAGE_SHIFT; + uint32_t cPages = atop(cb); vm_paddr_t VmPhysAddrHigh; /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->u.Phys.cPages = cPages; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); if (PhysHighest != NIL_RTHCPHYS) VmPhysAddrHigh = PhysHighest; else VmPhysAddrHigh = ~(vm_paddr_t)0; - if (fContiguous) - { - vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); - - if (pPage) - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - rtR0MemObjFreeBSDPhysPageInit(&pPage[iPage], iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = &pPage[iPage]; - } - else - rc = VERR_NO_MEMORY; - } - else - { - /* Allocate page by page */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0); - - if (!pPage) - { - /* Free all allocated pages */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; - } - rtR0MemObjFreeBSDPhysPageInit(pPage, iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; - } - } + int rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, uAlignment, fContiguous, true); - if (RT_FAILURE(rc)) + if (RT_FAILURE(rc)) { + vm_object_deallocate(pMemFreeBSD->pObject); rtR0MemObjDelete(&pMemFreeBSD->Core); + } else { - if (enmType == RTR0MEMOBJTYPE_PHYS) + if (fContiguous) { - pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[0]); + Assert(enmType == RTR0MEMOBJTYPE_PHYS); + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.fAllocated = true; } @@ -480,42 +416,13 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true); -#else - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - uAlignment, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) - { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; - } - - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; -#endif } DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false); -#else - return VERR_NOT_SUPPORTED; -#endif } @@ -625,49 +532,41 @@ if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* - * Allocate an empty VM object and map it into the requested map. - */ - pMemFreeBSD->u.NonPhys.pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT); - if (pMemFreeBSD->u.NonPhys.pObject) + vm_offset_t MapAddress = pvFixed != (void *)-1 + ? (vm_offset_t)pvFixed + : vm_map_min(pMap); + if (pvFixed != (void *)-1) + vm_map_remove(pMap, + MapAddress, + MapAddress + cb); + + rc = vm_map_find(pMap, /* map */ + NULL, /* object */ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ + VM_PROT_ALL, /* max(_prot) ?? */ + 0); /* cow (copy-on-write) */ + if (rc == KERN_SUCCESS) { - vm_offset_t MapAddress = pvFixed != (void *)-1 - ? (vm_offset_t)pvFixed - : vm_map_min(pMap); - if (pvFixed != (void *)-1) - vm_map_remove(pMap, - MapAddress, - MapAddress + cb); - - rc = vm_map_find(pMap, /* map */ - pMemFreeBSD->u.NonPhys.pObject, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - pvFixed == (void *)-1, /* find_space */ - VM_PROT_NONE, /* protection */ - VM_PROT_ALL, /* max(_prot) ?? */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) + if (R0Process != NIL_RTR0PROCESS) { - if (R0Process != NIL_RTR0PROCESS) - { - rc = vm_map_inherit(pMap, - MapAddress, - MapAddress + cb, - VM_INHERIT_SHARE); - AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - } - pMemFreeBSD->Core.pv = (void *)MapAddress; - pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rc = vm_map_inherit(pMap, + MapAddress, + MapAddress + cb, + VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); } - vm_object_deallocate(pMemFreeBSD->u.NonPhys.pObject); - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + pMemFreeBSD->Core.pv = (void *)MapAddress; + pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; } - else - rc = VERR_NO_MEMORY; + + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ rtR0MemObjDelete(&pMemFreeBSD->Core); return rc; @@ -690,7 +589,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub) { - AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); +// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); /* @@ -699,21 +598,68 @@ if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; -/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/source/i386/i386/pmap.c?v=RELENG62#L2860) */ -/** @todo finish the implementation. */ + int rc; + PRTR0MEMOBJFREEBSD pMemToMapFreeBSD = (PRTR0MEMOBJFREEBSD)pMemToMap; - return VERR_NOT_SUPPORTED; + /* calc protection */ + vm_prot_t ProtectionFlags = 0; + if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) + ProtectionFlags = VM_PROT_NONE; + if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ) + ProtectionFlags |= VM_PROT_READ; + if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE) + ProtectionFlags |= VM_PROT_WRITE; + if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC) + ProtectionFlags |= VM_PROT_EXECUTE; + + vm_offset_t Addr = vm_map_min(kernel_map); + if (cbSub == 0) + cbSub = pMemToMap->cb - offSub; + + vm_object_reference(pMemToMapFreeBSD->pObject); + rc = vm_map_find(kernel_map, /* Map to insert the object in */ + pMemToMapFreeBSD->pObject, /* Object to map */ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ + 0); /* copy-on-write and similar flags */ + + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbSub, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); + + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(RTR0MEMOBJFREEBSD), + RTR0MEMOBJTYPE_MAPPING, + (void *)Addr, + cbSub); + if (pMemFreeBSD) + { + Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr); + pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; + } + rc = vm_map_remove(kernel_map, Addr, Addr + cbSub); + AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); + } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); + + return VERR_NO_MEMORY; } -/* see http://markmail.org/message/udhq33tefgtyfozs */ -DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, + unsigned fProt, RTR0PROCESS R0Process) { /* * Check for unsupported stuff. */ AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); - AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; @@ -734,62 +680,38 @@ ProtectionFlags |= VM_PROT_EXECUTE; /* calc mapping address */ - PROC_LOCK(pProc); - vm_offset_t AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); - PROC_UNLOCK(pProc); + vm_offset_t AddrR3; + if (R3PtrFixed == (RTR3PTR)-1) + { + // is this needed? + PROC_LOCK(pProc); + AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); + PROC_UNLOCK(pProc); + } + else + AddrR3 = (vm_offset_t)R3PtrFixed; - /* Insert the object in the map. */ + /* Insert the pObject in the map. */ + vm_object_reference(pMemToMapFreeBSD->pObject); rc = vm_map_find(pProcMap, /* Map to insert the object in */ - NULL, /* Object to map */ + pMemToMapFreeBSD->pObject, /* Object to map */ 0, /* Start offset in the object */ &AddrR3, /* Start address IN/OUT */ pMemToMap->cb, /* Size of the mapping */ - TRUE, /* Whether a suitable address should be searched for first */ + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ ProtectionFlags, /* protection flags */ VM_PROT_ALL, /* Maximum protection flags */ - 0); /* Copy on write */ + 0); /* copy-on-write and similar flags */ - /* Map the memory page by page into the destination map. */ if (rc == KERN_SUCCESS) { - size_t cPages = pMemToMap->cb >> PAGE_SHIFT;; - pmap_t pPhysicalMap = pProcMap->pmap; - vm_offset_t AddrR3Dst = AddrR3; - - if ( pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS - || pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS_NC - || pMemToMap->enmType == RTR0MEMOBJTYPE_PAGE) - { - /* Mapping physical allocations */ - Assert(cPages == pMemToMapFreeBSD->u.Phys.cPages); + rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - /* Insert the memory page by page into the mapping. */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemToMapFreeBSD->u.Phys.apPages[iPage]; + rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - } - } - else - { - /* Mapping cont or low memory types */ - vm_offset_t AddrToMap = (vm_offset_t)pMemToMap->pv; - - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = PHYS_TO_VM_PAGE(vtophys(AddrToMap)); - - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - AddrToMap += PAGE_SIZE; - } - } - } - - if (RT_SUCCESS(rc)) - { /* * Create a mapping object for it. */ @@ -805,9 +727,11 @@ return VINF_SUCCESS; } - rc = vm_map_remove(pProcMap, ((vm_offset_t)AddrR3), ((vm_offset_t)AddrR3) + pMemToMap->cb); + rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb); AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); return VERR_NO_MEMORY; } @@ -855,49 +779,47 @@ return NIL_RTHCPHYS; } - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Lock.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } case RTR0MEMOBJTYPE_MAPPING: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) { struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } return vtophys(pb); } - case RTR0MEMOBJTYPE_CONT: - return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); - - case RTR0MEMOBJTYPE_PHYS: - return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT); - case RTR0MEMOBJTYPE_PAGE: - case RTR0MEMOBJTYPE_PHYS_NC: - return VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[iPage]); - -#ifdef USE_KMEM_ALLOC_ATTR case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_PHYS_NC: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); - return vtophys(pb); + RTHCPHYS addr; + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + return addr; } -#else - case RTR0MEMOBJTYPE_LOW: -#endif + + case RTR0MEMOBJTYPE_PHYS: + return pMemFreeBSD->Core.u.Cont.Phys + ptoa(iPage); + + case RTR0MEMOBJTYPE_CONT: + return pMemFreeBSD->Core.u.Phys.PhysBase + ptoa(iPage); + case RTR0MEMOBJTYPE_RES_VIRT: default: return NIL_RTHCPHYS; --------------060304060006020605090701-- From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 10:48:03 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by hub.freebsd.org (Postfix) with ESMTP id 062B81065672; Wed, 22 Feb 2012 10:48:03 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id BA84E14E75E; Wed, 22 Feb 2012 10:48:02 +0000 (UTC) Message-ID: <4F44C7E2.3020801@FreeBSD.org> Date: Wed, 22 Feb 2012 02:48:02 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andriy Gapon References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <4F44C228.5030507@FreeBSD.org> In-Reply-To: <4F44C228.5030507@FreeBSD.org> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 10:48:03 -0000 On 02/22/2012 02:23, Andriy Gapon wrote: > The attached patched should try to grab the memory harder. Same result, different memory address: supdrvGipCreate: failed to allocate the GIP page. rc=-8 vboxdrv: supdrvInitDevExt failed, rc=-8 module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 ... and not sure it's relevant, but both times I've tried loading these modules it has killed my sound. /dev/mixer goes away, and I have to reboot to get it back. This has never happened before, so I'm pretty sure it's connected. Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 15:07:28 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 592B9106564A; Wed, 22 Feb 2012 15:07:28 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 115998FC1B; Wed, 22 Feb 2012 15:07:27 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q1MEsgSR077264; Wed, 22 Feb 2012 07:54:42 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q1MEsgus077261; Wed, 22 Feb 2012 07:54:42 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Wed, 22 Feb 2012 07:54:42 -0700 (MST) From: Warren Block To: Doug Barton In-Reply-To: <4F44B4BF.5070402@FreeBSD.org> Message-ID: References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Wed, 22 Feb 2012 07:54:43 -0700 (MST) Cc: freebsd-emulation@freebsd.org, FreeBSD ports list , Andriy Gapon Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 15:07:28 -0000 On Wed, 22 Feb 2012, Doug Barton wrote: > On 02/22/2012 01:20, Andriy Gapon wrote: >> on 22/02/2012 05:40 Doug Barton said the following: >>> On 02/21/2012 15:51, Andriy Gapon wrote: >>>> Could you please substitute the attached patch file for the corresponding file >>>> in the port and re-test the port? >>> >>> Good news, the kernel didn't panic. Bad news: >>> >>> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >>> vboxdrv: supdrvInitDevExt failed, rc=-8 >>> module_register_init: MOD_LOAD (vboxdrv, 0xc66f33e0, 0) error 12 >> >> Yeah, I kind of expected something like this, because the original panic was in >> a memory allocation failure path. >> As to why the memory allocation fails I have no immediate insights. Maybe you >> genuinely don't have enough contiguous pages below 4GB boundary... > > It's i386, no PAE, so you could be on to something. I do have more than > 4G in the box though: > > real memory = 6442450944 (6144 MB) > avail memory = 3148255232 (3002 MB) Same error here on i386 with only 2G memory. From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 15:10:50 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A435F106564A; Wed, 22 Feb 2012 15:10:50 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 586078FC08; Wed, 22 Feb 2012 15:10:50 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q1MFAnDG077342; Wed, 22 Feb 2012 08:10:49 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q1MFAnpk077339; Wed, 22 Feb 2012 08:10:49 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Wed, 22 Feb 2012 08:10:49 -0700 (MST) From: Warren Block To: Andriy Gapon In-Reply-To: <4F44C228.5030507@FreeBSD.org> Message-ID: References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <4F44C228.5030507@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII; format=flowed Content-ID: X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Wed, 22 Feb 2012 08:10:49 -0700 (MST) Cc: freebsd-emulation@freebsd.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 15:10:50 -0000 On Wed, 22 Feb 2012, Andriy Gapon wrote: > on 22/02/2012 11:26 Doug Barton said the following: >> Meanwhile, the 4.0 version worked on this same system ... > > The attached patched should try to grab the memory harder. No visible difference here, sorry. From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 18:41:24 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3F9D106566C; Wed, 22 Feb 2012 18:41:24 +0000 (UTC) (envelope-from naylor.b.david@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 51DD98FC19; Wed, 22 Feb 2012 18:41:23 +0000 (UTC) Received: by werm13 with SMTP id m13so360989wer.13 for ; Wed, 22 Feb 2012 10:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:mime-version:content-type :content-transfer-encoding:message-id; bh=1vPdWGZunQyQP0Zugokw95kcmmhu3azMnP8mS7R/Q3s=; b=Oh4cJFpCdxKX1fEJ2UezEi++ND1jRHNHVzH20X5+R6LRA1NH0xw+ikn7WNLZgu/kYB Ov99QddQ1enVcoITsBCq5j27V4fRqQU8A4uCY6Cs4hrA7/Sumjcz/dZJ24HfLdxQgigr Hlx/itWOUvD7bCapRlNQFENhI5GauGPLrctJ8= Received: by 10.180.102.35 with SMTP id fl3mr31162626wib.22.1329936083168; Wed, 22 Feb 2012 10:41:23 -0800 (PST) Received: from ultra.dg ([41.48.27.21]) by mx.google.com with ESMTPS id m8sm74721447wia.11.2012.02.22.10.41.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 22 Feb 2012 10:41:22 -0800 (PST) From: David Naylor To: freebsd-emulation@freebsd.org, freebsd-questions@freebsd.org Date: Wed, 22 Feb 2012 20:44:11 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-RC1; KDE/4.7.1; amd64; ; ) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1799756.gC4bI1mq1r"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201202222044.15474.naylor.b.david@gmail.com> X-Mailman-Approved-At: Wed, 22 Feb 2012 18:53:30 +0000 Cc: Subject: Wine-fbsd64 updated to 1.4.rc4 (32bit Wine for 64bit FreeBSD) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 18:41:25 -0000 --nextPart1799756.gC4bI1mq1r Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, Packages [1] for wine-fbsd64-1.4.rc4 have been uploaded to mediafire [2]. There are many reports that wine does not work with a clang compiled world (help in fixing this problem is appreciated as it affects quite a few users). The patch [3] for nVidia users is now included in the package and is run on installation (if the relevant files are accessible). Please read the installation messages for further information. Regards, David [1] MD5 (freebsd8/wine-fbsd64-1.4.rc4,1.tbz) = aa6a8af686c8df34d14ccfaa8d8f2f9e MD5 (freebsd9/wine-fbsd64-1.4.rc4,1.txz) = 582b3b70cfb77008d753e676cdef52e2 [2] http://www.mediafire.com/wine_fbsd64 [3] The patch is located at /usr/local/share/wine/patch-nvidia.sh --nextPart1799756.gC4bI1mq1r Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEABECAAYFAk9FN38ACgkQUaaFgP9pFrK/kwCfZDEzQNDa6fDSgG7qlAYaLE8E E1wAoIuT68g4u1jAQpu/tdbKoDa31hsC =mGEw -----END PGP SIGNATURE----- --nextPart1799756.gC4bI1mq1r-- From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 20:22:31 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 049B6106567D; Wed, 22 Feb 2012 20:22:31 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from smtp-out-04.shaw.ca (smtp-out-04.shaw.ca [64.59.134.12]) by mx1.freebsd.org (Postfix) with ESMTP id 972278FC0A; Wed, 22 Feb 2012 20:22:30 +0000 (UTC) Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd5ml3no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd5mo1no-svcs.prod.shaw.ca with ESMTP; 22 Feb 2012 13:07:28 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=TH029eDfZHqIRue7hhxWRjZ7JL4S9vo/jJY5vkv2d5E= c=1 sm=1 a=hunnjcbhBuQA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10 a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17 a=s1O25tkdAAAA:8 a=BWvPGDcYAAAA:8 a=6I5d2MoRAAAA:8 a=yuCXvu-k4FtNsRzlQ_AA:9 a=CjuIK1q_8ugA:10 a=OyOq_G8mXAEA:10 a=V7tsTZBp22UA:10 a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119]) by pd5ml3no-dmz.prod.shaw.ca with ESMTP; 22 Feb 2012 13:07:28 -0700 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTP id 3984E46B54; Wed, 22 Feb 2012 12:07:27 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q1MK7R9n003818; Wed, 22 Feb 2012 12:07:27 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201202222007.q1MK7R9n003818@slippy.cwsent.com> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Warren Block In-Reply-To: Message from Warren Block of "Wed, 22 Feb 2012 08:10:49 MST." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2012 12:07:27 -0800 Cc: freebsd-emulation@freebsd.org, FreeBSD ports list , Andriy Gapon Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cy Schubert List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 20:22:31 -0000 In message , Warren Block writ es: > On Wed, 22 Feb 2012, Andriy Gapon wrote: > > > on 22/02/2012 11:26 Doug Barton said the following: > >> Meanwhile, the 4.0 version worked on this same system ... > > > > The attached patched should try to grab the memory harder. > > No visible difference here, sorry. Same on my systems (8.2 and 9.0). My main server (9.0 dual core AMD X2) panics with a kernel page fault and hangs. My laptop (9.0 Penium-M) and my testbed (8.2 and 9.0 single core AMD X2) panic like my laptop, no messages, just an immediate reboot. (Something does flash up on the screen but it's there for milliseconds. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 20:59:42 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from hub.freebsd.org (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by hub.freebsd.org (Postfix) with ESMTP id 26EA51065674; Wed, 22 Feb 2012 20:59:41 +0000 (UTC) (envelope-from tabthorpe@FreeBSD.org) Date: Wed, 22 Feb 2012 15:59:40 -0500 From: Thomas Abthorpe To: Mark Linimon Message-ID: <20120222205940.GR20266@hub.freebsd.org> References: <20120116201117.GA90568@dormouse.experts-exchange.com> <4f15924a.7CUoXdl4yduNUIqM%perryh@pluto.rain.com> <20120118222747.GA372@lonesome.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wxIXENaY2CYUgF8u" Content-Disposition: inline In-Reply-To: <20120118222747.GA372@lonesome.com> X-URL: http://www.goodking.org/ X-PGP-Key: http://people.freebsd.org/~tabthorpe/tabthorpe.asc X-PGP-Key-ID: 0xA473C990 X-PGP-Key-Fingerprint: D883 2D7C EB78 944A 69FC 36A6 D937 1097 A473 C990 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: emulation@freebsd.org, ports@freebsd.org, jgh@freebsd.org, portmgr@FreeBSD.org, Chris Rees Subject: Re: MASTER_SITE_FEDORA_LINUX in bsd.sites.mk X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 20:59:42 -0000 --wxIXENaY2CYUgF8u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 18, 2012 at 04:27:47PM -0600, Mark Linimon wrote: > On Wed, Jan 18, 2012 at 09:09:10PM +0000, Chris Rees wrote: > > I worry about the ethics of 'stealing' Fedora's bandwidth with other > > people's ports; we should only be using their mirrors if it's explicitly > > developed by Fedora. >=20 > Correct. dougb has pointed this out before and no one has taken the > cycles to go act on it. Consider this a task that needs volunteers. >=20 > (A similiar caveat applies to the Debian and NetBSD sites; I believe > it was Debian he flagged previously.) >=20 > mcl I have engaged the mirror maintainers and infrastructure people at Gentoo and Debian on this matter, and for the sake of completeness our own FreeBSD mirror admins. The short response is, "That is fine, just do it". Yay, there was much rejoicing in the land, end of story :) The longer part of this, is that we are all opensource-minded people, publicly sharing has been a part of our genetics since inception. It is ok to ustilise the public facing mirrors, just please do not abuse them. Another common thread I got from the maintainers that contacted me back was that they mirror for multiple projects on their site anyway, and that the additional traffic was nominal at best. One fellow told me he was in active competition for throughput with another mirror, and welcomed the extra hits he was getting. Through all of this, I was asked, particularly by the Debian folks, please ask permission of mirror maintainer before you list their mirror in the master list. You will see my recent commit to bsd.sites.mk, I added 4 more volunteers to the Debian list, http://www.freebsd.org/cgi/cvsweb.cgi/ports/Mk/bsd.sites.mk.diff?r1=3D1.558= ;r2=3D1.559 I hope this helps clarify the usage of other project mirrors. Thomas --=20 Thomas Abthorpe | FreeBSD Committer tabthorpe@FreeBSD.org | http://people.freebsd.org/~tabthorpe --wxIXENaY2CYUgF8u Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iQEcBAEBAgAGBQJPRVc8AAoJENk3EJekc8mQvLAH/1Gst2FfEI16VF2j+T91q2/t 0/GPtcsTgsNdyNOzqT50EiM6boVL95I6Jsi6muk1wfqeD52qX981RosgPM+5J8N7 QU7mYOZ+xSjs6dxYUdz4w7L9chXbEmfVTyj3cIwOGTa1Te2T4myIz2LNtIuhOabf was3hqaVfhgNOyIbQO2fq3PE7evMfv3KstRIXJ14chM6NBPz2IEBx9jojTe01nCT 1dH7zxERJc9l3g4AofPfGhYBEyACsjz6wP6NTD8Go4wuTq8XVaXRkll+TuPnnnJD 6MbkWHRHOKdp8SUjYnuWSUTX+ZIG27g1EkVTmBoCaqScNzZQ8Kg+AHrMnaO+R/Q= =R0kY -----END PGP SIGNATURE----- --wxIXENaY2CYUgF8u-- From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 22:11:22 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B5B0106566B; Wed, 22 Feb 2012 22:11:22 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from groupware.itac.at (groupware.itac.at [91.205.172.99]) by mx1.freebsd.org (Postfix) with ESMTP id 18BC78FC0C; Wed, 22 Feb 2012 22:11:21 +0000 (UTC) Received: from home.bluelife.at (93.104.210.95) by groupware.itac.at (Axigen) with (AES256-SHA encrypted) ESMTPSA id 1E17AE; Wed, 22 Feb 2012 23:11:24 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 22 Feb 2012 23:11:20 +0100 From: Bernhard Froehlich To: Cy Schubert In-Reply-To: <201202222007.q1MK7R9n003818@slippy.cwsent.com> References: <201202222007.q1MK7R9n003818@slippy.cwsent.com> Message-ID: X-Sender: decke@FreeBSD.org User-Agent: Roundcube Webmail/0.7.1 X-AxigenSpam-Level: 1 X-CTCH-RefID: str=0001.0A0B0208.4F456808.0155,ss=1,fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown Cc: Andriy Gapon , freebsd-emulation@freebsd.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 22:11:22 -0000 On 22.02.2012 21:07, Cy Schubert wrote: > In message , Warren > Block > writ > es: >> On Wed, 22 Feb 2012, Andriy Gapon wrote: >> >> > on 22/02/2012 11:26 Doug Barton said the following: >> >> Meanwhile, the 4.0 version worked on this same system ... >> > >> > The attached patched should try to grab the memory harder. >> >> No visible difference here, sorry. > > Same on my systems (8.2 and 9.0). My main server (9.0 dual core AMD > X2) > panics with a kernel page fault and hangs. My laptop (9.0 Penium-M) > and my > testbed (8.2 and 9.0 single core AMD X2) panic like my laptop, no > messages, > just an immediate reboot. (Something does flash up on the screen but > it's > there for milliseconds. We decided to backout the patch until this problem is solved. Commit was done a few minutes ago. -- Bernhard Froehlich http://www.bluelife.at/ From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 22:42:46 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 033A71065670; Wed, 22 Feb 2012 22:42:46 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id 883EB8FC15; Wed, 22 Feb 2012 22:42:45 +0000 (UTC) Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd6ml3no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 22 Feb 2012 15:42:44 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=gFGh1ScE7ROJHT2jhivHYaSHya8441O0LZB7wkhlVyo= c=1 sm=1 a=hunnjcbhBuQA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10 a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17 a=s1O25tkdAAAA:8 a=BWvPGDcYAAAA:8 a=6I5d2MoRAAAA:8 a=76L66ItsK93MbB67E0kA:9 a=CjuIK1q_8ugA:10 a=OyOq_G8mXAEA:10 a=V7tsTZBp22UA:10 a=SV7veod9ZcQA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119]) by pd6ml3no-dmz.prod.shaw.ca with ESMTP; 22 Feb 2012 15:42:44 -0700 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTP id 44F3046B54; Wed, 22 Feb 2012 14:42:41 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q1MMgfV5008691; Wed, 22 Feb 2012 14:42:41 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201202222242.q1MMgfV5008691@slippy.cwsent.com> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Bernhard Froehlich In-Reply-To: Message from Bernhard Froehlich of "Wed, 22 Feb 2012 23:11:20 +0100." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2012 14:42:41 -0800 Cc: Doug Barton , Andriy Gapon , freebsd-emulation@FreeBSD.org, FreeBSD ports list , Cy Schubert Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cy Schubert List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 22:42:46 -0000 In message , Bernhard Froehlich w rites: > On 22.02.2012 21:07, Cy Schubert wrote: > > In message , Warren > > Block > > writ > > es: > >> On Wed, 22 Feb 2012, Andriy Gapon wrote: > >> > >> > on 22/02/2012 11:26 Doug Barton said the following: > >> >> Meanwhile, the 4.0 version worked on this same system ... > >> > > >> > The attached patched should try to grab the memory harder. > >> > >> No visible difference here, sorry. > > > > Same on my systems (8.2 and 9.0). My main server (9.0 dual core AMD > > X2) > > panics with a kernel page fault and hangs. My laptop (9.0 Penium-M) > > and my > > testbed (8.2 and 9.0 single core AMD X2) panic like my laptop, no > > messages, > > just an immediate reboot. (Something does flash up on the screen but > > it's > > there for milliseconds. > > We decided to backout the patch until this problem is solved. Commit > was done > a few minutes ago. Thanks. That fixed it. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org From owner-freebsd-emulation@FreeBSD.ORG Wed Feb 22 23:32:27 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAA121065672; Wed, 22 Feb 2012 23:32:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E942B8FC16; Wed, 22 Feb 2012 23:32:25 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA06816; Thu, 23 Feb 2012 01:32:24 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S0Lfb-000Pxm-CF; Thu, 23 Feb 2012 01:32:23 +0200 Message-ID: <4F457AE8.4090708@FreeBSD.org> Date: Thu, 23 Feb 2012 01:31:52 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Doug Barton , decke@FreeBSD.org References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <4F44C228.5030507@FreeBSD.org> <4F44C7E2.3020801@FreeBSD.org> In-Reply-To: <4F44C7E2.3020801@FreeBSD.org> X-Enigmail-Version: 1.3.5 Content-Type: multipart/mixed; boundary="------------080309080104030002060603" Cc: freebsd-emulation@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2012 23:32:27 -0000 This is a multi-part message in MIME format. --------------080309080104030002060603 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit on 22/02/2012 12:48 Doug Barton said the following: > On 02/22/2012 02:23, Andriy Gapon wrote: >> The attached patched should try to grab the memory harder. > > Same result, different memory address: > > supdrvGipCreate: failed to allocate the GIP page. rc=-8 > vboxdrv: supdrvInitDevExt failed, rc=-8 > module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 OK, now that, thanks to more testers, I realize that this issue is entirely i386-specific, I think that I might have been barking at the wrong trees. Now something very i386-ish to try to deal with the problem - the usual patch file is attached. > ... and not sure it's relevant, but both times I've tried loading these > modules it has killed my sound. /dev/mixer goes away, and I have to > reboot to get it back. This has never happened before, so I'm pretty > sure it's connected. No ideas whatsoever at this front. -- Andriy Gapon --------------080309080104030002060603 Content-Type: text/plain; name="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-12-19 15:01:31.000000000 +0200 +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2012-02-23 01:24:32.111859551 +0200 @@ -5,6 +5,7 @@ /* * Copyright (c) 2007 knut st. osmundsen + * Copyright (c) 2011 Andriy Gapon * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation @@ -54,23 +55,8 @@ /** The core structure. */ RTR0MEMOBJINTERNAL Core; /** Type dependent data */ - union - { - /** Non physical memory allocations */ - struct - { - /** The VM object associated with the allocation. */ - vm_object_t pObject; - } NonPhys; - /** Physical memory allocations */ - struct - { - /** Number of pages */ - uint32_t cPages; - /** Array of pages - variable */ - vm_page_t apPages[1]; - } Phys; - } u; + /** The VM object associated with the allocation. */ + vm_object_t pObject; } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; @@ -125,25 +111,14 @@ switch (pMemFreeBSD->Core.enmType) { - case RTR0MEMOBJTYPE_CONT: - contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOBJ); - break; - case RTR0MEMOBJTYPE_PAGE: + case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_CONT: { rc = vm_map_remove(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); - - vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - } - vm_page_unlock_queues(); break; } @@ -165,8 +140,8 @@ case RTR0MEMOBJTYPE_RES_VIRT: { vm_map_t pMap = kernel_map; - if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) - pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)->p_vmspace->vm_map; + if (pMemFreeBSD->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS) + pMap = &((struct proc *)pMemFreeBSD->Core.u.ResVirt.R0Process)->p_vmspace->vm_map; rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -180,7 +155,6 @@ if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) pMap = &((struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process)->p_vmspace->vm_map; - rc = vm_map_remove(pMap, (vm_offset_t)pMemFreeBSD->Core.pv, (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeBSD->Core.cb); @@ -191,26 +165,21 @@ case RTR0MEMOBJTYPE_PHYS: case RTR0MEMOBJTYPE_PHYS_NC: { + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); vm_page_lock_queues(); - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPage++) + for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); + pPage != NULL; + pPage = vm_page_next(pPage)) { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; vm_page_unwire(pPage, 0); - vm_page_free(pPage); } vm_page_unlock_queues(); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + vm_object_deallocate(pMemFreeBSD->pObject); break; } -#ifdef USE_KMEM_ALLOC_ATTR - case RTR0MEMOBJTYPE_LOW: - { - kmem_free(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb); - break; - } -#else - case RTR0MEMOBJTYPE_LOW: /* unused */ -#endif default: AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); return VERR_INTERNAL_ERROR; @@ -220,183 +189,183 @@ } -DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) -{ - int rc; - size_t cPages = cb >> PAGE_SHIFT; - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), - RTR0MEMOBJTYPE_PAGE, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - pMemFreeBSD->u.Phys.cPages = cPages; +static vm_page_t FreeBSDContigPhysAllocHelper(vm_object_t pObject, vm_pindex_t iPIndex, + u_long cPages, vm_paddr_t VmPhysAddrHigh, + u_long uAlignment, bool fWire) +{ + vm_page_t pPages; + int tries = 0; +#if __FreeBSD_version > 1000000 + int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY; + + if (fWire) + flags |= VM_ALLOC_WIRED; + while (1) + { + VM_OBJECT_LOCK(pObject); + pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, VmPhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); + VM_OBJECT_UNLOCK(pObject); + if (pPages || tries >= 1) + break; + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); + tries++; + } + return pPages; +#else - vm_offset_t MapAddress = vm_map_min(kernel_map); - rc = vm_map_find(kernel_map, /* map */ - NULL, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - TRUE, /* find_space */ - fExecutable /* protection */ - ? VM_PROT_ALL - : VM_PROT_RW, - VM_PROT_ALL, /* max(_prot) */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) + while (1) { - rc = VINF_SUCCESS; - - for (size_t iPage = 0; iPage < cPages; iPage++) + pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); + if (pPages || tries >= 1) + break; + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); + tries++; + } + if (!pPages) + return pPages; + VM_OBJECT_LOCK(pObject); + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = pPages + iPage; + vm_page_insert(pPage, pObject, iPIndex + iPage); + pPage->valid = VM_PAGE_BITS_ALL; + if (fWire) { - vm_page_t pPage; + pPage->wire_count = 1; + atomic_add_int(&cnt.v_wire_count, 1); + } + } + VM_OBJECT_UNLOCK(pObject); + return pPages; +#endif +} - pPage = vm_page_alloc(NULL, iPage, - VM_ALLOC_SYSTEM | - VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); +static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, + vm_paddr_t VmPhysAddrHigh, u_long uAlignment, + bool fContiguous, bool fWire) +{ + if (fContiguous) + { + if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, uAlignment, fWire) != NULL) + return VINF_SUCCESS; + else + return VERR_NO_MEMORY; + } - if (!pPage) + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) + { + vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, VmPhysAddrHigh, uAlignment, fWire); + if (!pPage) + { + /* Free all allocated pages */ + VM_OBJECT_LOCK(pObject); + while (iPage-- > 0) { - /* - * Out of pages - * Remove already allocated pages - */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); + pPage = vm_page_lookup(pObject, iPage); + vm_page_lock_queues(); + if (fWire) vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; + vm_page_free(pPage); + vm_page_unlock_queues(); } - - pPage->valid = VM_PAGE_BITS_ALL; - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; + VM_OBJECT_UNLOCK(pObject); + return VERR_NO_MEMORY; } + } + return VINF_SUCCESS; +} - if (rc == VINF_SUCCESS) - { - vm_offset_t AddressDst = MapAddress; +static int FreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutable, + vm_paddr_t VmPhysAddrHigh, bool fContiguous) +{ + int rc; + size_t cPages = atop(pMemFreeBSD->Core.cb); - for (size_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); + vm_offset_t MapAddress = vm_map_min(kernel_map); - MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage, - fExecutable - ? VM_PROT_ALL - : VM_PROT_RW, - TRUE); + // no additional object reference for auto-deallocation upon unmapping + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0); - AddressDst += PAGE_SIZE; - } + if (rc == KERN_SUCCESS) + { + rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, PAGE_SIZE, fContiguous, false); + if (RT_SUCCESS(rc)) + { + vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); /* Store start address */ pMemFreeBSD->Core.pv = (void *)MapAddress; - *ppMem = &pMemFreeBSD->Core; return VINF_SUCCESS; } - } - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ - rtR0MemObjDelete(&pMemFreeBSD->Core); + vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core.cb); + } + else + { + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + vm_object_deallocate(pMemFreeBSD->pObject); + } return rc; } - -DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { -#ifdef USE_KMEM_ALLOC_ATTR - /* - * Use kmem_alloc_attr, fExectuable is not needed because the - * memory will be executable by default - */ - NOREF(fExecutable); - - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_PAGE, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->Core.pv = (void *)kmem_alloc_attr(kernel_map, /* Kernel */ - cb, /* Amount */ - M_ZERO, /* Zero memory */ - 0, /* Low physical address */ - _4G - PAGE_SIZE, /* Highest physical address */ - VM_MEMATTR_DEFAULT); /* Default memory attributes */ - if (!pMemFreeBSD->Core.pv) - return VERR_NO_MEMORY; - - *ppMem = &pMemFreeBSD->Core; - - return VINF_SUCCESS; -#else - /* - * Try a Alloc first and see if we get luck, if not try contigmalloc. - * Might wish to try find our own pages or something later if this - * turns into a problemspot on AMD64 boxes. - */ - int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable); - if (RT_SUCCESS(rc)) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, false); + if (RT_FAILURE(rc)) { - size_t iPage = cb >> PAGE_SHIFT; - while (iPage-- > 0) - if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE_SIZE)) - { - RTR0MemObjFree(*ppMem, false); - *ppMem = NULL; - rc = VERR_NO_MEMORY; - break; - } + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - if (RT_FAILURE(rc)) - rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); + + *ppMem = &pMemFreeBSD->Core; return rc; -#endif } -DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_LOW, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - PAGE_SIZE, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false); + if (RT_FAILURE(rc)) { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; } - NOREF(fExecutable); - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; + *ppMem = &pMemFreeBSD->Core; + return rc; } -static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage) +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable) { - pPage->wire_count = 1; - pPage->pindex = iPage; - pPage->act_count = 0; - pPage->oflags = 0; - pPage->flags = PG_UNMANAGED; - atomic_add_int(&cnt.v_wire_count, 1); + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), + RTR0MEMOBJTYPE_CONT, NULL, cb); + if (!pMemFreeBSD) + return VERR_NO_MEMORY; + + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true); + if (RT_FAILURE(rc)) + { + rtR0MemObjDelete(&pMemFreeBSD->Core); + return rc; + } + + pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); + *ppMem = &pMemFreeBSD->Core; + return rc; } @@ -405,69 +374,36 @@ RTHCPHYS PhysHighest, size_t uAlignment, bool fContiguous) { - int rc = VINF_SUCCESS; - uint32_t cPages = cb >> PAGE_SHIFT; + uint32_t cPages = atop(cb); vm_paddr_t VmPhysAddrHigh; /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), enmType, NULL, cb); if (!pMemFreeBSD) return VERR_NO_MEMORY; - pMemFreeBSD->u.Phys.cPages = cPages; + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); if (PhysHighest != NIL_RTHCPHYS) VmPhysAddrHigh = PhysHighest; else VmPhysAddrHigh = ~(vm_paddr_t)0; - if (fContiguous) - { - vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, 0); - - if (pPage) - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - rtR0MemObjFreeBSDPhysPageInit(&pPage[iPage], iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = &pPage[iPage]; - } - else - rc = VERR_NO_MEMORY; - } - else - { - /* Allocate page by page */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAlignment, 0); - - if (!pPage) - { - /* Free all allocated pages */ - while (iPage-- > 0) - { - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; - vm_page_lock_queues(); - vm_page_unwire(pPage, 0); - vm_page_free(pPage); - vm_page_unlock_queues(); - } - rc = VERR_NO_MEMORY; - break; - } - rtR0MemObjFreeBSDPhysPageInit(pPage, iPage); - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; - } - } + int rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddrHigh, uAlignment, fContiguous, true); - if (RT_FAILURE(rc)) + if (RT_FAILURE(rc)) { + vm_object_deallocate(pMemFreeBSD->pObject); rtR0MemObjDelete(&pMemFreeBSD->Core); + } else { - if (enmType == RTR0MEMOBJTYPE_PHYS) + if (fContiguous) { - pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[0]); + Assert(enmType == RTR0MEMOBJTYPE_PHYS); + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find_least(pMemFreeBSD->pObject, 0)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); pMemFreeBSD->Core.u.Phys.fAllocated = true; } @@ -480,42 +416,13 @@ DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest, size_t uAlignment) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, PhysHighest, uAlignment, true); -#else - /* create the object. */ - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); - if (!pMemFreeBSD) - return VERR_NO_MEMORY; - - /* do the allocation. */ - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ - M_IPRTMOBJ, /* type */ - M_NOWAIT | M_ZERO, /* flags */ - 0, /* lowest physical address*/ - _4G-1, /* highest physical address */ - uAlignment, /* alignment. */ - 0); /* boundary */ - if (pMemFreeBSD->Core.pv) - { - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; - } - - rtR0MemObjDelete(&pMemFreeBSD->Core); - return VERR_NO_MEMORY; -#endif } DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, RTHCPHYS PhysHighest) { -#if 1 return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb, PhysHighest, PAGE_SIZE, false); -#else - return VERR_NOT_SUPPORTED; -#endif } @@ -625,49 +532,41 @@ if (!pMemFreeBSD) return VERR_NO_MEMORY; - /* - * Allocate an empty VM object and map it into the requested map. - */ - pMemFreeBSD->u.NonPhys.pObject = vm_object_allocate(OBJT_DEFAULT, cb >> PAGE_SHIFT); - if (pMemFreeBSD->u.NonPhys.pObject) + vm_offset_t MapAddress = pvFixed != (void *)-1 + ? (vm_offset_t)pvFixed + : vm_map_min(pMap); + if (pvFixed != (void *)-1) + vm_map_remove(pMap, + MapAddress, + MapAddress + cb); + + rc = vm_map_find(pMap, /* map */ + NULL, /* object */ + 0, /* offset */ + &MapAddress, /* addr (IN/OUT) */ + cb, /* length */ + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* find_space */ + VM_PROT_NONE, /* protection */ + VM_PROT_ALL, /* max(_prot) ?? */ + 0); /* cow (copy-on-write) */ + if (rc == KERN_SUCCESS) { - vm_offset_t MapAddress = pvFixed != (void *)-1 - ? (vm_offset_t)pvFixed - : vm_map_min(pMap); - if (pvFixed != (void *)-1) - vm_map_remove(pMap, - MapAddress, - MapAddress + cb); - - rc = vm_map_find(pMap, /* map */ - pMemFreeBSD->u.NonPhys.pObject, /* object */ - 0, /* offset */ - &MapAddress, /* addr (IN/OUT) */ - cb, /* length */ - pvFixed == (void *)-1, /* find_space */ - VM_PROT_NONE, /* protection */ - VM_PROT_ALL, /* max(_prot) ?? */ - 0); /* cow (copy-on-write) */ - if (rc == KERN_SUCCESS) + if (R0Process != NIL_RTR0PROCESS) { - if (R0Process != NIL_RTR0PROCESS) - { - rc = vm_map_inherit(pMap, - MapAddress, - MapAddress + cb, - VM_INHERIT_SHARE); - AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - } - pMemFreeBSD->Core.pv = (void *)MapAddress; - pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; - *ppMem = &pMemFreeBSD->Core; - return VINF_SUCCESS; + rc = vm_map_inherit(pMap, + MapAddress, + MapAddress + cb, + VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); } - vm_object_deallocate(pMemFreeBSD->u.NonPhys.pObject); - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ + pMemFreeBSD->Core.pv = (void *)MapAddress; + pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; } - else - rc = VERR_NO_MEMORY; + + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ rtR0MemObjDelete(&pMemFreeBSD->Core); return rc; @@ -690,7 +589,7 @@ DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, void *pvFixed, size_t uAlignment, unsigned fProt, size_t offSub, size_t cbSub) { - AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); +// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED); AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPORTED); /* @@ -699,21 +598,68 @@ if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; -/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/source/i386/i386/pmap.c?v=RELENG62#L2860) */ -/** @todo finish the implementation. */ + int rc; + PRTR0MEMOBJFREEBSD pMemToMapFreeBSD = (PRTR0MEMOBJFREEBSD)pMemToMap; - return VERR_NOT_SUPPORTED; + /* calc protection */ + vm_prot_t ProtectionFlags = 0; + if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) + ProtectionFlags = VM_PROT_NONE; + if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ) + ProtectionFlags |= VM_PROT_READ; + if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE) + ProtectionFlags |= VM_PROT_WRITE; + if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC) + ProtectionFlags |= VM_PROT_EXECUTE; + + vm_offset_t Addr = vm_map_min(kernel_map); + if (cbSub == 0) + cbSub = pMemToMap->cb - offSub; + + vm_object_reference(pMemToMapFreeBSD->pObject); + rc = vm_map_find(kernel_map, /* Map to insert the object in */ + pMemToMapFreeBSD->pObject, /* Object to map */ + offSub, /* Start offset in the object */ + &Addr, /* Start address IN/OUT */ + cbSub, /* Size of the mapping */ + VMFS_ANY_SPACE, /* Whether a suitable address should be searched for first */ + ProtectionFlags, /* protection flags */ + VM_PROT_ALL, /* Maximum protection flags */ + 0); /* copy-on-write and similar flags */ + + if (rc == KERN_SUCCESS) + { + rc = vm_map_wire(kernel_map, Addr, Addr + cbSub, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); + + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeof(RTR0MEMOBJFREEBSD), + RTR0MEMOBJTYPE_MAPPING, + (void *)Addr, + cbSub); + if (pMemFreeBSD) + { + Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr); + pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; + *ppMem = &pMemFreeBSD->Core; + return VINF_SUCCESS; + } + rc = vm_map_remove(kernel_map, Addr, Addr + cbSub); + AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); + } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); + + return VERR_NO_MEMORY; } -/* see http://markmail.org/message/udhq33tefgtyfozs */ -DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROCESS R0Process) +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMOBJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, + unsigned fProt, RTR0PROCESS R0Process) { /* * Check for unsupported stuff. */ AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Process, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); - AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NOT_SUPPORTED); if (uAlignment > PAGE_SIZE) return VERR_NOT_SUPPORTED; @@ -734,62 +680,38 @@ ProtectionFlags |= VM_PROT_EXECUTE; /* calc mapping address */ - PROC_LOCK(pProc); - vm_offset_t AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); - PROC_UNLOCK(pProc); + vm_offset_t AddrR3; + if (R3PtrFixed == (RTR3PTR)-1) + { + // is this needed? + PROC_LOCK(pProc); + AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_max(pProc, RLIMIT_DATA)); + PROC_UNLOCK(pProc); + } + else + AddrR3 = (vm_offset_t)R3PtrFixed; - /* Insert the object in the map. */ + /* Insert the pObject in the map. */ + vm_object_reference(pMemToMapFreeBSD->pObject); rc = vm_map_find(pProcMap, /* Map to insert the object in */ - NULL, /* Object to map */ + pMemToMapFreeBSD->pObject, /* Object to map */ 0, /* Start offset in the object */ &AddrR3, /* Start address IN/OUT */ pMemToMap->cb, /* Size of the mapping */ - TRUE, /* Whether a suitable address should be searched for first */ + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, + /* Whether a suitable address should be searched for first */ ProtectionFlags, /* protection flags */ VM_PROT_ALL, /* Maximum protection flags */ - 0); /* Copy on write */ + 0); /* copy-on-write and similar flags */ - /* Map the memory page by page into the destination map. */ if (rc == KERN_SUCCESS) { - size_t cPages = pMemToMap->cb >> PAGE_SHIFT;; - pmap_t pPhysicalMap = pProcMap->pmap; - vm_offset_t AddrR3Dst = AddrR3; - - if ( pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS - || pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS_NC - || pMemToMap->enmType == RTR0MEMOBJTYPE_PAGE) - { - /* Mapping physical allocations */ - Assert(cPages == pMemToMapFreeBSD->u.Phys.cPages); + rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - /* Insert the memory page by page into the mapping. */ - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = pMemToMapFreeBSD->u.Phys.apPages[iPage]; + rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INHERIT_SHARE); + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - } - } - else - { - /* Mapping cont or low memory types */ - vm_offset_t AddrToMap = (vm_offset_t)pMemToMap->pv; - - for (uint32_t iPage = 0; iPage < cPages; iPage++) - { - vm_page_t pPage = PHYS_TO_VM_PAGE(vtophys(AddrToMap)); - - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlags, TRUE); - AddrR3Dst += PAGE_SIZE; - AddrToMap += PAGE_SIZE; - } - } - } - - if (RT_SUCCESS(rc)) - { /* * Create a mapping object for it. */ @@ -805,9 +727,11 @@ return VINF_SUCCESS; } - rc = vm_map_remove(pProcMap, ((vm_offset_t)AddrR3), ((vm_offset_t)AddrR3) + pMemToMap->cb); + rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb); AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); } + else + vm_object_deallocate(pMemToMapFreeBSD->pObject); return VERR_NO_MEMORY; } @@ -855,49 +779,47 @@ return NIL_RTHCPHYS; } - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Lock.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } case RTR0MEMOBJTYPE_MAPPING: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage); if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) { struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.Mapping.R0Process; struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; - pmap_t pPhysicalMap = pProcMap->pmap; + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); return pmap_extract(pPhysicalMap, pb); } return vtophys(pb); } - case RTR0MEMOBJTYPE_CONT: - return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); - - case RTR0MEMOBJTYPE_PHYS: - return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT); - case RTR0MEMOBJTYPE_PAGE: - case RTR0MEMOBJTYPE_PHYS_NC: - return VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[iPage]); - -#ifdef USE_KMEM_ALLOC_ATTR case RTR0MEMOBJTYPE_LOW: + case RTR0MEMOBJTYPE_PHYS_NC: { - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << PAGE_SHIFT); - return vtophys(pb); + RTHCPHYS addr; + VM_OBJECT_LOCK(pMemFreeBSD->pObject); + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPage)); + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); + return addr; } -#else - case RTR0MEMOBJTYPE_LOW: -#endif + + case RTR0MEMOBJTYPE_PHYS: + return pMemFreeBSD->Core.u.Cont.Phys + ptoa(iPage); + + case RTR0MEMOBJTYPE_CONT: + return pMemFreeBSD->Core.u.Phys.PhysBase + ptoa(iPage); + case RTR0MEMOBJTYPE_RES_VIRT: default: return NIL_RTHCPHYS; --------------080309080104030002060603-- From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 23 01:01:46 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51C6E106566B; Thu, 23 Feb 2012 01:01:46 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10]) by mx1.freebsd.org (Postfix) with ESMTP id BEF7A8FC1B; Thu, 23 Feb 2012 01:01:45 +0000 (UTC) Received: from pd2ml1so-ssvc.prod.shaw.ca ([10.0.141.139]) by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 22 Feb 2012 18:01:45 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=2TvZ7eE48NdEYeaL5Xf58dNzJU178UzT+2lxUZ5Mhss= c=1 sm=1 a=hunnjcbhBuQA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10 a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17 a=BWvPGDcYAAAA:8 a=6I5d2MoRAAAA:8 a=CZcz75HJAAAA:8 a=dT19lrtdAAAA:8 a=yON4etAAAAAA:8 a=ItLQkBnY6sHgiAmAMaAA:9 a=Jt3CbnFNXllBNvta_4sA:7 a=CjuIK1q_8ugA:10 a=V7tsTZBp22UA:10 a=SV7veod9ZcQA:10 a=isr0gXzK8GcA:10 a=wsTPIBqtGAHad_SX:21 a=XGzd0vrvTqHmig1a:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119]) by pd2ml1so-dmz.prod.shaw.ca with ESMTP; 22 Feb 2012 18:01:44 -0700 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTP id CCE0946B6F; Wed, 22 Feb 2012 17:01:41 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q1N11fVJ006417; Wed, 22 Feb 2012 17:01:41 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201202230101.q1N11fVJ006417@slippy.cwsent.com> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Andriy Gapon In-Reply-To: Message from Andriy Gapon of "Thu, 23 Feb 2012 01:31:52 +0200." <4F457AE8.4090708@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2012 17:01:40 -0800 Cc: freebsd-emulation@FreeBSD.org, Doug Barton , decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cy Schubert List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 01:01:46 -0000 I'll give it a try on my testbed (which runs 9.0 and 8.2 -- my 7 partitions don't have the ports to test it without taking a lot of time to build prereqs).. If not tonight (PST) then I'll have some time Saturday evening. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. In message <4F457AE8.4090708@FreeBSD.org>, Andriy Gapon writes: > This is a multi-part message in MIME format. > --------------080309080104030002060603 > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > on 22/02/2012 12:48 Doug Barton said the following: > > On 02/22/2012 02:23, Andriy Gapon wrote: > >> The attached patched should try to grab the memory harder. > > > > Same result, different memory address: > > > > supdrvGipCreate: failed to allocate the GIP page. rc=-8 > > vboxdrv: supdrvInitDevExt failed, rc=-8 > > module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 > > OK, now that, thanks to more testers, I realize that this issue is entirely > i386-specific, I think that I might have been barking at the wrong trees. > Now something very i386-ish to try to deal with the problem - the usual patch > file is attached. > > > ... and not sure it's relevant, but both times I've tried loading these > > modules it has killed my sound. /dev/mixer goes away, and I have to > > reboot to get it back. This has never happened before, so I'm pretty > > sure it's connected. > > No ideas whatsoever at this front. > > -- > Andriy Gapon > > --------------080309080104030002060603 > Content-Type: text/plain; > name="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c" > Content-Transfer-Encoding: 7bit > Content-Disposition: attachment; > filename*0="patch-src-VBox-Runtime-r0drv-freebsd-memobj-r0drv-freebsd.c > " > > --- src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c.orig 2011-12 > -19 15:01:31.000000000 +0200 > +++ src/VBox/Runtime/r0drv/freebsd/memobj-r0drv-freebsd.c 2012-02-23 01:2 > 4:32.111859551 +0200 > @@ -5,6 +5,7 @@ > > /* > * Copyright (c) 2007 knut st. osmundsen > + * Copyright (c) 2011 Andriy Gapon > * > * Permission is hereby granted, free of charge, to any person > * obtaining a copy of this software and associated documentation > @@ -54,23 +55,8 @@ > /** The core structure. */ > RTR0MEMOBJINTERNAL Core; > /** Type dependent data */ > - union > - { > - /** Non physical memory allocations */ > - struct > - { > - /** The VM object associated with the allocation. */ > - vm_object_t pObject; > - } NonPhys; > - /** Physical memory allocations */ > - struct > - { > - /** Number of pages */ > - uint32_t cPages; > - /** Array of pages - variable */ > - vm_page_t apPages[1]; > - } Phys; > - } u; > + /** The VM object associated with the allocation. */ > + vm_object_t pObject; > } RTR0MEMOBJFREEBSD, *PRTR0MEMOBJFREEBSD; > > > @@ -125,25 +111,14 @@ > > switch (pMemFreeBSD->Core.enmType) > { > - case RTR0MEMOBJTYPE_CONT: > - contigfree(pMemFreeBSD->Core.pv, pMemFreeBSD->Core.cb, M_IPRTMOB > J); > - break; > - > case RTR0MEMOBJTYPE_PAGE: > + case RTR0MEMOBJTYPE_LOW: > + case RTR0MEMOBJTYPE_CONT: > { > rc = vm_map_remove(kernel_map, > (vm_offset_t)pMemFreeBSD->Core.pv, > (vm_offset_t)pMemFreeBSD->Core.pv + pMemFree > BSD->Core.cb); > AssertMsg(rc == KERN_SUCCESS, ("%#x", rc)); > - > - vm_page_lock_queues(); > - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPa > ge++) > - { > - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; > - vm_page_unwire(pPage, 0); > - vm_page_free(pPage); > - } > - vm_page_unlock_queues(); > break; > } > > @@ -165,8 +140,8 @@ > case RTR0MEMOBJTYPE_RES_VIRT: > { > vm_map_t pMap = kernel_map; > - if (pMemFreeBSD->Core.u.Lock.R0Process != NIL_RTR0PROCESS) > - pMap = &((struct proc *)pMemFreeBSD->Core.u.Lock.R0Process)- > >p_vmspace->vm_map; > + if (pMemFreeBSD->Core.u.ResVirt.R0Process != NIL_RTR0PROCESS) > + pMap = &((struct proc *)pMemFreeBSD->Core.u.ResVirt.R0Proces > s)->p_vmspace->vm_map; > rc = vm_map_remove(pMap, > (vm_offset_t)pMemFreeBSD->Core.pv, > (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeB > SD->Core.cb); > @@ -180,7 +155,6 @@ > > if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) > pMap = &((struct proc *)pMemFreeBSD->Core.u.Mapping.R0Proces > s)->p_vmspace->vm_map; > - > rc = vm_map_remove(pMap, > (vm_offset_t)pMemFreeBSD->Core.pv, > (vm_offset_t)pMemFreeBSD->Core.pv + pMemFreeB > SD->Core.cb); > @@ -191,26 +165,21 @@ > case RTR0MEMOBJTYPE_PHYS: > case RTR0MEMOBJTYPE_PHYS_NC: > { > + VM_OBJECT_LOCK(pMemFreeBSD->pObject); > + vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, 0); > vm_page_lock_queues(); > - for (uint32_t iPage = 0; iPage < pMemFreeBSD->u.Phys.cPages; iPa > ge++) > + for (vm_page_t pPage = vm_page_find_least(pMemFreeBSD->pObject, > 0); > + pPage != NULL; > + pPage = vm_page_next(pPage)) > { > - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; > vm_page_unwire(pPage, 0); > - vm_page_free(pPage); > } > vm_page_unlock_queues(); > + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); > + vm_object_deallocate(pMemFreeBSD->pObject); > break; > } > > -#ifdef USE_KMEM_ALLOC_ATTR > - case RTR0MEMOBJTYPE_LOW: > - { > - kmem_free(kernel_map, (vm_offset_t)pMemFreeBSD->Core.pv, pMemFre > eBSD->Core.cb); > - break; > - } > -#else > - case RTR0MEMOBJTYPE_LOW: /* unused */ > -#endif > default: > AssertMsgFailed(("enmType=%d\n", pMemFreeBSD->Core.enmType)); > return VERR_INTERNAL_ERROR; > @@ -220,183 +189,183 @@ > } > > > -DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > -{ > - int rc; > - size_t cPages = cb >> PAGE_SHIFT; > - > - /* create the object. */ > - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OF > FSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), > - RTR0M > EMOBJTYPE_PAGE, NULL, cb); > - if (!pMemFreeBSD) > - return VERR_NO_MEMORY; > - > - pMemFreeBSD->u.Phys.cPages = cPages; > +static vm_page_t FreeBSDContigPhysAllocHelper(vm_object_t pObject, vm_pindex > _t iPIndex, > + u_long cPages, vm_paddr_t VmPh > ysAddrHigh, > + u_long uAlignment, bool fWire) > +{ > + vm_page_t pPages; > + int tries = 0; > +#if __FreeBSD_version > 1000000 > + int flags = VM_ALLOC_INTERRUPT | VM_ALLOC_NOBUSY; > + > + if (fWire) > + flags |= VM_ALLOC_WIRED; > + while (1) > + { > + VM_OBJECT_LOCK(pObject); > + pPages = vm_page_alloc_contig(pObject, iPIndex, flags, cPages, 0, Vm > PhysAddrHigh, uAlignment, 0, VM_MEMATTR_DEFAULT); > + VM_OBJECT_UNLOCK(pObject); > + if (pPages || tries >= 1) > + break; > + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); > + tries++; > + } > + return pPages; > +#else > > - vm_offset_t MapAddress = vm_map_min(kernel_map); > - rc = vm_map_find(kernel_map, /* map */ > - NULL, /* object */ > - 0, /* offset */ > - &MapAddress, /* addr (IN/OUT) */ > - cb, /* length */ > - TRUE, /* find_space */ > - fExecutable /* protection */ > - ? VM_PROT_ALL > - : VM_PROT_RW, > - VM_PROT_ALL, /* max(_prot) */ > - 0); /* cow (copy-on-write) */ > - if (rc == KERN_SUCCESS) > + while (1) > { > - rc = VINF_SUCCESS; > - > - for (size_t iPage = 0; iPage < cPages; iPage++) > + pPages = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uAlignment, > 0); > + if (pPages || tries >= 1) > + break; > + vm_contig_grow_cache(tries, 0, VmPhysAddrHigh); > + tries++; > + } > + if (!pPages) > + return pPages; > + VM_OBJECT_LOCK(pObject); > + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) > + { > + vm_page_t pPage = pPages + iPage; > + vm_page_insert(pPage, pObject, iPIndex + iPage); > + pPage->valid = VM_PAGE_BITS_ALL; > + if (fWire) > { > - vm_page_t pPage; > + pPage->wire_count = 1; > + atomic_add_int(&cnt.v_wire_count, 1); > + } > + } > + VM_OBJECT_UNLOCK(pObject); > + return pPages; > +#endif > +} > > - pPage = vm_page_alloc(NULL, iPage, > - VM_ALLOC_SYSTEM | > - VM_ALLOC_WIRED | VM_ALLOC_NOOBJ); > +static int FreeBSDPhysAllocHelper(vm_object_t pObject, u_long cPages, > + vm_paddr_t VmPhysAddrHigh, u_long uAlignme > nt, > + bool fContiguous, bool fWire) > +{ > + if (fContiguous) > + { > + if (FreeBSDContigPhysAllocHelper(pObject, 0, cPages, VmPhysAddrHigh, > uAlignment, fWire) != NULL) > + return VINF_SUCCESS; > + else > + return VERR_NO_MEMORY; > + } > > - if (!pPage) > + for (vm_pindex_t iPage = 0; iPage < cPages; iPage++) > + { > + vm_page_t pPage = FreeBSDContigPhysAllocHelper(pObject, iPage, 1, Vm > PhysAddrHigh, uAlignment, fWire); > + if (!pPage) > + { > + /* Free all allocated pages */ > + VM_OBJECT_LOCK(pObject); > + while (iPage-- > 0) > { > - /* > - * Out of pages > - * Remove already allocated pages > - */ > - while (iPage-- > 0) > - { > - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; > - vm_page_lock_queues(); > + pPage = vm_page_lookup(pObject, iPage); > + vm_page_lock_queues(); > + if (fWire) > vm_page_unwire(pPage, 0); > - vm_page_free(pPage); > - vm_page_unlock_queues(); > - } > - rc = VERR_NO_MEMORY; > - break; > + vm_page_free(pPage); > + vm_page_unlock_queues(); > } > - > - pPage->valid = VM_PAGE_BITS_ALL; > - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; > + VM_OBJECT_UNLOCK(pObject); > + return VERR_NO_MEMORY; > } > + } > + return VINF_SUCCESS; > +} > > - if (rc == VINF_SUCCESS) > - { > - vm_offset_t AddressDst = MapAddress; > +static int FreeBSDAllocHelper(PRTR0MEMOBJFREEBSD pMemFreeBSD, bool fExecutab > le, > + vm_paddr_t VmPhysAddrHigh, bool fContiguous) > +{ > + int rc; > + size_t cPages = atop(pMemFreeBSD->Core.cb); > > - for (size_t iPage = 0; iPage < cPages; iPage++) > - { > - vm_page_t pPage = pMemFreeBSD->u.Phys.apPages[iPage]; > + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, cPages); > + vm_offset_t MapAddress = vm_map_min(kernel_map); > > - MY_PMAP_ENTER(kernel_map->pmap, AddressDst, pPage, > - fExecutable > - ? VM_PROT_ALL > - : VM_PROT_RW, > - TRUE); > + // no additional object reference for auto-deallocation upon unmapping > + rc = vm_map_find(kernel_map, pMemFreeBSD->pObject, 0, > + &MapAddress, pMemFreeBSD->Core.cb, VMFS_ANY_SPACE, > + fExecutable ? VM_PROT_ALL : VM_PROT_RW, VM_PROT_ALL, 0) > ; > > - AddressDst += PAGE_SIZE; > - } > + if (rc == KERN_SUCCESS) > + { > + rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddr > High, PAGE_SIZE, fContiguous, false); > + if (RT_SUCCESS(rc)) > + { > + vm_map_wire(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Co > re.cb, VM_MAP_WIRE_SYSTEM|VM_MAP_WIRE_NOHOLES); > > /* Store start address */ > pMemFreeBSD->Core.pv = (void *)MapAddress; > - *ppMem = &pMemFreeBSD->Core; > return VINF_SUCCESS; > } > - } > - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ > > - rtR0MemObjDelete(&pMemFreeBSD->Core); > + vm_map_remove(kernel_map, MapAddress, MapAddress + pMemFreeBSD->Core > .cb); > + } > + else > + { > + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) > */ > + vm_object_deallocate(pMemFreeBSD->pObject); > + } > return rc; > } > > - > -DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > +DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > { > -#ifdef USE_KMEM_ALLOC_ATTR > - /* > - * Use kmem_alloc_attr, fExectuable is not needed because the > - * memory will be executable by default > - */ > - NOREF(fExecutable); > - > - /* create the object. */ > - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), RTR0MEMOBJTYPE_LOW, NULL, cb); > + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), > + RTR0M > EMOBJTYPE_PAGE, NULL, cb); > if (!pMemFreeBSD) > return VERR_NO_MEMORY; > > - pMemFreeBSD->Core.pv = (void *)kmem_alloc_attr(kernel_map, /* K > ernel */ > - cb, /* A > mount */ > - M_ZERO, /* Z > ero memory */ > - 0, /* L > ow physical address */ > - _4G - PAGE_SIZE, /* H > ighest physical address */ > - VM_MEMATTR_DEFAULT); /* D > efault memory attributes */ > - if (!pMemFreeBSD->Core.pv) > - return VERR_NO_MEMORY; > - > - *ppMem = &pMemFreeBSD->Core; > - > - return VINF_SUCCESS; > -#else > - /* > - * Try a Alloc first and see if we get luck, if not try contigmalloc. > - * Might wish to try find our own pages or something later if this > - * turns into a problemspot on AMD64 boxes. > - */ > - int rc = rtR0MemObjNativeAllocPage(ppMem, cb, fExecutable); > - if (RT_SUCCESS(rc)) > + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, ~(vm_paddr_t)0, fa > lse); > + if (RT_FAILURE(rc)) > { > - size_t iPage = cb >> PAGE_SHIFT; > - while (iPage-- > 0) > - if (rtR0MemObjNativeGetPagePhysAddr(*ppMem, iPage) > (_4G - PAGE > _SIZE)) > - { > - RTR0MemObjFree(*ppMem, false); > - *ppMem = NULL; > - rc = VERR_NO_MEMORY; > - break; > - } > + rtR0MemObjDelete(&pMemFreeBSD->Core); > + return rc; > } > - if (RT_FAILURE(rc)) > - rc = rtR0MemObjNativeAllocCont(ppMem, cb, fExecutable); > + > + *ppMem = &pMemFreeBSD->Core; > return rc; > -#endif > } > > > -DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > +DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > { > - /* create the object. */ > - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); > + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), > + RTR0M > EMOBJTYPE_LOW, NULL, cb); > if (!pMemFreeBSD) > return VERR_NO_MEMORY; > > - /* do the allocation. */ > - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ > - M_IPRTMOBJ, /* type */ > - M_NOWAIT | M_ZERO, /* flags */ > - 0, /* lowest phys > ical address*/ > - _4G-1, /* highest phy > sical address */ > - PAGE_SIZE, /* alignment. > */ > - 0); /* boundary */ > - if (pMemFreeBSD->Core.pv) > + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, false); > + if (RT_FAILURE(rc)) > { > - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); > - *ppMem = &pMemFreeBSD->Core; > - return VINF_SUCCESS; > + rtR0MemObjDelete(&pMemFreeBSD->Core); > + return rc; > } > > - NOREF(fExecutable); > - rtR0MemObjDelete(&pMemFreeBSD->Core); > - return VERR_NO_MEMORY; > + *ppMem = &pMemFreeBSD->Core; > + return rc; > } > > > -static void rtR0MemObjFreeBSDPhysPageInit(vm_page_t pPage, vm_pindex_t iPage > ) > +DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, bool fExecutable) > { > - pPage->wire_count = 1; > - pPage->pindex = iPage; > - pPage->act_count = 0; > - pPage->oflags = 0; > - pPage->flags = PG_UNMANAGED; > - atomic_add_int(&cnt.v_wire_count, 1); > + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), > + RTR0M > EMOBJTYPE_CONT, NULL, cb); > + if (!pMemFreeBSD) > + return VERR_NO_MEMORY; > + > + int rc = FreeBSDAllocHelper(pMemFreeBSD, fExecutable, _4G - 1, true); > + if (RT_FAILURE(rc)) > + { > + rtR0MemObjDelete(&pMemFreeBSD->Core); > + return rc; > + } > + > + pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); > + *ppMem = &pMemFreeBSD->Core; > + return rc; > } > > > @@ -405,69 +374,36 @@ > RTHCPHYS PhysHighest, size_t uAli > gnment, > bool fContiguous) > { > - int rc = VINF_SUCCESS; > - uint32_t cPages = cb >> PAGE_SHIFT; > + uint32_t cPages = atop(cb); > vm_paddr_t VmPhysAddrHigh; > > /* create the object. */ > - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(RT_OF > FSETOF(RTR0MEMOBJFREEBSD, u.Phys.apPages[cPages]), > + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), > enmTy > pe, NULL, cb); > if (!pMemFreeBSD) > return VERR_NO_MEMORY; > > - pMemFreeBSD->u.Phys.cPages = cPages; > + pMemFreeBSD->pObject = vm_object_allocate(OBJT_PHYS, atop(cb)); > > if (PhysHighest != NIL_RTHCPHYS) > VmPhysAddrHigh = PhysHighest; > else > VmPhysAddrHigh = ~(vm_paddr_t)0; > > - if (fContiguous) > - { > - vm_page_t pPage = vm_phys_alloc_contig(cPages, 0, VmPhysAddrHigh, uA > lignment, 0); > - > - if (pPage) > - for (uint32_t iPage = 0; iPage < cPages; iPage++) > - { > - rtR0MemObjFreeBSDPhysPageInit(&pPage[iPage], iPage); > - pMemFreeBSD->u.Phys.apPages[iPage] = &pPage[iPage]; > - } > - else > - rc = VERR_NO_MEMORY; > - } > - else > - { > - /* Allocate page by page */ > - for (uint32_t iPage = 0; iPage < cPages; iPage++) > - { > - vm_page_t pPage = vm_phys_alloc_contig(1, 0, VmPhysAddrHigh, uAl > ignment, 0); > - > - if (!pPage) > - { > - /* Free all allocated pages */ > - while (iPage-- > 0) > - { > - pPage = pMemFreeBSD->u.Phys.apPages[iPage]; > - vm_page_lock_queues(); > - vm_page_unwire(pPage, 0); > - vm_page_free(pPage); > - vm_page_unlock_queues(); > - } > - rc = VERR_NO_MEMORY; > - break; > - } > - rtR0MemObjFreeBSDPhysPageInit(pPage, iPage); > - pMemFreeBSD->u.Phys.apPages[iPage] = pPage; > - } > - } > + int rc = FreeBSDPhysAllocHelper(pMemFreeBSD->pObject, cPages, VmPhysAddr > High, uAlignment, fContiguous, true); > > - if (RT_FAILURE(rc)) > + if (RT_FAILURE(rc)) { > + vm_object_deallocate(pMemFreeBSD->pObject); > rtR0MemObjDelete(&pMemFreeBSD->Core); > + } > else > { > - if (enmType == RTR0MEMOBJTYPE_PHYS) > + if (fContiguous) > { > - pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(pMemFreeBSD- > >u.Phys.apPages[0]); > + Assert(enmType == RTR0MEMOBJTYPE_PHYS); > + VM_OBJECT_LOCK(pMemFreeBSD->pObject); > + pMemFreeBSD->Core.u.Phys.PhysBase = VM_PAGE_TO_PHYS(vm_page_find > _least(pMemFreeBSD->pObject, 0)); > + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); > pMemFreeBSD->Core.u.Phys.fAllocated = true; > } > > @@ -480,42 +416,13 @@ > > DECLHIDDEN(int) rtR0MemObjNativeAllocPhys(PPRTR0MEMOBJINTERNAL ppMem, size_t > cb, RTHCPHYS PhysHighest, size_t uAlignment) > { > -#if 1 > return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS, cb, P > hysHighest, uAlignment, true); > -#else > - /* create the object. */ > - PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(sizeo > f(*pMemFreeBSD), RTR0MEMOBJTYPE_CONT, NULL, cb); > - if (!pMemFreeBSD) > - return VERR_NO_MEMORY; > - > - /* do the allocation. */ > - pMemFreeBSD->Core.pv = contigmalloc(cb, /* size */ > - M_IPRTMOBJ, /* type */ > - M_NOWAIT | M_ZERO, /* flags */ > - 0, /* lowest phys > ical address*/ > - _4G-1, /* highest phy > sical address */ > - uAlignment, /* alignment. > */ > - 0); /* boundary */ > - if (pMemFreeBSD->Core.pv) > - { > - pMemFreeBSD->Core.u.Cont.Phys = vtophys(pMemFreeBSD->Core.pv); > - *ppMem = &pMemFreeBSD->Core; > - return VINF_SUCCESS; > - } > - > - rtR0MemObjDelete(&pMemFreeBSD->Core); > - return VERR_NO_MEMORY; > -#endif > } > > > DECLHIDDEN(int) rtR0MemObjNativeAllocPhysNC(PPRTR0MEMOBJINTERNAL ppMem, size > _t cb, RTHCPHYS PhysHighest) > { > -#if 1 > return rtR0MemObjFreeBSDAllocPhysPages(ppMem, RTR0MEMOBJTYPE_PHYS_NC, cb > , PhysHighest, PAGE_SIZE, false); > -#else > - return VERR_NOT_SUPPORTED; > -#endif > } > > > @@ -625,49 +532,41 @@ > if (!pMemFreeBSD) > return VERR_NO_MEMORY; > > - /* > - * Allocate an empty VM object and map it into the requested map. > - */ > - pMemFreeBSD->u.NonPhys.pObject = vm_object_allocate(OBJT_DEFAULT, cb >> > PAGE_SHIFT); > - if (pMemFreeBSD->u.NonPhys.pObject) > + vm_offset_t MapAddress = pvFixed != (void *)-1 > + ? (vm_offset_t)pvFixed > + : vm_map_min(pMap); > + if (pvFixed != (void *)-1) > + vm_map_remove(pMap, > + MapAddress, > + MapAddress + cb); > + > + rc = vm_map_find(pMap, /* map */ > + NULL, /* object */ > + 0, /* offset */ > + &MapAddress, /* addr (IN/OUT) */ > + cb, /* length */ > + pvFixed == (void *)-1 ? VMFS_ANY_SPACE : VMFS_NO_SPACE, > + /* find_space */ > + VM_PROT_NONE, /* protection */ > + VM_PROT_ALL, /* max(_prot) ?? */ > + 0); /* cow (copy-on-write) * > / > + if (rc == KERN_SUCCESS) > { > - vm_offset_t MapAddress = pvFixed != (void *)-1 > - ? (vm_offset_t)pvFixed > - : vm_map_min(pMap); > - if (pvFixed != (void *)-1) > - vm_map_remove(pMap, > - MapAddress, > - MapAddress + cb); > - > - rc = vm_map_find(pMap, /* map */ > - pMemFreeBSD->u.NonPhys.pObject, /* object */ > - 0, /* offset */ > - &MapAddress, /* addr (IN/OUT) */ > - cb, /* length */ > - pvFixed == (void *)-1, /* find_space */ > - VM_PROT_NONE, /* protection */ > - VM_PROT_ALL, /* max(_prot) ?? */ > - 0); /* cow (copy-on-writ > e) */ > - if (rc == KERN_SUCCESS) > + if (R0Process != NIL_RTR0PROCESS) > { > - if (R0Process != NIL_RTR0PROCESS) > - { > - rc = vm_map_inherit(pMap, > - MapAddress, > - MapAddress + cb, > - VM_INHERIT_SHARE); > - AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); > - } > - pMemFreeBSD->Core.pv = (void *)MapAddress; > - pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; > - *ppMem = &pMemFreeBSD->Core; > - return VINF_SUCCESS; > + rc = vm_map_inherit(pMap, > + MapAddress, > + MapAddress + cb, > + VM_INHERIT_SHARE); > + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); > } > - vm_object_deallocate(pMemFreeBSD->u.NonPhys.pObject); > - rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) > */ > + pMemFreeBSD->Core.pv = (void *)MapAddress; > + pMemFreeBSD->Core.u.ResVirt.R0Process = R0Process; > + *ppMem = &pMemFreeBSD->Core; > + return VINF_SUCCESS; > } > - else > - rc = VERR_NO_MEMORY; > + > + rc = VERR_NO_MEMORY; /** @todo fix translation (borrow from darwin) */ > rtR0MemObjDelete(&pMemFreeBSD->Core); > return rc; > > @@ -690,7 +589,7 @@ > DECLHIDDEN(int) rtR0MemObjNativeMapKernel(PPRTR0MEMOBJINTERNAL ppMem, RTR0ME > MOBJ pMemToMap, void *pvFixed, size_t uAlignment, > unsigned fProt, size_t offSub, siz > e_t cbSub) > { > - AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NO > T_SUPPORTED); > +// AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NO > T_SUPPORTED); > AssertMsgReturn(pvFixed == (void *)-1, ("%p\n", pvFixed), VERR_NOT_SUPPO > RTED); > > /* > @@ -699,21 +598,68 @@ > if (uAlignment > PAGE_SIZE) > return VERR_NOT_SUPPORTED; > > -/* Phys: see pmap_mapdev in i386/i386/pmap.c (http://fxr.watson.org/fxr/sour > ce/i386/i386/pmap.c?v=RELENG62#L2860) */ > -/** @todo finish the implementation. */ > + int rc; > + PRTR0MEMOBJFREEBSD pMemToMapFreeBSD = (PRTR0MEMOBJFREEBSD)pMemToMap; > > - return VERR_NOT_SUPPORTED; > + /* calc protection */ > + vm_prot_t ProtectionFlags = 0; > + if ((fProt & RTMEM_PROT_NONE) == RTMEM_PROT_NONE) > + ProtectionFlags = VM_PROT_NONE; > + if ((fProt & RTMEM_PROT_READ) == RTMEM_PROT_READ) > + ProtectionFlags |= VM_PROT_READ; > + if ((fProt & RTMEM_PROT_WRITE) == RTMEM_PROT_WRITE) > + ProtectionFlags |= VM_PROT_WRITE; > + if ((fProt & RTMEM_PROT_EXEC) == RTMEM_PROT_EXEC) > + ProtectionFlags |= VM_PROT_EXECUTE; > + > + vm_offset_t Addr = vm_map_min(kernel_map); > + if (cbSub == 0) > + cbSub = pMemToMap->cb - offSub; > + > + vm_object_reference(pMemToMapFreeBSD->pObject); > + rc = vm_map_find(kernel_map, /* Map to insert the object in * > / > + pMemToMapFreeBSD->pObject, /* Object to map */ > + offSub, /* Start offset in the object */ > + &Addr, /* Start address IN/OUT */ > + cbSub, /* Size of the mapping */ > + VMFS_ANY_SPACE, /* Whether a suitable address sh > ould be searched for first */ > + ProtectionFlags, /* protection flags */ > + VM_PROT_ALL, /* Maximum protection flags */ > + 0); /* copy-on-write and similar fla > gs */ > + > + if (rc == KERN_SUCCESS) > + { > + rc = vm_map_wire(kernel_map, Addr, Addr + cbSub, VM_MAP_WIRE_SYSTEM| > VM_MAP_WIRE_NOHOLES); > + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); > + > + PRTR0MEMOBJFREEBSD pMemFreeBSD = (PRTR0MEMOBJFREEBSD)rtR0MemObjNew(s > izeof(RTR0MEMOBJFREEBSD), > + R > TR0MEMOBJTYPE_MAPPING, > + ( > void *)Addr, > + c > bSub); > + if (pMemFreeBSD) > + { > + Assert((vm_offset_t)pMemFreeBSD->Core.pv == Addr); > + pMemFreeBSD->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; > + *ppMem = &pMemFreeBSD->Core; > + return VINF_SUCCESS; > + } > + rc = vm_map_remove(kernel_map, Addr, Addr + cbSub); > + AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); > + } > + else > + vm_object_deallocate(pMemToMapFreeBSD->pObject); > + > + return VERR_NO_MEMORY; > } > > > -/* see http://markmail.org/message/udhq33tefgtyfozs */ > -DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMO > BJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, unsigned fProt, RTR0PROC > ESS R0Process) > +DECLHIDDEN(int) rtR0MemObjNativeMapUser(PPRTR0MEMOBJINTERNAL ppMem, RTR0MEMO > BJ pMemToMap, RTR3PTR R3PtrFixed, size_t uAlignment, > + unsigned fProt, RTR0PROCESS R0Proces > s) > { > /* > * Check for unsupported stuff. > */ > AssertMsgReturn(R0Process == RTR0ProcHandleSelf(), ("%p != %p\n", R0Proc > ess, RTR0ProcHandleSelf()), VERR_NOT_SUPPORTED); > - AssertMsgReturn(R3PtrFixed == (RTR3PTR)-1, ("%p\n", R3PtrFixed), VERR_NO > T_SUPPORTED); > if (uAlignment > PAGE_SIZE) > return VERR_NOT_SUPPORTED; > > @@ -734,62 +680,38 @@ > ProtectionFlags |= VM_PROT_EXECUTE; > > /* calc mapping address */ > - PROC_LOCK(pProc); > - vm_offset_t AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr > + lim_max(pProc, RLIMIT_DATA)); > - PROC_UNLOCK(pProc); > + vm_offset_t AddrR3; > + if (R3PtrFixed == (RTR3PTR)-1) > + { > + // is this needed? > + PROC_LOCK(pProc); > + AddrR3 = round_page((vm_offset_t)pProc->p_vmspace->vm_daddr + lim_ma > x(pProc, RLIMIT_DATA)); > + PROC_UNLOCK(pProc); > + } > + else > + AddrR3 = (vm_offset_t)R3PtrFixed; > > - /* Insert the object in the map. */ > + /* Insert the pObject in the map. */ > + vm_object_reference(pMemToMapFreeBSD->pObject); > rc = vm_map_find(pProcMap, /* Map to insert the object in * > / > - NULL, /* Object to map */ > + pMemToMapFreeBSD->pObject, /* Object to map */ > 0, /* Start offset in the object */ > &AddrR3, /* Start address IN/OUT */ > pMemToMap->cb, /* Size of the mapping */ > - TRUE, /* Whether a suitable address sh > ould be searched for first */ > + R3PtrFixed == (RTR3PTR)-1 ? VMFS_ANY_SPACE : VMFS_NO_SP > ACE, > + /* Whether a suitable address sh > ould be searched for first */ > ProtectionFlags, /* protection flags */ > VM_PROT_ALL, /* Maximum protection flags */ > - 0); /* Copy on write */ > + 0); /* copy-on-write and similar fla > gs */ > > - /* Map the memory page by page into the destination map. */ > if (rc == KERN_SUCCESS) > { > - size_t cPages = pMemToMap->cb >> PAGE_SHIFT;; > - pmap_t pPhysicalMap = pProcMap->pmap; > - vm_offset_t AddrR3Dst = AddrR3; > - > - if ( pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS > - || pMemToMap->enmType == RTR0MEMOBJTYPE_PHYS_NC > - || pMemToMap->enmType == RTR0MEMOBJTYPE_PAGE) > - { > - /* Mapping physical allocations */ > - Assert(cPages == pMemToMapFreeBSD->u.Phys.cPages); > + rc = vm_map_wire(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_MAP_WI > RE_USER|VM_MAP_WIRE_NOHOLES); > + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); > > - /* Insert the memory page by page into the mapping. */ > - for (uint32_t iPage = 0; iPage < cPages; iPage++) > - { > - vm_page_t pPage = pMemToMapFreeBSD->u.Phys.apPages[iPage]; > + rc = vm_map_inherit(pProcMap, AddrR3, AddrR3 + pMemToMap->cb, VM_INH > ERIT_SHARE); > + AssertMsg(rc == KERN_SUCCESS, ("%#x\n", rc)); > > - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlag > s, TRUE); > - AddrR3Dst += PAGE_SIZE; > - } > - } > - else > - { > - /* Mapping cont or low memory types */ > - vm_offset_t AddrToMap = (vm_offset_t)pMemToMap->pv; > - > - for (uint32_t iPage = 0; iPage < cPages; iPage++) > - { > - vm_page_t pPage = PHYS_TO_VM_PAGE(vtophys(AddrToMap)); > - > - MY_PMAP_ENTER(pPhysicalMap, AddrR3Dst, pPage, ProtectionFlag > s, TRUE); > - AddrR3Dst += PAGE_SIZE; > - AddrToMap += PAGE_SIZE; > - } > - } > - } > - > - if (RT_SUCCESS(rc)) > - { > /* > * Create a mapping object for it. > */ > @@ -805,9 +727,11 @@ > return VINF_SUCCESS; > } > > - rc = vm_map_remove(pProcMap, ((vm_offset_t)AddrR3), ((vm_offset_t)Ad > drR3) + pMemToMap->cb); > + rc = vm_map_remove(pProcMap, AddrR3, AddrR3 + pMemToMap->cb); > AssertMsg(rc == KERN_SUCCESS, ("Deleting mapping failed\n")); > } > + else > + vm_object_deallocate(pMemToMapFreeBSD->pObject); > > return VERR_NO_MEMORY; > } > @@ -855,49 +779,47 @@ > return NIL_RTHCPHYS; > } > > - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << P > AGE_SHIFT); > + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage) > ; > > struct proc *pProc = (struct proc *)pMemFreeBSD->Core.u.L > ock.R0Process; > struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; > - pmap_t pPhysicalMap = pProcMap->pmap; > + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); > > return pmap_extract(pPhysicalMap, pb); > } > > case RTR0MEMOBJTYPE_MAPPING: > { > - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << P > AGE_SHIFT); > + vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + ptoa(iPage) > ; > > if (pMemFreeBSD->Core.u.Mapping.R0Process != NIL_RTR0PROCESS) > { > struct proc *pProc = (struct proc *)pMemFreeBSD->Core > .u.Mapping.R0Process; > struct vm_map *pProcMap = &pProc->p_vmspace->vm_map; > - pmap_t pPhysicalMap = pProcMap->pmap; > + pmap_t pPhysicalMap = vm_map_pmap(pProcMap); > > return pmap_extract(pPhysicalMap, pb); > } > return vtophys(pb); > } > > - case RTR0MEMOBJTYPE_CONT: > - return pMemFreeBSD->Core.u.Cont.Phys + (iPage << PAGE_SHIFT); > - > - case RTR0MEMOBJTYPE_PHYS: > - return pMemFreeBSD->Core.u.Phys.PhysBase + (iPage << PAGE_SHIFT) > ; > - > case RTR0MEMOBJTYPE_PAGE: > - case RTR0MEMOBJTYPE_PHYS_NC: > - return VM_PAGE_TO_PHYS(pMemFreeBSD->u.Phys.apPages[iPage]); > - > -#ifdef USE_KMEM_ALLOC_ATTR > case RTR0MEMOBJTYPE_LOW: > + case RTR0MEMOBJTYPE_PHYS_NC: > { > - vm_offset_t pb = (vm_offset_t)pMemFreeBSD->Core.pv + (iPage << P > AGE_SHIFT); > - return vtophys(pb); > + RTHCPHYS addr; > + VM_OBJECT_LOCK(pMemFreeBSD->pObject); > + addr = VM_PAGE_TO_PHYS(vm_page_lookup(pMemFreeBSD->pObject, iPag > e)); > + VM_OBJECT_UNLOCK(pMemFreeBSD->pObject); > + return addr; > } > -#else > - case RTR0MEMOBJTYPE_LOW: > -#endif > + > + case RTR0MEMOBJTYPE_PHYS: > + return pMemFreeBSD->Core.u.Cont.Phys + ptoa(iPage); > + > + case RTR0MEMOBJTYPE_CONT: > + return pMemFreeBSD->Core.u.Phys.PhysBase + ptoa(iPage); > + > case RTR0MEMOBJTYPE_RES_VIRT: > default: > return NIL_RTHCPHYS; > > --------------080309080104030002060603 > Content-Type: text/plain; charset="us-ascii" > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Content-Disposition: inline > > _______________________________________________ > freebsd-emulation@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-emulation > To unsubscribe, send any mail to "freebsd-emulation-unsubscribe@freebsd.org" > > --------------080309080104030002060603-- > > From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 23 02:19:21 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E7CAF106566C; Thu, 23 Feb 2012 02:19:21 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-197-151.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 9ECA214FD75; Thu, 23 Feb 2012 02:19:21 +0000 (UTC) Message-ID: <4F45A229.4030407@FreeBSD.org> Date: Wed, 22 Feb 2012 18:19:21 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD i386; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Andriy Gapon References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <4F44C228.5030507@FreeBSD.org> <4F44C7E2.3020801@FreeBSD.org> <4F457AE8.4090708@FreeBSD.org> In-Reply-To: <4F457AE8.4090708@FreeBSD.org> X-Enigmail-Version: 1.3.5 OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 02:19:22 -0000 On 02/22/2012 15:31, Andriy Gapon wrote: > on 22/02/2012 12:48 Doug Barton said the following: >> On 02/22/2012 02:23, Andriy Gapon wrote: >>> The attached patched should try to grab the memory harder. >> >> Same result, different memory address: >> >> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >> vboxdrv: supdrvInitDevExt failed, rc=-8 >> module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 > > OK, now that, thanks to more testers, I realize that this issue is entirely > i386-specific, I think that I might have been barking at the wrong trees. > Now something very i386-ish to try to deal with the problem - the usual patch > file is attached. This gives much better results. :) I can kldload the module, and get this on the command line: vboxdrv: fAsync=0 offMin=0x3596 offMax=0xa897 VirtualBox works, and I can start win xp (my only 32-bit guest). In 4.0 trying to do 'restart' with XP would hang the XP window forever.... I tried it with 4.1 and it not only hung the XP guest window, it hung my X session. Fortunately I was able to Ctrl-Alt-F1 and kill it from the outside, and didn't have any problems after that. Start/Stop from within XP worked as expected. >> ... and not sure it's relevant, but both times I've tried loading these >> modules it has killed my sound. /dev/mixer goes away, and I have to >> reboot to get it back. This has never happened before, so I'm pretty >> sure it's connected. > > No ideas whatsoever at this front. Didn't happen this time, so I'm guessing some sort of memory corruption from the failed module load was wiping out the mixer device. Thanks again, Doug -- It's always a long day; 86400 doesn't fit into a short. Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 23 06:26:36 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AC351065670; Thu, 23 Feb 2012 06:26:36 +0000 (UTC) (envelope-from Cy.Schubert@komquats.com) Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9]) by mx1.freebsd.org (Postfix) with ESMTP id ADC4A8FC15; Thu, 23 Feb 2012 06:26:35 +0000 (UTC) Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd5ml2no-ssvc.prod.shaw.ca) ([10.0.144.222]) by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 22 Feb 2012 23:26:34 -0700 X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=m05oFQ/DU99dGqsFIml08suKTIzCBvSA/J37eL+THWw= c=1 sm=1 a=hunnjcbhBuQA:10 a=QrugwKR0C_UA:10 a=wAGQQ9Az6v0A:10 a=BLceEmwcHowA:10 a=ICAaq7hcmGcA:10 a=kj9zAlcOel0A:10 a=IbtKDeXwb2+SRU442/pi3A==:17 a=6I5d2MoRAAAA:8 a=BWvPGDcYAAAA:8 a=bes9EIX-J0dLThgs9jAA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=V7tsTZBp22UA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Received: from unknown (HELO spqr.komquats.com) ([96.50.7.119]) by pd5ml2no-dmz.prod.shaw.ca with ESMTP; 22 Feb 2012 23:26:34 -0700 Received: from slippy.cwsent.com (slippy3.cwsent.com [10.1.3.91]) by spqr.komquats.com (Postfix) with ESMTP id 18A2446B6F; Wed, 22 Feb 2012 22:26:33 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.14.5/8.14.5) with ESMTP id q1N6QXr3003939; Wed, 22 Feb 2012 22:26:33 -0800 (PST) (envelope-from Cy.Schubert@komquats.com) Message-Id: <201202230626.q1N6QXr3003939@slippy.cwsent.com> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.3 From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.komquats.com/ To: Andriy Gapon In-Reply-To: Message from Andriy Gapon of "Thu, 23 Feb 2012 01:31:52 +0200." <4F457AE8.4090708@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 22 Feb 2012 22:26:33 -0800 Cc: freebsd-emulation@FreeBSD.org, Doug Barton , decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Cy Schubert List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 06:26:36 -0000 In message <4F457AE8.4090708@FreeBSD.org>, Andriy Gapon writes: > on 22/02/2012 12:48 Doug Barton said the following: > > On 02/22/2012 02:23, Andriy Gapon wrote: > >> The attached patched should try to grab the memory harder. > > > > Same result, different memory address: > > > > supdrvGipCreate: failed to allocate the GIP page. rc=-8 > > vboxdrv: supdrvInitDevExt failed, rc=-8 > > module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 > > OK, now that, thanks to more testers, I realize that this issue is entirely > i386-specific, I think that I might have been barking at the wrong trees. > Now something very i386-ish to try to deal with the problem - the usual patch > file is attached. The patch tests out OK on 8.2 and 9.0. No panic. Fedora 16 runs nicely under vbox. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 23 23:12:10 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3B62A1065676; Thu, 23 Feb 2012 23:12:10 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id E44908FC0A; Thu, 23 Feb 2012 23:12:08 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA22332; Fri, 24 Feb 2012 01:12:07 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S0hpW-0003NC-NK; Fri, 24 Feb 2012 01:12:06 +0200 Message-ID: <4F46C7C2.9090109@FreeBSD.org> Date: Fri, 24 Feb 2012 01:12:02 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Doug Barton References: <4F44147C.8050905@FreeBSD.org> <4F442E1E.4010501@FreeBSD.org> <4F446391.4070101@FreeBSD.org> <4F44B362.7000103@FreeBSD.org> <4F44B4BF.5070402@FreeBSD.org> <4F44C228.5030507@FreeBSD.org> <4F44C7E2.3020801@FreeBSD.org> <4F457AE8.4090708@FreeBSD.org> <4F45A229.4030407@FreeBSD.org> In-Reply-To: <4F45A229.4030407@FreeBSD.org> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 23:12:10 -0000 on 23/02/2012 04:19 Doug Barton said the following: > This gives much better results. :) I can kldload the module, and get > this on the command line: > vboxdrv: fAsync=0 offMin=0x3596 offMax=0xa897 Thank you for reporting and testing! -- Andriy Gapon From owner-freebsd-emulation@FreeBSD.ORG Thu Feb 23 23:12:40 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2F081065673; Thu, 23 Feb 2012 23:12:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 868D18FC19; Thu, 23 Feb 2012 23:12:39 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA22340; Fri, 24 Feb 2012 01:12:32 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S0hpw-0003NF-6O; Fri, 24 Feb 2012 01:12:32 +0200 Message-ID: <4F46C7DF.2060807@FreeBSD.org> Date: Fri, 24 Feb 2012 01:12:31 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Cy Schubert References: <201202230626.q1N6QXr3003939@slippy.cwsent.com> In-Reply-To: <201202230626.q1N6QXr3003939@slippy.cwsent.com> X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org, decke@FreeBSD.org, FreeBSD ports list Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 23:12:40 -0000 on 23/02/2012 08:26 Cy Schubert said the following: > In message <4F457AE8.4090708@FreeBSD.org>, Andriy Gapon writes: >> on 22/02/2012 12:48 Doug Barton said the following: >>> On 02/22/2012 02:23, Andriy Gapon wrote: >>>> The attached patched should try to grab the memory harder. >>> >>> Same result, different memory address: >>> >>> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >>> vboxdrv: supdrvInitDevExt failed, rc=-8 >>> module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 >> >> OK, now that, thanks to more testers, I realize that this issue is entirely >> i386-specific, I think that I might have been barking at the wrong trees. >> Now something very i386-ish to try to deal with the problem - the usual patch >> file is attached. > > The patch tests out OK on 8.2 and 9.0. No panic. Fedora 16 runs nicely under vbox. Thank you for testing! -- Andriy Gapon From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 00:56:35 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFDA11065670; Fri, 24 Feb 2012 00:56:35 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 7E8C78FC08; Fri, 24 Feb 2012 00:56:35 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q1O0uYBW089006; Thu, 23 Feb 2012 17:56:34 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q1O0uYCO089003; Thu, 23 Feb 2012 17:56:34 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Thu, 23 Feb 2012 17:56:34 -0700 (MST) From: Warren Block To: Andriy Gapon In-Reply-To: <4F46C7DF.2060807@FreeBSD.org> Message-ID: References: <201202230626.q1N6QXr3003939@slippy.cwsent.com> <4F46C7DF.2060807@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Thu, 23 Feb 2012 17:56:34 -0700 (MST) Cc: freebsd-emulation@freebsd.org Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 00:56:35 -0000 On Fri, 24 Feb 2012, Andriy Gapon wrote: > on 23/02/2012 08:26 Cy Schubert said the following: >> In message <4F457AE8.4090708@FreeBSD.org>, Andriy Gapon writes: >>> on 22/02/2012 12:48 Doug Barton said the following: >>>> On 02/22/2012 02:23, Andriy Gapon wrote: >>>>> The attached patched should try to grab the memory harder. >>>> >>>> Same result, different memory address: >>>> >>>> supdrvGipCreate: failed to allocate the GIP page. rc=-8 >>>> vboxdrv: supdrvInitDevExt failed, rc=-8 >>>> module_register_init: MOD_LOAD (vboxdrv, 0xc66e8410, 0) error 12 >>> >>> OK, now that, thanks to more testers, I realize that this issue is entirely >>> i386-specific, I think that I might have been barking at the wrong trees. >>> Now something very i386-ish to try to deal with the problem - the usual patch >>> file is attached. >> >> The patch tests out OK on 8.2 and 9.0. No panic. Fedora 16 runs nicely under vbox. > > Thank you for testing! The later version of the port works now. The patch file in it is different from the second one posted here; should I try the patch? From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 09:26:31 2012 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4D5E1065676 for ; Fri, 24 Feb 2012 09:26:31 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 010548FC19 for ; Fri, 24 Feb 2012 09:26:30 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA28671; Fri, 24 Feb 2012 11:26:21 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1S0rPw-0006CI-MF; Fri, 24 Feb 2012 11:26:20 +0200 Message-ID: <4F4757BA.10301@FreeBSD.org> Date: Fri, 24 Feb 2012 11:26:18 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:10.0.2) Gecko/20120218 Thunderbird/10.0.2 MIME-Version: 1.0 To: Warren Block References: <201202230626.q1N6QXr3003939@slippy.cwsent.com> <4F46C7DF.2060807@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 1.3.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-emulation@FreeBSD.org Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 09:26:31 -0000 on 24/02/2012 02:56 Warren Block said the following: > The later version of the port works now. The patch file in it is different from > the second one posted here; should I try the patch? I depends. The patch in the port now represents a rollback of problematic changes. The patch that I sent represents a fix in those changes. -- Andriy Gapon From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 12:51:07 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DE9A1065675 for ; Fri, 24 Feb 2012 12:51:07 +0000 (UTC) (envelope-from bengta@P142.sics.se) Received: from sink.sics.se (sink.sics.se [193.10.64.88]) by mx1.freebsd.org (Postfix) with ESMTP id BB2D38FC08 for ; Fri, 24 Feb 2012 12:51:06 +0000 (UTC) Received: from P142.sics.se (P142.sics.se [193.10.66.253]) by sink.sics.se (8.14.4/8.14.4) with ESMTP id q1OCRMsi063381 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 13:27:22 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: from P142.sics.se (localhost [127.0.0.1]) by P142.sics.se (8.14.5/8.14.4) with ESMTP id q1OCROYr003148; Fri, 24 Feb 2012 13:27:24 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: (from bengta@localhost) by P142.sics.se (8.14.5/8.14.5/Submit) id q1OCROEP003147; Fri, 24 Feb 2012 13:27:24 +0100 (CET) (envelope-from bengta@P142.sics.se) From: Bengt Ahlgren To: emulation@freebsd.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) Date: Fri, 24 Feb 2012 13:27:24 +0100 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: Subject: [Bengt Ahlgren] 8.3-PRERELEASE panic in linux emulation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 12:51:07 -0000 --=-=-= Hello! Perhaps emulation@ is a better place to report this problem? Bengt --=-=-= Content-Type: message/rfc822 Content-Disposition: inline X-From-Line: bengta@P142.sics.se Thu Feb 23 17:26:50 2012 Return-Path: Received: from letter.sics.se [193.10.64.6] by P142.sics.se with IMAP (fetchmail-6.3.20) for (single-drop); Thu, 23 Feb 2012 17:26:50 +0100 (CET) Received: from letter.sics.se ([unix socket]) by letter.sics.se (Cyrus v2.3.14) with LMTPA; Thu, 23 Feb 2012 17:26:31 +0100 X-Sieve: CMU Sieve 2.3 Received: from sink.sics.se (sink.sics.se [193.10.64.88]) by letter.sics.se (Postfix) with ESMTPS id EA39F40139 for ; Thu, 23 Feb 2012 17:26:30 +0100 (CET) Received: from P142.sics.se (P142.sics.se [193.10.66.253]) by sink.sics.se (8.14.4/8.14.4) with ESMTP id q1NGQUq4060739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Feb 2012 17:26:30 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: from P142.sics.se (localhost [127.0.0.1]) by P142.sics.se (8.14.5/8.14.4) with ESMTP id q1NGQW7N002003; Thu, 23 Feb 2012 17:26:32 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: (from bengta@localhost) by P142.sics.se (8.14.5/8.14.5/Submit) id q1NGQWUV002002; Thu, 23 Feb 2012 17:26:32 +0100 (CET) (envelope-from bengta@P142.sics.se) From: Bengt Ahlgren To: stable@freebsd.org Subject: 8.3-PRERELEASE panic in linux emulation User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) Date: Thu, 23 Feb 2012 17:26:32 +0100 Message-ID: Xref: P142.sics.se bug-reports:179 Lines: 53 MIME-Version: 1.0 Hi! I get a consistent panic when starting acroread after updating to 8.3-PRERELEASE. An 8.2-STABLE from Feb 4th was OK. Can provide more info if needed. Bengt FreeBSD xx.yy.zz 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #13 r231999: Wed Feb 22 21:01:38 CET 2012 bengta@P142.sics.se:/usr/obj/usr/src/sys/P142-82 i386 Fatal trap 12: page fault while in kernel mode fault virtual address = 0xbfbfdffc fault code = supervisor write, page not present instruction pointer = 0x20:0xc50b396c stack pointer = 0x28:0xe7481a6c frame pointer = 0x28:0xe7481a90 code segment = base 0x0, limit 0xfffff, type 0x1b = DPL 0, pres 1, def32 1, gran 1 processor eflags = interrupt enabled, resume, IOPL = 0 current process = 1997 (bash) trap number = 12 panic: page fault KDB: stack backtrace: db_trace_self_wrapper(c091af2a,70797420,78302065,a0d6231,c5d6b600,...) at db_trace_self_wrapper+0x26 kdb_backtrace(c0919061,c09b49a0,c0900251,e7481910,e7481910,...) at kdb_backtrace+0x2a panic(c0900251,c0941cab,c5c246e8,1,1,...) at panic+0xaf trap_fatal(c0670d02,0,e7481964,80400,c5c24580,...) at trap_fatal+0x353 trap_pfault(e74819cc,bfbfe190,c5c24580,202,c5cecac0,...) at trap_pfault+0x87 trap(e7481a2c) at trap+0x453 calltrap() at calltrap+0x6 --- trap 0xc, eip = 0xc50b396c, esp = 0xe7481a6c, ebp = 0xe7481a90 --- elf_linux_fixup(e7481c0c,e7481b98,c065ca92,c60ffce8,100000,...) at elf_linux_fixup+0x33c kern_execve(c5c24580,e7481c3c,0,8112710,8116cd8,...) at kern_execve+0x7d6 linux_execve(c5c24580,e7481cec,c,c,c,...) at linux_execve+0xa7 syscall(e7481d28) at syscall+0x372 Xint0x80_syscall() at Xint0x80_syscall+0x21 --- syscall (11, Linux ELF, linux_execve), eip = 0x281e0d4a, esp = 0xbfbfd644, ebp = 0xbfbfd7e8 --- #0 doadump () at pcpu.h:244 #1 0xc05de609 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:441 #2 0xc05de84f in panic (fmt=Variable "fmt" is not available. ) at /usr/src/sys/kern/kern_shutdown.c:614 #3 0xc08b22c3 in trap_fatal (frame=0xe7481a2c, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:981 #4 0xc08b2357 in trap_pfault (frame=0xe7481a2c, usermode=0, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:843 #5 0xc08b3133 in trap (frame=0xe7481a2c) at /usr/src/sys/i386/i386/trap.c:562 #6 0xc089bedc in calltrap () at /usr/src/sys/i386/i386/exception.s:168 #7 0xc50b396c in elf_linux_fixup (stack_base=0xe7481c0c, imgp=0xe7481b98) at /usr/src/sys/modules/linux/../../i386/linux/linux_sysvec.c:288 #8 0xc05ac636 in kern_execve (td=0xc5c24580, args=0xe7481c3c, mac_p=0x0) at /usr/src/sys/kern/kern_exec.c:551 #9 0xc50ab387 in linux_execve (td=0xc5c24580, args=0xe7481cec) at /usr/src/sys/modules/linux/../../i386/linux/linux_machdep.c:143 #10 0xc08b2902 in syscall (frame=0xe7481d28) at subr_syscall.c:114 #11 0xc089bf41 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:266 #12 0x00000033 in ?? () --=-=-=-- From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 14:53:42 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCB841065672 for ; Fri, 24 Feb 2012 14:53:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4A7F68FC14 for ; Fri, 24 Feb 2012 14:53:41 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q1OETeVl093513; Fri, 24 Feb 2012 16:29:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q1OETe6R002075; Fri, 24 Feb 2012 16:29:40 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q1OETenx002074; Fri, 24 Feb 2012 16:29:40 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Feb 2012 16:29:40 +0200 From: Konstantin Belousov To: Bengt Ahlgren Message-ID: <20120224142940.GR55074@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cycRQitB/3DOnQyb" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: emulation@freebsd.org Subject: Re: [Bengt Ahlgren] 8.3-PRERELEASE panic in linux emulation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 14:53:42 -0000 --cycRQitB/3DOnQyb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 24, 2012 at 01:27:24PM +0100, Bengt Ahlgren wrote: > Hello! >=20 > Perhaps emulation@ is a better place to report this problem? >=20 > Bengt >=20 > From: Bengt Ahlgren > To: stable@freebsd.org > Subject: 8.3-PRERELEASE panic in linux emulation > Date: Thu, 23 Feb 2012 17:26:32 +0100 >=20 > Hi! >=20 > I get a consistent panic when starting acroread after updating to > 8.3-PRERELEASE. An 8.2-STABLE from Feb 4th was OK. Can provide more > info if needed. >=20 > Bengt >=20 > FreeBSD xx.yy.zz 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #13 r231999: Wed F= eb 22 21:01:38 CET 2012 bengta@P142.sics.se:/usr/obj/usr/src/sys/P142-8= 2 i386 >=20 > Fatal trap 12: page fault while in kernel mode > fault virtual address =3D 0xbfbfdffc > fault code =3D supervisor write, page not present > instruction pointer =3D 0x20:0xc50b396c > stack pointer =3D 0x28:0xe7481a6c > frame pointer =3D 0x28:0xe7481a90 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, def32 1, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 1997 (bash) > trap number =3D 12 > panic: page fault > KDB: stack backtrace: > db_trace_self_wrapper(c091af2a,70797420,78302065,a0d6231,c5d6b600,...) at= db_trace_self_wrapper+0x26 > kdb_backtrace(c0919061,c09b49a0,c0900251,e7481910,e7481910,...) at kdb_ba= cktrace+0x2a > panic(c0900251,c0941cab,c5c246e8,1,1,...) at panic+0xaf > trap_fatal(c0670d02,0,e7481964,80400,c5c24580,...) at trap_fatal+0x353 > trap_pfault(e74819cc,bfbfe190,c5c24580,202,c5cecac0,...) at trap_pfault+0= x87 > trap(e7481a2c) at trap+0x453 > calltrap() at calltrap+0x6 > --- trap 0xc, eip =3D 0xc50b396c, esp =3D 0xe7481a6c, ebp =3D 0xe7481a90 = --- > elf_linux_fixup(e7481c0c,e7481b98,c065ca92,c60ffce8,100000,...) at elf_li= nux_fixup+0x33c > kern_execve(c5c24580,e7481c3c,0,8112710,8116cd8,...) at kern_execve+0x7d6 > linux_execve(c5c24580,e7481cec,c,c,c,...) at linux_execve+0xa7 > syscall(e7481d28) at syscall+0x372 > Xint0x80_syscall() at Xint0x80_syscall+0x21 > --- syscall (11, Linux ELF, linux_execve), eip =3D 0x281e0d4a, esp =3D 0x= bfbfd644, ebp =3D 0xbfbfd7e8 --- >=20 > #0 doadump () at pcpu.h:244 > #1 0xc05de609 in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c= :441 > #2 0xc05de84f in panic (fmt=3DVariable "fmt" is not available. > ) at /usr/src/sys/kern/kern_shutdown.c:614 > #3 0xc08b22c3 in trap_fatal (frame=3D0xe7481a2c, eva=3D3217022972) at /u= sr/src/sys/i386/i386/trap.c:981 > #4 0xc08b2357 in trap_pfault (frame=3D0xe7481a2c, usermode=3D0, eva=3D32= 17022972) at /usr/src/sys/i386/i386/trap.c:843 > #5 0xc08b3133 in trap (frame=3D0xe7481a2c) at /usr/src/sys/i386/i386/tra= p.c:562 > #6 0xc089bedc in calltrap () at /usr/src/sys/i386/i386/exception.s:168 > #7 0xc50b396c in elf_linux_fixup (stack_base=3D0xe7481c0c, imgp=3D0xe748= 1b98) at /usr/src/sys/modules/linux/../../i386/linux/linux_sysvec.c:288 > #8 0xc05ac636 in kern_execve (td=3D0xc5c24580, args=3D0xe7481c3c, mac_p= =3D0x0) at /usr/src/sys/kern/kern_exec.c:551 > #9 0xc50ab387 in linux_execve (td=3D0xc5c24580, args=3D0xe7481cec) at /u= sr/src/sys/modules/linux/../../i386/linux/linux_machdep.c:143 > #10 0xc08b2902 in syscall (frame=3D0xe7481d28) at subr_syscall.c:114 > #11 0xc089bf41 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception= .s:266 > #12 0x00000033 in ?? () >=20 I am not sure if this is the real cause of your panic, but the line from the backtrace indeed has a bug. Please try the change below. diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 7634138..d4e23e1 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -227,11 +227,11 @@ linux_fixup(register_t **stack_base, struct image_par= ams *imgp) argv =3D *stack_base; envp =3D *stack_base + (imgp->args->argc + 1); (*stack_base)--; - **stack_base =3D (intptr_t)(void *)envp; + suword(*stack_base, (intptr_t)(void *)envp); (*stack_base)--; - **stack_base =3D (intptr_t)(void *)argv; + suword(*stack_base, (intptr_t)(void *)argv); (*stack_base)--; - **stack_base =3D imgp->args->argc; + suword(*stack_base, imgp->args->argc); return (0); } =20 @@ -286,7 +286,7 @@ elf_linux_fixup(register_t **stack_base, struct image_p= arams *imgp) imgp->auxargs =3D NULL; =20 (*stack_base)--; - **stack_base =3D (register_t)imgp->args->argc; + suword(*stack_base, (register_t)imgp->args->argc); return (0); } =20 --cycRQitB/3DOnQyb Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9HntMACgkQC3+MBN1Mb4jbhgCgrqZVU6oOBIjEtwlLtDsqMJ9r xvYAoK8n8ICvdpl6yB4+DUjJMoU2L+1S =YcYj -----END PGP SIGNATURE----- --cycRQitB/3DOnQyb-- From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 17:27:22 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7F9C106564A for ; Fri, 24 Feb 2012 17:27:22 +0000 (UTC) (envelope-from bengta@P142.sics.se) Received: from sink.sics.se (sink.sics.se [193.10.64.88]) by mx1.freebsd.org (Postfix) with ESMTP id 178B98FC12 for ; Fri, 24 Feb 2012 17:27:21 +0000 (UTC) Received: from P142.sics.se (P142.sics.se [193.10.66.253]) by sink.sics.se (8.14.4/8.14.4) with ESMTP id q1OHRJBG063936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 18:27:19 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: from P142.sics.se (localhost [127.0.0.1]) by P142.sics.se (8.14.5/8.14.4) with ESMTP id q1OHRLt5018936; Fri, 24 Feb 2012 18:27:21 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: (from bengta@localhost) by P142.sics.se (8.14.5/8.14.5/Submit) id q1OHRJ62018916; Fri, 24 Feb 2012 18:27:19 +0100 (CET) (envelope-from bengta@P142.sics.se) From: Bengt Ahlgren To: Konstantin Belousov In-Reply-To: <20120224142940.GR55074@deviant.kiev.zoral.com.ua> (Konstantin Belousov's message of "Fri, 24 Feb 2012 16:29:40 +0200") References: <20120224142940.GR55074@deviant.kiev.zoral.com.ua> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) Date: Fri, 24 Feb 2012 18:27:19 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: emulation@freebsd.org Subject: Re: [Bengt Ahlgren] 8.3-PRERELEASE panic in linux emulation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 17:27:22 -0000 Konstantin Belousov writes: > On Fri, Feb 24, 2012 at 01:27:24PM +0100, Bengt Ahlgren wrote: >> Hello! >> >> Perhaps emulation@ is a better place to report this problem? >> >> Bengt >> > >> From: Bengt Ahlgren >> To: stable@freebsd.org >> Subject: 8.3-PRERELEASE panic in linux emulation >> Date: Thu, 23 Feb 2012 17:26:32 +0100 >> >> Hi! >> >> I get a consistent panic when starting acroread after updating to >> 8.3-PRERELEASE. An 8.2-STABLE from Feb 4th was OK. Can provide more >> info if needed. >> >> Bengt >> >> FreeBSD xx.yy.zz 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #13 r231999: Wed Feb 22 21:01:38 CET 2012 bengta@P142.sics.se:/usr/obj/usr/src/sys/P142-82 i386 >> >> Fatal trap 12: page fault while in kernel mode >> fault virtual address = 0xbfbfdffc >> fault code = supervisor write, page not present >> instruction pointer = 0x20:0xc50b396c >> stack pointer = 0x28:0xe7481a6c >> frame pointer = 0x28:0xe7481a90 >> code segment = base 0x0, limit 0xfffff, type 0x1b >> = DPL 0, pres 1, def32 1, gran 1 >> processor eflags = interrupt enabled, resume, IOPL = 0 >> current process = 1997 (bash) >> trap number = 12 >> panic: page fault >> KDB: stack backtrace: >> db_trace_self_wrapper(c091af2a,70797420,78302065,a0d6231,c5d6b600,...) at db_trace_self_wrapper+0x26 >> kdb_backtrace(c0919061,c09b49a0,c0900251,e7481910,e7481910,...) at kdb_backtrace+0x2a >> panic(c0900251,c0941cab,c5c246e8,1,1,...) at panic+0xaf >> trap_fatal(c0670d02,0,e7481964,80400,c5c24580,...) at trap_fatal+0x353 >> trap_pfault(e74819cc,bfbfe190,c5c24580,202,c5cecac0,...) at trap_pfault+0x87 >> trap(e7481a2c) at trap+0x453 >> calltrap() at calltrap+0x6 >> --- trap 0xc, eip = 0xc50b396c, esp = 0xe7481a6c, ebp = 0xe7481a90 --- >> elf_linux_fixup(e7481c0c,e7481b98,c065ca92,c60ffce8,100000,...) at elf_linux_fixup+0x33c >> kern_execve(c5c24580,e7481c3c,0,8112710,8116cd8,...) at kern_execve+0x7d6 >> linux_execve(c5c24580,e7481cec,c,c,c,...) at linux_execve+0xa7 >> syscall(e7481d28) at syscall+0x372 >> Xint0x80_syscall() at Xint0x80_syscall+0x21 >> --- syscall (11, Linux ELF, linux_execve), eip = 0x281e0d4a, esp = 0xbfbfd644, ebp = 0xbfbfd7e8 --- >> >> #0 doadump () at pcpu.h:244 >> #1 0xc05de609 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:441 >> #2 0xc05de84f in panic (fmt=Variable "fmt" is not available. >> ) at /usr/src/sys/kern/kern_shutdown.c:614 >> #3 0xc08b22c3 in trap_fatal (frame=0xe7481a2c, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:981 >> #4 0xc08b2357 in trap_pfault (frame=0xe7481a2c, usermode=0, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:843 >> #5 0xc08b3133 in trap (frame=0xe7481a2c) at /usr/src/sys/i386/i386/trap.c:562 >> #6 0xc089bedc in calltrap () at /usr/src/sys/i386/i386/exception.s:168 >> #7 0xc50b396c in elf_linux_fixup (stack_base=0xe7481c0c, imgp=0xe7481b98) at /usr/src/sys/modules/linux/../../i386/linux/linux_sysvec.c:288 >> #8 0xc05ac636 in kern_execve (td=0xc5c24580, args=0xe7481c3c, mac_p=0x0) at /usr/src/sys/kern/kern_exec.c:551 >> #9 0xc50ab387 in linux_execve (td=0xc5c24580, args=0xe7481cec) at /usr/src/sys/modules/linux/../../i386/linux/linux_machdep.c:143 >> #10 0xc08b2902 in syscall (frame=0xe7481d28) at subr_syscall.c:114 >> #11 0xc089bf41 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:266 >> #12 0x00000033 in ?? () >> > I am not sure if this is the real cause of your panic, but the line from > the backtrace indeed has a bug. Please try the change below. > > diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c > index 7634138..d4e23e1 100644 > --- a/sys/i386/linux/linux_sysvec.c > +++ b/sys/i386/linux/linux_sysvec.c > @@ -227,11 +227,11 @@ linux_fixup(register_t **stack_base, struct image_params *imgp) > argv = *stack_base; > envp = *stack_base + (imgp->args->argc + 1); > (*stack_base)--; > - **stack_base = (intptr_t)(void *)envp; > + suword(*stack_base, (intptr_t)(void *)envp); > (*stack_base)--; > - **stack_base = (intptr_t)(void *)argv; > + suword(*stack_base, (intptr_t)(void *)argv); > (*stack_base)--; > - **stack_base = imgp->args->argc; > + suword(*stack_base, imgp->args->argc); > return (0); > } > > @@ -286,7 +286,7 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) > imgp->auxargs = NULL; > > (*stack_base)--; > - **stack_base = (register_t)imgp->args->argc; > + suword(*stack_base, (register_t)imgp->args->argc); > return (0); > } > Thanks for the response! I will try the patch, but that file has not been touched since June 2011. I was suspecting the changes in r231146 and r231148. If there is no change with your patch I will roll back those to see what happens. Bengt From owner-freebsd-emulation@FreeBSD.ORG Fri Feb 24 20:55:38 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD90106566C for ; Fri, 24 Feb 2012 20:55:38 +0000 (UTC) (envelope-from bengta@P142.sics.se) Received: from sink.sics.se (sink.sics.se [193.10.64.88]) by mx1.freebsd.org (Postfix) with ESMTP id 6FDA18FC17 for ; Fri, 24 Feb 2012 20:55:37 +0000 (UTC) Received: from P142.sics.se (h139n3-u-d1.ias.bredband.telia.com [90.228.197.139]) by sink.sics.se (8.14.4/8.14.4) with ESMTP id q1OKtZ8s064338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 24 Feb 2012 21:55:35 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: from P142.sics.se (localhost [127.0.0.1]) by P142.sics.se (8.14.5/8.14.4) with ESMTP id q1OKtWC7005502; Fri, 24 Feb 2012 21:55:32 +0100 (CET) (envelope-from bengta@P142.sics.se) Received: (from bengta@localhost) by P142.sics.se (8.14.5/8.14.5/Submit) id q1OKtVZ7005501; Fri, 24 Feb 2012 21:55:31 +0100 (CET) (envelope-from bengta@P142.sics.se) From: Bengt Ahlgren To: Konstantin Belousov In-Reply-To: (Bengt Ahlgren's message of "Fri, 24 Feb 2012 18:27:19 +0100") References: <20120224142940.GR55074@deviant.kiev.zoral.com.ua> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) Date: Fri, 24 Feb 2012 21:55:31 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: emulation@freebsd.org Subject: Re: [Bengt Ahlgren] 8.3-PRERELEASE panic in linux emulation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2012 20:55:38 -0000 Bengt Ahlgren writes: > Konstantin Belousov writes: > >> On Fri, Feb 24, 2012 at 01:27:24PM +0100, Bengt Ahlgren wrote: >>> Hello! >>> >>> Perhaps emulation@ is a better place to report this problem? >>> >>> Bengt >>> >> >>> From: Bengt Ahlgren >>> To: stable@freebsd.org >>> Subject: 8.3-PRERELEASE panic in linux emulation >>> Date: Thu, 23 Feb 2012 17:26:32 +0100 >>> >>> Hi! >>> >>> I get a consistent panic when starting acroread after updating to >>> 8.3-PRERELEASE. An 8.2-STABLE from Feb 4th was OK. Can provide more >>> info if needed. >>> >>> Bengt >>> >>> FreeBSD xx.yy.zz 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #13 r231999: Wed Feb 22 21:01:38 CET 2012 bengta@P142.sics.se:/usr/obj/usr/src/sys/P142-82 i386 >>> >>> Fatal trap 12: page fault while in kernel mode >>> fault virtual address = 0xbfbfdffc >>> fault code = supervisor write, page not present >>> instruction pointer = 0x20:0xc50b396c >>> stack pointer = 0x28:0xe7481a6c >>> frame pointer = 0x28:0xe7481a90 >>> code segment = base 0x0, limit 0xfffff, type 0x1b >>> = DPL 0, pres 1, def32 1, gran 1 >>> processor eflags = interrupt enabled, resume, IOPL = 0 >>> current process = 1997 (bash) >>> trap number = 12 >>> panic: page fault >>> KDB: stack backtrace: >>> db_trace_self_wrapper(c091af2a,70797420,78302065,a0d6231,c5d6b600,...) at db_trace_self_wrapper+0x26 >>> kdb_backtrace(c0919061,c09b49a0,c0900251,e7481910,e7481910,...) at kdb_backtrace+0x2a >>> panic(c0900251,c0941cab,c5c246e8,1,1,...) at panic+0xaf >>> trap_fatal(c0670d02,0,e7481964,80400,c5c24580,...) at trap_fatal+0x353 >>> trap_pfault(e74819cc,bfbfe190,c5c24580,202,c5cecac0,...) at trap_pfault+0x87 >>> trap(e7481a2c) at trap+0x453 >>> calltrap() at calltrap+0x6 >>> --- trap 0xc, eip = 0xc50b396c, esp = 0xe7481a6c, ebp = 0xe7481a90 --- >>> elf_linux_fixup(e7481c0c,e7481b98,c065ca92,c60ffce8,100000,...) at elf_linux_fixup+0x33c >>> kern_execve(c5c24580,e7481c3c,0,8112710,8116cd8,...) at kern_execve+0x7d6 >>> linux_execve(c5c24580,e7481cec,c,c,c,...) at linux_execve+0xa7 >>> syscall(e7481d28) at syscall+0x372 >>> Xint0x80_syscall() at Xint0x80_syscall+0x21 >>> --- syscall (11, Linux ELF, linux_execve), eip = 0x281e0d4a, esp = 0xbfbfd644, ebp = 0xbfbfd7e8 --- >>> >>> #0 doadump () at pcpu.h:244 >>> #1 0xc05de609 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:441 >>> #2 0xc05de84f in panic (fmt=Variable "fmt" is not available. >>> ) at /usr/src/sys/kern/kern_shutdown.c:614 >>> #3 0xc08b22c3 in trap_fatal (frame=0xe7481a2c, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:981 >>> #4 0xc08b2357 in trap_pfault (frame=0xe7481a2c, usermode=0, eva=3217022972) at /usr/src/sys/i386/i386/trap.c:843 >>> #5 0xc08b3133 in trap (frame=0xe7481a2c) at /usr/src/sys/i386/i386/trap.c:562 >>> #6 0xc089bedc in calltrap () at /usr/src/sys/i386/i386/exception.s:168 >>> #7 0xc50b396c in elf_linux_fixup (stack_base=0xe7481c0c, imgp=0xe7481b98) at /usr/src/sys/modules/linux/../../i386/linux/linux_sysvec.c:288 >>> #8 0xc05ac636 in kern_execve (td=0xc5c24580, args=0xe7481c3c, mac_p=0x0) at /usr/src/sys/kern/kern_exec.c:551 >>> #9 0xc50ab387 in linux_execve (td=0xc5c24580, args=0xe7481cec) at /usr/src/sys/modules/linux/../../i386/linux/linux_machdep.c:143 >>> #10 0xc08b2902 in syscall (frame=0xe7481d28) at subr_syscall.c:114 >>> #11 0xc089bf41 in Xint0x80_syscall () at /usr/src/sys/i386/i386/exception.s:266 >>> #12 0x00000033 in ?? () >>> >> I am not sure if this is the real cause of your panic, but the line from >> the backtrace indeed has a bug. Please try the change below. >> >> diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c >> index 7634138..d4e23e1 100644 >> --- a/sys/i386/linux/linux_sysvec.c >> +++ b/sys/i386/linux/linux_sysvec.c >> @@ -227,11 +227,11 @@ linux_fixup(register_t **stack_base, struct image_params *imgp) >> argv = *stack_base; >> envp = *stack_base + (imgp->args->argc + 1); >> (*stack_base)--; >> - **stack_base = (intptr_t)(void *)envp; >> + suword(*stack_base, (intptr_t)(void *)envp); >> (*stack_base)--; >> - **stack_base = (intptr_t)(void *)argv; >> + suword(*stack_base, (intptr_t)(void *)argv); >> (*stack_base)--; >> - **stack_base = imgp->args->argc; >> + suword(*stack_base, imgp->args->argc); >> return (0); >> } >> >> @@ -286,7 +286,7 @@ elf_linux_fixup(register_t **stack_base, struct image_params *imgp) >> imgp->auxargs = NULL; >> >> (*stack_base)--; >> - **stack_base = (register_t)imgp->args->argc; >> + suword(*stack_base, (register_t)imgp->args->argc); >> return (0); >> } >> > > Thanks for the response! I will try the patch, but that file has not > been touched since June 2011. I was suspecting the changes in r231146 > and r231148. If there is no change with your patch I will roll back > those to see what happens. No panics so far. That patch does indeed seem to solve the problem! I also verified with going back to the old kernel, which again consistently paniced. Thanks very much for good work! I'm a but puzzled though, because that bug must have been there for quite some time without triggering the panic. Bengt From owner-freebsd-emulation@FreeBSD.ORG Sat Feb 25 01:12:35 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 504B6106566B for ; Sat, 25 Feb 2012 01:12:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 8BDC88FC08 for ; Sat, 25 Feb 2012 01:12:34 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q1P1CTpd011435; Sat, 25 Feb 2012 03:12:29 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q1P1CSZ3005005; Sat, 25 Feb 2012 03:12:28 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q1P1CSjD005004; Sat, 25 Feb 2012 03:12:28 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Feb 2012 03:12:28 +0200 From: Konstantin Belousov To: Bengt Ahlgren Message-ID: <20120225011228.GB55074@deviant.kiev.zoral.com.ua> References: <20120224142940.GR55074@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+qlyv6FHKYYAux7U" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: emulation@freebsd.org Subject: Re: [Bengt Ahlgren] 8.3-PRERELEASE panic in linux emulation X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2012 01:12:35 -0000 --+qlyv6FHKYYAux7U Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 24, 2012 at 09:55:31PM +0100, Bengt Ahlgren wrote: > Bengt Ahlgren writes: >=20 > > Konstantin Belousov writes: > > > >> On Fri, Feb 24, 2012 at 01:27:24PM +0100, Bengt Ahlgren wrote: > >>> Hello! > >>>=20 > >>> Perhaps emulation@ is a better place to report this problem? > >>>=20 > >>> Bengt > >>>=20 > >> > >>> From: Bengt Ahlgren > >>> To: stable@freebsd.org > >>> Subject: 8.3-PRERELEASE panic in linux emulation > >>> Date: Thu, 23 Feb 2012 17:26:32 +0100 > >>>=20 > >>> Hi! > >>>=20 > >>> I get a consistent panic when starting acroread after updating to > >>> 8.3-PRERELEASE. An 8.2-STABLE from Feb 4th was OK. Can provide more > >>> info if needed. > >>>=20 > >>> Bengt > >>>=20 > >>> FreeBSD xx.yy.zz 8.3-PRERELEASE FreeBSD 8.3-PRERELEASE #13 r231999: W= ed Feb 22 21:01:38 CET 2012 bengta@P142.sics.se:/usr/obj/usr/src/sys/P1= 42-82 i386 > >>>=20 > >>> Fatal trap 12: page fault while in kernel mode > >>> fault virtual address =3D 0xbfbfdffc > >>> fault code =3D supervisor write, page not present > >>> instruction pointer =3D 0x20:0xc50b396c > >>> stack pointer =3D 0x28:0xe7481a6c > >>> frame pointer =3D 0x28:0xe7481a90 > >>> code segment =3D base 0x0, limit 0xfffff, type 0x1b > >>> =3D DPL 0, pres 1, def32 1, gran 1 > >>> processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > >>> current process =3D 1997 (bash) > >>> trap number =3D 12 > >>> panic: page fault > >>> KDB: stack backtrace: > >>> db_trace_self_wrapper(c091af2a,70797420,78302065,a0d6231,c5d6b600,...= ) at db_trace_self_wrapper+0x26 > >>> kdb_backtrace(c0919061,c09b49a0,c0900251,e7481910,e7481910,...) at kd= b_backtrace+0x2a > >>> panic(c0900251,c0941cab,c5c246e8,1,1,...) at panic+0xaf > >>> trap_fatal(c0670d02,0,e7481964,80400,c5c24580,...) at trap_fatal+0x353 > >>> trap_pfault(e74819cc,bfbfe190,c5c24580,202,c5cecac0,...) at trap_pfau= lt+0x87 > >>> trap(e7481a2c) at trap+0x453 > >>> calltrap() at calltrap+0x6 > >>> --- trap 0xc, eip =3D 0xc50b396c, esp =3D 0xe7481a6c, ebp =3D 0xe7481= a90 --- > >>> elf_linux_fixup(e7481c0c,e7481b98,c065ca92,c60ffce8,100000,...) at el= f_linux_fixup+0x33c > >>> kern_execve(c5c24580,e7481c3c,0,8112710,8116cd8,...) at kern_execve+0= x7d6 > >>> linux_execve(c5c24580,e7481cec,c,c,c,...) at linux_execve+0xa7 > >>> syscall(e7481d28) at syscall+0x372 > >>> Xint0x80_syscall() at Xint0x80_syscall+0x21 > >>> --- syscall (11, Linux ELF, linux_execve), eip =3D 0x281e0d4a, esp = =3D 0xbfbfd644, ebp =3D 0xbfbfd7e8 --- > >>>=20 > >>> #0 doadump () at pcpu.h:244 > >>> #1 0xc05de609 in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdo= wn.c:441 > >>> #2 0xc05de84f in panic (fmt=3DVariable "fmt" is not available. > >>> ) at /usr/src/sys/kern/kern_shutdown.c:614 > >>> #3 0xc08b22c3 in trap_fatal (frame=3D0xe7481a2c, eva=3D3217022972) a= t /usr/src/sys/i386/i386/trap.c:981 > >>> #4 0xc08b2357 in trap_pfault (frame=3D0xe7481a2c, usermode=3D0, eva= =3D3217022972) at /usr/src/sys/i386/i386/trap.c:843 > >>> #5 0xc08b3133 in trap (frame=3D0xe7481a2c) at /usr/src/sys/i386/i386= /trap.c:562 > >>> #6 0xc089bedc in calltrap () at /usr/src/sys/i386/i386/exception.s:1= 68 > >>> #7 0xc50b396c in elf_linux_fixup (stack_base=3D0xe7481c0c, imgp=3D0x= e7481b98) at /usr/src/sys/modules/linux/../../i386/linux/linux_sysvec.c:288 > >>> #8 0xc05ac636 in kern_execve (td=3D0xc5c24580, args=3D0xe7481c3c, ma= c_p=3D0x0) at /usr/src/sys/kern/kern_exec.c:551 > >>> #9 0xc50ab387 in linux_execve (td=3D0xc5c24580, args=3D0xe7481cec) a= t /usr/src/sys/modules/linux/../../i386/linux/linux_machdep.c:143 > >>> #10 0xc08b2902 in syscall (frame=3D0xe7481d28) at subr_syscall.c:114 > >>> #11 0xc089bf41 in Xint0x80_syscall () at /usr/src/sys/i386/i386/excep= tion.s:266 > >>> #12 0x00000033 in ?? () > >>>=20 > >> I am not sure if this is the real cause of your panic, but the line fr= om > >> the backtrace indeed has a bug. Please try the change below. > >> > >> diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysv= ec.c > >> index 7634138..d4e23e1 100644 > >> --- a/sys/i386/linux/linux_sysvec.c > >> +++ b/sys/i386/linux/linux_sysvec.c > >> @@ -227,11 +227,11 @@ linux_fixup(register_t **stack_base, struct imag= e_params *imgp) > >> argv =3D *stack_base; > >> envp =3D *stack_base + (imgp->args->argc + 1); > >> (*stack_base)--; > >> - **stack_base =3D (intptr_t)(void *)envp; > >> + suword(*stack_base, (intptr_t)(void *)envp); > >> (*stack_base)--; > >> - **stack_base =3D (intptr_t)(void *)argv; > >> + suword(*stack_base, (intptr_t)(void *)argv); > >> (*stack_base)--; > >> - **stack_base =3D imgp->args->argc; > >> + suword(*stack_base, imgp->args->argc); > >> return (0); > >> } > >> =20 > >> @@ -286,7 +286,7 @@ elf_linux_fixup(register_t **stack_base, struct im= age_params *imgp) > >> imgp->auxargs =3D NULL; > >> =20 > >> (*stack_base)--; > >> - **stack_base =3D (register_t)imgp->args->argc; > >> + suword(*stack_base, (register_t)imgp->args->argc); > >> return (0); > >> } > >> =20 > > > > Thanks for the response! I will try the patch, but that file has not > > been touched since June 2011. I was suspecting the changes in r231146 > > and r231148. If there is no change with your patch I will roll back > > those to see what happens. This is very unlikely. fadvise() has nothing to do with image activators. >=20 > No panics so far. That patch does indeed seem to solve the problem! I > also verified with going back to the old kernel, which again > consistently paniced. I will commit the change in minutes. Kernel must not access usermode addresses directly. But, does the application that used to panic the system, behave properly ? >=20 > Thanks very much for good work! >=20 > I'm a but puzzled though, because that bug must have been there for > quite some time without triggering the panic. The panic with unpatched kernel looks puzzling. Do you have some non-default stack limit ? Can you look at the resource limit values for the process initiated the panic ? --+qlyv6FHKYYAux7U Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAk9INXwACgkQC3+MBN1Mb4iNVgCgz1j2D9K3fO2oUZE9lVUf90lJ jY0An1sN7t24gaED4ys4oYL3fCgb4hFn =1M0W -----END PGP SIGNATURE----- --+qlyv6FHKYYAux7U-- From owner-freebsd-emulation@FreeBSD.ORG Sat Feb 25 06:38:57 2012 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E49B106566C; Sat, 25 Feb 2012 06:38:57 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 194298FC0C; Sat, 25 Feb 2012 06:38:56 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q1P6cubj001125; Fri, 24 Feb 2012 23:38:56 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q1P6cu0t001122; Fri, 24 Feb 2012 23:38:56 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Fri, 24 Feb 2012 23:38:56 -0700 (MST) From: Warren Block To: Andriy Gapon In-Reply-To: Message-ID: References: <201202230626.q1N6QXr3003939@slippy.cwsent.com> <4F46C7DF.2060807@FreeBSD.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Fri, 24 Feb 2012 23:38:56 -0700 (MST) Cc: freebsd-emulation@freebsd.org Subject: Re: Virtualbox 4.1.8 vboxdrv instantly panics on 8-stable i386 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Feb 2012 06:38:57 -0000 On Thu, 23 Feb 2012, Warren Block wrote: > The later version of the port works now. The patch file in it is different > from the second one posted here; should I try the patch? The modified patch works. vboxguest doesn't seem to be working in a FreeBSD guest, but that may be a different issue.