From owner-freebsd-amd64@FreeBSD.ORG Sun Mar 6 01:14:27 2011 Return-Path: Delivered-To: amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C411106564A; Sun, 6 Mar 2011 01:14:27 +0000 (UTC) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id 453428FC0A; Sun, 6 Mar 2011 01:14:27 +0000 (UTC) Received: from freebsd-current.sentex.ca (localhost [127.0.0.1]) by freebsd-current.sentex.ca (8.14.4/8.14.4) with ESMTP id p261EQ5B038774; Sat, 5 Mar 2011 20:14:26 -0500 (EST) (envelope-from tinderbox@freebsd.org) Received: (from tinderbox@localhost) by freebsd-current.sentex.ca (8.14.4/8.14.4/Submit) id p261EQmB038764; Sun, 6 Mar 2011 01:14:26 GMT (envelope-from tinderbox@freebsd.org) Date: Sun, 6 Mar 2011 01:14:26 GMT Message-Id: <201103060114.p261EQmB038764@freebsd-current.sentex.ca> X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to FreeBSD Tinderbox using -f Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Cc: Subject: [head tinderbox] failure on amd64/amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2011 01:14:27 -0000 TB --- 2011-03-05 23:50:00 - tinderbox 2.6 running on freebsd-current.sentex.ca TB --- 2011-03-05 23:50:00 - starting HEAD tinderbox run for amd64/amd64 TB --- 2011-03-05 23:50:00 - cleaning the object tree TB --- 2011-03-05 23:50:28 - cvsupping the source tree TB --- 2011-03-05 23:50:28 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/HEAD/amd64/amd64/supfile TB --- 2011-03-05 23:50:40 - building world TB --- 2011-03-05 23:50:40 - MAKEOBJDIRPREFIX=/obj TB --- 2011-03-05 23:50:40 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2011-03-05 23:50:40 - TARGET=amd64 TB --- 2011-03-05 23:50:40 - TARGET_ARCH=amd64 TB --- 2011-03-05 23:50:40 - TZ=UTC TB --- 2011-03-05 23:50:40 - __MAKE_CONF=/dev/null TB --- 2011-03-05 23:50:40 - cd /src TB --- 2011-03-05 23:50:40 - /usr/bin/make -B buildworld >>> World build started on Sat Mar 5 23:50:40 UTC 2011 >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -I/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/sgsmsg/../../../cddl/compat/opensolaris/include -I/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include -I/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/contrib/opensolaris/uts/common -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -o sgsmsg avl.o sgsmsg.o string_table.o findprime.o ===> cddl/usr.bin/zinject (all) cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/zinject.c cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c: In function 'translate_record': /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c:382: warning: passing argument 4 of 'calculate_range' discards qualifiers from pointer target type cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -o zinject zinject.o translate.o -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool /obj/src/tmp/usr/lib/libzpool.so: undefined reference to `zvol_rename_minors' *** Error code 1 Stop in /src/cddl/usr.bin/zinject. *** Error code 1 Stop in /src/cddl/usr.bin. *** Error code 1 Stop in /src/cddl. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. TB --- 2011-03-06 01:14:26 - WARNING: /usr/bin/make returned exit code 1 TB --- 2011-03-06 01:14:26 - ERROR: failed to build world TB --- 2011-03-06 01:14:26 - 4101.44 user 702.44 system 5065.61 real http://tinderbox.freebsd.org/tinderbox-head-HEAD-amd64-amd64.full From owner-freebsd-amd64@FreeBSD.ORG Sun Mar 6 03:54:15 2011 Return-Path: Delivered-To: amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 045E0106564A; Sun, 6 Mar 2011 03:54:15 +0000 (UTC) (envelope-from tinderbox@freebsd.org) Received: from freebsd-current.sentex.ca (freebsd-current.sentex.ca [64.7.128.98]) by mx1.freebsd.org (Postfix) with ESMTP id C82C78FC18; Sun, 6 Mar 2011 03:54:14 +0000 (UTC) Received: from freebsd-current.sentex.ca (localhost [127.0.0.1]) by freebsd-current.sentex.ca (8.14.4/8.14.4) with ESMTP id p263sDCx040660; Sat, 5 Mar 2011 22:54:13 -0500 (EST) (envelope-from tinderbox@freebsd.org) Received: (from tinderbox@localhost) by freebsd-current.sentex.ca (8.14.4/8.14.4/Submit) id p263sDt9040632; Sun, 6 Mar 2011 03:54:13 GMT (envelope-from tinderbox@freebsd.org) Date: Sun, 6 Mar 2011 03:54:13 GMT Message-Id: <201103060354.p263sDt9040632@freebsd-current.sentex.ca> X-Authentication-Warning: freebsd-current.sentex.ca: tinderbox set sender to FreeBSD Tinderbox using -f Sender: FreeBSD Tinderbox From: FreeBSD Tinderbox To: FreeBSD Tinderbox , , Precedence: bulk Cc: Subject: [head tinderbox] failure on amd64/amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2011 03:54:15 -0000 TB --- 2011-03-06 02:30:00 - tinderbox 2.6 running on freebsd-current.sentex.ca TB --- 2011-03-06 02:30:00 - starting HEAD tinderbox run for amd64/amd64 TB --- 2011-03-06 02:30:00 - cleaning the object tree TB --- 2011-03-06 02:30:08 - cvsupping the source tree TB --- 2011-03-06 02:30:08 - /usr/bin/csup -z -r 3 -g -L 1 -h cvsup.sentex.ca /tinderbox/HEAD/amd64/amd64/supfile TB --- 2011-03-06 02:30:34 - building world TB --- 2011-03-06 02:30:34 - MAKEOBJDIRPREFIX=/obj TB --- 2011-03-06 02:30:34 - PATH=/usr/bin:/usr/sbin:/bin:/sbin TB --- 2011-03-06 02:30:34 - TARGET=amd64 TB --- 2011-03-06 02:30:34 - TARGET_ARCH=amd64 TB --- 2011-03-06 02:30:34 - TZ=UTC TB --- 2011-03-06 02:30:34 - __MAKE_CONF=/dev/null TB --- 2011-03-06 02:30:34 - cd /src TB --- 2011-03-06 02:30:34 - /usr/bin/make -B buildworld >>> World build started on Sun Mar 6 02:30:34 UTC 2011 >>> Rebuilding the temporary build tree >>> stage 1.1: legacy release compatibility shims >>> stage 1.2: bootstrap tools >>> stage 2.1: cleaning up the object tree >>> stage 2.2: rebuilding the object tree >>> stage 2.3: build tools >>> stage 3: cross tools >>> stage 4.1: building includes >>> stage 4.2: building libraries >>> stage 4.3: make dependencies >>> stage 4.4: building everything [...] cc -O2 -pipe -I/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/sgsmsg/../../../cddl/compat/opensolaris/include -I/src/cddl/usr.bin/sgsmsg/../../../cddl/contrib/opensolaris/cmd/sgs/include -I/src/cddl/usr.bin/sgsmsg/../../../sys/cddl/contrib/opensolaris/uts/common -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -o sgsmsg avl.o sgsmsg.o string_table.o findprime.o ===> cddl/usr.bin/zinject (all) cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/zinject.c cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c: In function 'translate_record': /src/cddl/usr.bin/zinject/../../contrib/opensolaris/cmd/zinject/translate.c:382: warning: passing argument 4 of 'calculate_range' discards qualifiers from pointer target type cc -O2 -pipe -I/src/cddl/usr.bin/zinject/../../../sys/cddl/compat/opensolaris -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/include -I/src/cddl/usr.bin/zinject/../../compat/opensolaris/lib/libumem -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzfs/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libzpool/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/lib/libnvpair -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/fs/zfs -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common/sys -I/src/cddl/usr.bin/zinject/../../../sys/cddl/contrib/opensolaris/uts/common -I/src/cddl/usr.bin/zinject/../../contrib/opensolaris/head -I/src/cddl/usr.bin/zinject/../../lib/libumem -DNEED_SOLARIS_BOOLEAN -std=gnu89 -fstack-protector -Wno-pointer-sign -Wno-unknown-pragmas -o zinject zinject.o translate.o -lavl -lgeom -lm -lnvpair -lumem -luutil -lzfs -lzpool /obj/src/tmp/usr/lib/libzpool.so: undefined reference to `zvol_rename_minors' *** Error code 1 Stop in /src/cddl/usr.bin/zinject. *** Error code 1 Stop in /src/cddl/usr.bin. *** Error code 1 Stop in /src/cddl. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. *** Error code 1 Stop in /src. TB --- 2011-03-06 03:54:13 - WARNING: /usr/bin/make returned exit code 1 TB --- 2011-03-06 03:54:13 - ERROR: failed to build world TB --- 2011-03-06 03:54:13 - 4099.83 user 699.27 system 5052.73 real http://tinderbox.freebsd.org/tinderbox-head-HEAD-amd64-amd64.full From owner-freebsd-amd64@FreeBSD.ORG Sun Mar 6 22:20:07 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 933481065726 for ; Sun, 6 Mar 2011 22:20:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 78D5C8FC08 for ; Sun, 6 Mar 2011 22:20:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p26MK77G034698 for ; Sun, 6 Mar 2011 22:20:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p26MK7w5034697; Sun, 6 Mar 2011 22:20:07 GMT (envelope-from gnats) Date: Sun, 6 Mar 2011 22:20:07 GMT Message-Id: <201103062220.p26MK7w5034697@freefall.freebsd.org> To: freebsd-amd64@FreeBSD.org From: Mark Linimon X-Mailman-Approved-At: Sun, 06 Mar 2011 22:32:48 +0000 Cc: Subject: Re: amd64/117186: [modules] kldload Unsupported file type on STABLE amd64 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Mark Linimon List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Mar 2011 22:20:07 -0000 The following reply was made to PR amd64/117186; it has been noted by GNATS. From: Mark Linimon To: bug-followup@FreeBSD.org Cc: Subject: Re: amd64/117186: [modules] kldload Unsupported file type on STABLE amd64 Date: Sun, 6 Mar 2011 16:10:10 -0600 ----- Forwarded message from "Agarwal, Mayank" ----- Date: Thu, 3 Mar 2011 11:19:56 +0530 From: "Agarwal, Mayank" To: Mark Linimon Subject: RE: amd64/117186: [modules] kldload Unsupported file type on STABLE amd64 It is compiled on another machine: Output of file command on module is: bash-3.2# file base_kmod.ko base_kmod.ko: ELF 64-bit LSB shared object, x86-64, version 1 (FreeBSD), not stripped -Mayank ----- End forwarded message ----- From owner-freebsd-amd64@FreeBSD.ORG Mon Mar 7 11:06:55 2011 Return-Path: Delivered-To: freebsd-amd64@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 226C7106566B for ; Mon, 7 Mar 2011 11:06:55 +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 E9A638FC08 for ; Mon, 7 Mar 2011 11:06:54 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p27B6sqX096879 for ; Mon, 7 Mar 2011 11:06:54 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p27B6snW096877 for freebsd-amd64@FreeBSD.org; Mon, 7 Mar 2011 11:06:54 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 7 Mar 2011 11:06:54 GMT Message-Id: <201103071106.p27B6snW096877@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-amd64@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-amd64@FreeBSD.org X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Mar 2011 11:06:55 -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 amd64/155249 amd64 [build] 8.1 buildworld failure o amd64/155135 amd64 [boot] Does Not Boot On a Very Standard Hardware o amd64/154957 amd64 [boot] Install boot CD won't boot up - keeps rebooting o amd64/154629 amd64 [panic] Fatal trap 9: general protection fault while i o amd64/153935 amd64 [hang] system hangs while trying to do 'shutdown -h no o amd64/153831 amd64 [boot] CD bootloader won't on Tyan s2912G2nr o amd64/153665 amd64 [ahci] AHCI module unconsistent behaviour with SATA3 d o amd64/153496 amd64 [hyper-v] [install] Install on Hyper-V leaves corrupt o amd64/153372 amd64 [panic] kernel panic o amd64/153175 amd64 [amd64] Kernel Panic on only FreeBSD 8 amd64 o amd64/152874 amd64 [install] 8.1 install fails where 7.3 works due to lac o amd64/152430 amd64 [boot] HP ProLiant Microserver n36l cannot boot into i o amd64/151385 amd64 [boot] Installation hangs on MacBook o amd64/150170 amd64 [patch] [amd64] [headers] SIG_ATOMIC_MIN/SIG_ATOMIC_MA o amd64/148526 amd64 [ahci] ahci driver does not boot on AMD chip o amd64/145991 amd64 [NOTES] [patch] Add a requires line to /sys/amd64/conf o amd64/144405 amd64 [build] [patch] include /usr/obj/lib32 in cleanworld t s amd64/143173 amd64 [ata] Promise FastTrack TX4 + SATA DVD, installer can' f amd64/141413 amd64 [hang] Tyan 2881 m3289 SMDC freeze o amd64/141060 amd64 [install] Can't install 8.0-RELEASE on the server wher o amd64/140715 amd64 [boot] Dell M600 Blade fails to boot 7.2+ 64 bit f amd64/140145 amd64 [hang] sysinstall(8): Installation boot sequence freez o amd64/139998 amd64 [panic][net] 7.2 amd64 panic in rtrequest1_fib o amd64/139924 amd64 [boot] cd or dvd not load o amd64/138029 amd64 [panic][bpf] periodically kernel panic and reboot o amd64/137942 amd64 [pci] 8.0-BETA2 having problems with Asus M2N-SLI-delu o amd64/135265 amd64 [mpt] Boot from install cd hangs on HP DL160 G5 with L o amd64/135040 amd64 [ata] FreeBSD/amd64 does not (always) detect disk on S o amd64/133977 amd64 [panic] [ffs] "panic: ffs_blkfree: freeing free block" o amd64/133701 amd64 Recompiling the kernel with k8temp or smbios break GEO o amd64/132574 amd64 [boot] [hang] Freeze on bootstrap loader (CD) using AT o amd64/131456 amd64 [acpi] [ata] ACPI & ATA problems s amd64/131209 amd64 [panic] [bce] 7.1-STABLE amd64 crash - m0 NULL o amd64/130368 amd64 [hang] Switching from xorg to console locks up compute o amd64/129889 amd64 [boot] [hang] The booting process stops at the line mo o amd64/129426 amd64 [panic] FreeBSD 7.0 crash after subdiskXX: detached o amd64/129315 amd64 [em] amd64 motherboard: Intel DG965WH motherboard comp o amd64/128765 amd64 [install] Install CD loads to Install choices but stop o amd64/127640 amd64 [amd64] gcc(1) will not build shared libraries with -f o amd64/125002 amd64 [install] amd64, SATA hard disks not detected o amd64/124432 amd64 [panic] 7.0-STABLE panic: invalbuf: dirty bufs o amd64/122549 amd64 7.0-RELEASE-amd64-bootonly.iso doesn't work w/ serial f amd64/122468 amd64 Compile problems after upgrading to 7.0 o amd64/120202 amd64 [amd64] [patch] [panic] kernel panic at start_all_aps, o amd64/117296 amd64 [ata] I don`t see second SATA IDE on VIA VT8237A o amd64/116620 amd64 [hang] ifconfig spins when creating carp(4) device on s amd64/115815 amd64 [ata] [request] Gigabyte GA-M61P-S3 Motherboard unsupp o amd64/115194 amd64 LCD screen remains blank after Dell XPS M1210 lid is c f amd64/92337 amd64 [em] FreeBSD 6.0 Release Intel Pro 1000 MT em1 no buff o amd64/91405 amd64 [asr] [panic] Kernel panic caused by asr on 6.0-amd64 50 problems total. From owner-freebsd-amd64@FreeBSD.ORG Fri Mar 11 22:56:01 2011 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2488106564A for ; Fri, 11 Mar 2011 22:56:01 +0000 (UTC) (envelope-from tim.bird@am.sony.com) Received: from ch1outboundpool.messaging.microsoft.com (ch1outboundpool.messaging.microsoft.com [216.32.181.181]) by mx1.freebsd.org (Postfix) with ESMTP id 524498FC17 for ; Fri, 11 Mar 2011 22:56:00 +0000 (UTC) Received: from mail33-ch1-R.bigfish.com (216.32.181.169) by CH1EHSOBE004.bigfish.com (10.43.70.54) with Microsoft SMTP Server id 14.1.225.8; Fri, 11 Mar 2011 22:40:55 +0000 Received: from mail33-ch1 (localhost.localdomain [127.0.0.1]) by mail33-ch1-R.bigfish.com (Postfix) with ESMTP id C95E212A0578 for ; Fri, 11 Mar 2011 22:40:55 +0000 (UTC) X-SpamScore: -11 X-BigFish: VPS-11(zz14ffO4015Lzz1202hzz8275dhz2fh637h668h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:mail7.fw-bc.sony.com; RD:mail7.fw-bc.sony.com; EFVD:NLI Received: from mail33-ch1 (localhost.localdomain [127.0.0.1]) by mail33-ch1 (MessageSwitch) id 1299883254793910_26900; Fri, 11 Mar 2011 22:40:54 +0000 (UTC) Received: from CH1EHSMHS023.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.247]) by mail33-ch1.bigfish.com (Postfix) with ESMTP id BDE6D14A004E for ; Fri, 11 Mar 2011 22:40:54 +0000 (UTC) Received: from mail7.fw-bc.sony.com (160.33.98.74) by CH1EHSMHS023.bigfish.com (10.43.70.23) with Microsoft SMTP Server id 14.1.225.8; Fri, 11 Mar 2011 22:40:53 +0000 Received: from mail1x.sjc.in.sel.sony.com (mail3.sjc.in.sel.sony.com [43.134.1.112]) by mail7.fw-bc.sony.com (Switch-3.4.2/Switch-3.3.2mp) with ESMTP id p2BMeqG3006606 for ; Fri, 11 Mar 2011 22:40:52 GMT Received: from timdesk.am.sony.com ([43.135.148.222]) by mail1x.sjc.in.sel.sony.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p2BMef0a008483 for ; Fri, 11 Mar 2011 22:40:41 GMT Message-ID: <4D7AA4E4.3010508@am.sony.com> Date: Fri, 11 Mar 2011 14:40:36 -0800 From: Tim Bird User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100907 Fedora/3.0.7-1.fc12 Thunderbird/3.0.7 MIME-Version: 1.0 To: Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginatorOrg: am.sony.com Subject: [PATCH] Add support for AVX X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Mar 2011 22:56:01 -0000 Hello all, I am representing a group in Sony that wishes to submit the patch below to add the described feature to AVX. I know this is somewhat unconventional, but I am not the original author of the patch, nor do I have a build or run environment for BSD. However, I have been asked to be a proxy for our BSD developer to help shepherd this patch into FreeBSD. If you have questions about the patch, or issues with it, I will relay the information to the original author and try to resolve any problems. As I am new to FreeBSD, I'm not sure the correct individual or group to direct this patch to, but hopefully someone can provide me some pointers. I am starting with freebsd-amd64, but maybe this should be sent to freebsd-hackers??? Thanks for any assistance you can provide. -- Tim Bird, Principal Software Engineer Sony Network Entertainment --------------------------- This is a patch that provides support for AVX in FreeBSD. After it is applied to FreeBSD 9.0-CURRENT, user programs on it can use AVX fully and also the kernel may use it by calling fpu_kern_enter(). AVX is the newest SIMD extension for x86 CPUs introduced from Intel's Sandy Bridge and also will be introduced by AMD's next generation processor Bulldozer. This patch can be applied to FreeBSD 9.0-CURRENT r217297. (r217297 is a revision of subversion in the repository http://svn.freebsd.org/base) You can use clang to make a kernel with it as well as gcc. The kernel runs on both amd64 processors either AVX has or not without any configurations. The strategy of the patch is the same as for FPU(MMX)/SSE. Namely, code that initializes FPU(MMX)/SSE also initializes AVX, when it saves them it also saves AVX as well, and restores it too only if the processor has AVX. If the processor doesn't have AVX, it does nothing and it only adds a test instruction and a conditional branch instruction. Actually it does the followings; - When a processor boots if the processor has AVX then enable its use. at sys/amd64/amd64/initcpu.c - Save AVX context when a thread switching occurs. at sys/amd64/amd64/cpu_switch.S - Change fxsave()/fxrstor() to xsave()/xrstor() in order to save/restore AVX status whenever it saves/restores FPU(MMX)/SSE. at sys/amd64/amd64/fpu.c - Initializes AVX. fpuinit() at sys/amd64/amd64/fpu.c - Adjust an alignment of xsave/xrstor's target addrress in order to avoid GP exception due to miss alignment. xsave/xrstor instructions require that a boundary of a target address is 64B. But the alignment of a stack is 32B. So fpugetregs()/fpusetregs() adjust it via a bounce buffer before they issue xsave/xrstor instruction. fpugetregs()/fpusetregs() at sys/amd64/amd64/fpu.c There are two issues in the patch; 1. Machine code is embedded The default assembler for building a kernel, as of 2.15 doesn't know instructions which is added for AVX. So, the patch embeds machine code for xsetbv/xsave/xrstor instruction. 2. Extra data copying If an alignment of an address of a stack is less than 64B, in order to avoid GP exception, it copies contents to/from a bounce buffer. If callers of fpugetregs()/fpusetregs() can be changed, this extra data coping is removed. Because of the callers are MI, I hesitated about changing them. Thanks, Index: sys/amd64/include/ucontext.h =================================================================== --- sys/amd64/include/ucontext.h (revision 217297) +++ sys/amd64/include/ucontext.h (working copy) @@ -87,7 +87,7 @@ /* * See for the internals of mc_fpstate[]. */ - long mc_fpstate[64] __aligned(16); + long mc_fpstate[104] __aligned(64); __register_t mc_fsbase; __register_t mc_gsbase; Index: sys/amd64/include/fpu.h =================================================================== --- sys/amd64/include/fpu.h (revision 217297) +++ sys/amd64/include/fpu.h (working copy) @@ -51,6 +51,11 @@ u_char xmm_bytes[16]; }; +/* Contents of each AVX extended accumulator */ +struct ymmacc { + u_char ymm_bytes[16]; +}; + struct envxmm { u_int16_t en_cw; /* control word (16bits) */ u_int16_t en_sw; /* status word (16bits) */ @@ -71,7 +76,9 @@ } sv_fp[8]; struct xmmacc sv_xmm[16]; u_char sv_pad[96]; -} __aligned(16); + u_char xsv_hd[64]; + struct ymmacc sv_ymm[16]; +} __aligned(64); #ifdef _KERNEL struct fpu_kern_ctx { Index: sys/amd64/include/signal.h =================================================================== --- sys/amd64/include/signal.h (revision 217297) +++ sys/amd64/include/signal.h (working copy) @@ -98,7 +98,7 @@ */ long sc_fpformat; long sc_ownedfp; - long sc_fpstate[64] __aligned(16); + long sc_fpstate[104] __aligned(64); long sc_fsbase; long sc_gsbase; Index: sys/amd64/include/specialreg.h =================================================================== --- sys/amd64/include/specialreg.h (revision 217297) +++ sys/amd64/include/specialreg.h (working copy) @@ -66,6 +66,7 @@ #define CR4_PCE 0x00000100 /* Performance monitoring counter enable */ #define CR4_FXSR 0x00000200 /* Fast FPU save/restore used by OS */ #define CR4_XMM 0x00000400 /* enable SIMD/MMX2 to use except 16 */ +#define CR4_XSAVE 0x00040000 /* enable XSETBV/XGETBV */ /* * Bits in AMD64 special registers. EFER is 64 bits wide. @@ -134,6 +135,9 @@ #define CPUID2_MOVBE 0x00400000 #define CPUID2_POPCNT 0x00800000 #define CPUID2_AESNI 0x02000000 +#define CPUID2_XSAVE 0x04000000 +#define CPUID2_OSXSAVE 0x08000000 +#define CPUID2_AVX 0x10000000 /* * Important bits in the Thermal and Power Management flags Index: sys/amd64/amd64/initcpu.c =================================================================== --- sys/amd64/amd64/initcpu.c (revision 217297) +++ sys/amd64/amd64/initcpu.c (working copy) @@ -142,6 +142,19 @@ } } + +static void +xsetbv(unsigned int index, unsigned long value) +{ + register_t eax = value; + register_t edx = value >> 32; + + /* xsetbv */ + __asm __volatile(".byte 0x0f,0x01,0xd1" :: + "a"(eax), "d"(edx), "c"(index)); +} + + /* * Initialize CPU control registers */ @@ -154,6 +167,11 @@ load_cr4(rcr4() | CR4_FXSR | CR4_XMM); cpu_fxsr = hw_instruction_sse = 1; } + if (cpu_feature2 & CPUID2_XSAVE) { + load_cr4(rcr4() | CR4_XSAVE); + /* enable to use xsave/xrstor */ + xsetbv(0, 7); + } if ((amd_feature & AMDID_NX) != 0) { msr = rdmsr(MSR_EFER) | EFER_NXE; wrmsr(MSR_EFER, msr); Index: sys/amd64/amd64/cpu_switch.S =================================================================== --- sys/amd64/amd64/cpu_switch.S (revision 217297) +++ sys/amd64/amd64/cpu_switch.S (working copy) @@ -115,7 +115,20 @@ jne 1f movq PCB_SAVEFPU(%r8),%r8 clts + + /* if the cpu has AVX, use xsave instead of fxsave */ + testl $CPUID2_XSAVE,cpu_feature2 + jne 2f fxsave (%r8) + jmp 3f +2: + mov $0x7, %eax + mov %rdx, %rbx + mov $0x0, %edx + /* xsave (%r8) fix me when xsave is available */ + .byte 0x41, 0x0f, 0xae, 0x20 + mov %rbx, %rdx +3: smsw %ax orb $CR0_TS,%al lmsw %ax @@ -302,8 +315,80 @@ * Update pcb, saving current processor state. */ ENTRY(savectx) + /* Fetch PCB. */ + movq %rdi,%rcx + /* Save caller's return address. */ movq (%rsp),%rax + movq %rax,PCB_RIP(%rcx) + + movq %cr3,%rax + movq %rax,PCB_CR3(%rcx) + + movq %rbx,PCB_RBX(%rcx) + movq %rsp,PCB_RSP(%rcx) + movq %rbp,PCB_RBP(%rcx) + movq %r12,PCB_R12(%rcx) + movq %r13,PCB_R13(%rcx) + movq %r14,PCB_R14(%rcx) + movq %r15,PCB_R15(%rcx) + + /* + * If fpcurthread == NULL, then the fpu h/w state is irrelevant and the + * state had better already be in the pcb. This is true for forks + * but not for dumps (the old book-keeping with FP flags in the pcb + * always lost for dumps because the dump pcb has 0 flags). + * + * If fpcurthread != NULL, then we have to save the fpu h/w state to + * fpcurthread's pcb and copy it to the requested pcb, or save to the + * requested pcb and reload. Copying is easier because we would + * have to handle h/w bugs for reloading. We used to lose the + * parent's fpu state for forks by forgetting to reload. + */ + pushfq + cli + movq PCPU(FPCURTHREAD),%rax + testq %rax,%rax + je 1f + + movq TD_PCB(%rax),%rdi + leaq PCB_SAVEFPU(%rdi),%rdi + clts + + /* if the cpu has AVX, use xsave instead of fxsave */ + testl $CPUID2_XSAVE,cpu_feature2 + jne 2f + fxsave (%rdi) + jmp 3f +2: + mov $0x7, %eax + mov $0x0, %edx + /* xsave (%rdi) fix me when xsave is available */ + .byte 0x0f, 0xae, 0x27 +3: + smsw %ax + orb $CR0_TS,%al + lmsw %ax + + movq $PCB_SAVEFPU_SIZE,%rdx /* arg 3 */ + leaq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ + /* arg 1 (%rdi) already loaded */ + call bcopy +1: + popfq + + ret +END(savectx) + +/* + * savectx2(xpcb) + * Update xpcb, saving current processor state. + */ +ENTRY(savectx2) + /* Fetch XPCB. */ + movq %rdi,%r8 + /* Save caller's return address. */ + movq (%rsp),%rax movq %rax,PCB_RIP(%rdi) movq %rbx,PCB_RBX(%rdi) @@ -355,7 +440,17 @@ str PCB_TR(%rdi) clts + /* if the cpu has AVX, use xsave instead of fxsave */ + testl $CPUID2_XSAVE,cpu_feature2 + jne 1f fxsave PCB_USERFPU(%rdi) + jmp 2f +1: + mov $0x7, %eax + mov $0x0, %edx + /* xsave PCB_USERFPU(%rdi) fix me when xsave is available */ + .byte 0x0f, 0xae, 0xa7, 0x00, 0x01, 0x00, 0x00 +2: movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ movl $1,%eax Index: sys/amd64/amd64/fpu.c =================================================================== --- sys/amd64/amd64/fpu.c (revision 217297) +++ sys/amd64/amd64/fpu.c (working copy) @@ -105,6 +105,40 @@ static struct savefpu fpu_initialstate; + +static void +xsave(struct savefpu *addr) +{ + if (cpu_feature2 & CPUID2_XSAVE) { + /* __asm("xsave %0" : "=m" (*(addr))) -> xsave (%rdi) */ + __asm __volatile("mov $0x7, %%eax\n" + "mov $0x0, %%edx\n" + ".byte 0x0f, 0xae, 0x27" + :: "D"(addr) + : "%eax", "%edx", "memory"); + } else { + fxsave(addr); + } +} + + +static void +xrstor(struct savefpu *addr) +{ + if (cpu_feature2 & CPUID2_XSAVE) { + /* __asm("xrstor %0" : : "m" (*(addr))) -> xrstor (%rdi) */ + __asm __volatile("mov $0x7, %%eax\n" + "mov $0x0, %%edx\n" + ".byte 0x0f, 0xae, 0x2f" + :: "D"(addr) + : "%eax", "%edx"); + } else { + fxrstor(addr); + } +} + + + /* * Initialize the floating point unit. On the boot CPU we generate a * clean state that is used to initialize the floating point unit when @@ -128,13 +162,14 @@ mxcsr = __INITIAL_MXCSR__; ldmxcsr(mxcsr); if (PCPU_GET(cpuid) == 0) { - fxsave(&fpu_initialstate); + xsave(&fpu_initialstate); if (fpu_initialstate.sv_env.en_mxcsr_mask) cpu_mxcsr_mask = fpu_initialstate.sv_env.en_mxcsr_mask; else cpu_mxcsr_mask = 0xFFBF; bzero(fpu_initialstate.sv_fp, sizeof(fpu_initialstate.sv_fp)); bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); + bzero(fpu_initialstate.sv_ymm, sizeof(fpu_initialstate.sv_ymm)); } start_emulating(); intr_restore(saveintr); @@ -150,7 +185,7 @@ critical_enter(); if (curthread == PCPU_GET(fpcurthread)) { stop_emulating(); - fxsave(PCPU_GET(curpcb)->pcb_save); + xsave(PCPU_GET(curpcb)->pcb_save); start_emulating(); PCPU_SET(fpcurthread, 0); } @@ -423,7 +458,7 @@ * the PCB doesn't contain a clean FPU state. Explicitly * load an initial state. */ - fxrstor(&fpu_initialstate); + xrstor(&fpu_initialstate); if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__) fldcw(pcb->pcb_initial_fpucw); if (PCB_USER_FPU(pcb)) @@ -432,7 +467,7 @@ else set_pcb_flags(pcb, PCB_FPUINITDONE); } else - fxrstor(pcb->pcb_save); + xrstor(pcb->pcb_save); critical_exit(); } @@ -469,7 +504,26 @@ } critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxsave(&pcb->pcb_user_save); + /* + * FIXME: + * xsave requires that a boundary of a target address is 64B + * and struct savefpu has an attribute for aligned 64B. But + * gcc doesn't treat a variable on stack as 64B boundary. + * So, it uses a buffer to do xsave safely and copy them the + * target if a miss aligned address is passed. + */ + if ((unsigned long)&pcb->pcb_user_save % 64) { + char tmp[sizeof(struct savefpu) + 63]; + void *p = (void *)((unsigned long)(tmp + 63) & ~0x3f); + + bzero(((struct savefpu*)p)->xsv_hd, 64); + + xsave((struct savefpu*)p); + bcopy(p, &pcb->pcb_user_save, sizeof(struct savefpu)); + } else { + bzero(pcb->pcb_user_save.xsv_hd, 64); + xsave(&pcb->pcb_user_save); + } critical_exit(); return (_MC_FPOWNED_FPU); } else { @@ -502,7 +556,24 @@ pcb = td->td_pcb; critical_enter(); if (td == PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { - fxrstor(addr); + + /* In order to avoid #GP, initialize some of XSAVE.HEADER. */ + u_long *header = (u_long*)(addr->xsv_hd); + header[0] = 7; + header[1] = 0; + header[2] = 0; + + /* + * FIXME: See fpugetregs() + */ + if ((unsigned long)addr % 64) { + char tmp[sizeof(struct savefpu) + 63]; + void *p = (void *)((unsigned long)(tmp + 63) & ~0x3f); + bcopy(addr, p, sizeof(struct savefpu)); + xrstor((struct savefpu*)p); + } else { + xrstor(addr); + } critical_exit(); set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); } else { Index: sys/amd64/amd64/identcpu.c =================================================================== --- sys/amd64/amd64/identcpu.c (revision 217297) +++ sys/amd64/amd64/identcpu.c (working copy) @@ -275,7 +275,7 @@ "\012SSSE3" /* SSSE3 */ "\013CNXT-ID" /* L1 context ID available */ "\014" - "\015" + "\015FMA" "\016CX16" /* CMPXCHG16B Instruction */ "\017xTPR" /* Send Task Priority Messages*/ "\020PDCM" /* Perf/Debug Capability MSR */ @@ -291,7 +291,7 @@ "\032AESNI" /* AES Crypto*/ "\033XSAVE" "\034OSXSAVE" - "\035" + "\035AVX" "\036" "\037" "\040" From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 07:48:48 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCB151065673; Sat, 12 Mar 2011 07:48:48 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 935588FC15; Sat, 12 Mar 2011 07:48:48 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2C7mmJR037583; Sat, 12 Mar 2011 07:48:48 GMT (envelope-from jh@freefall.freebsd.org) Received: (from jh@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2C7mlVW037577; Sat, 12 Mar 2011 07:48:47 GMT (envelope-from jh) Date: Sat, 12 Mar 2011 07:48:47 GMT Message-Id: <201103120748.p2C7mlVW037577@freefall.freebsd.org> To: cbc@labmaster.com, jh@FreeBSD.org, freebsd-amd64@FreeBSD.org From: jh@FreeBSD.org X-Mailman-Approved-At: Sat, 12 Mar 2011 13:40:41 +0000 Cc: Subject: Re: amd64/92337: [em] FreeBSD 6.0 Release Intel Pro 1000 MT em1 no buffer space available X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 07:48:48 -0000 Synopsis: [em] FreeBSD 6.0 Release Intel Pro 1000 MT em1 no buffer space available State-Changed-From-To: feedback->closed State-Changed-By: jh State-Changed-When: Sat Mar 12 07:48:47 UTC 2011 State-Changed-Why: Feedback timeout. http://www.freebsd.org/cgi/query-pr.cgi?pr=92337 From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 07:49:41 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D490A1065670; Sat, 12 Mar 2011 07:49:41 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id AB67D8FC19; Sat, 12 Mar 2011 07:49:41 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2C7nfcd037828; Sat, 12 Mar 2011 07:49:41 GMT (envelope-from jh@freefall.freebsd.org) Received: (from jh@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2C7nft2037824; Sat, 12 Mar 2011 07:49:41 GMT (envelope-from jh) Date: Sat, 12 Mar 2011 07:49:41 GMT Message-Id: <201103120749.p2C7nft2037824@freefall.freebsd.org> To: rui.pfcosta@gmail.com, jh@FreeBSD.org, freebsd-amd64@FreeBSD.org From: jh@FreeBSD.org X-Mailman-Approved-At: Sat, 12 Mar 2011 13:40:52 +0000 Cc: Subject: Re: amd64/140145: [hang] sysinstall(8): Installation boot sequence freezes X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 07:49:41 -0000 Synopsis: [hang] sysinstall(8): Installation boot sequence freezes State-Changed-From-To: feedback->closed State-Changed-By: jh State-Changed-When: Sat Mar 12 07:49:41 UTC 2011 State-Changed-Why: Feedback timeout. http://www.freebsd.org/cgi/query-pr.cgi?pr=140145 From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 07:52:17 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23E101065673; Sat, 12 Mar 2011 07:52:17 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id EEFBC8FC13; Sat, 12 Mar 2011 07:52:16 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2C7qGH0046149; Sat, 12 Mar 2011 07:52:16 GMT (envelope-from jh@freefall.freebsd.org) Received: (from jh@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2C7qGJM046145; Sat, 12 Mar 2011 07:52:16 GMT (envelope-from jh) Date: Sat, 12 Mar 2011 07:52:16 GMT Message-Id: <201103120752.p2C7qGJM046145@freefall.freebsd.org> To: ruud@t-boonproductions.nl, jh@FreeBSD.org, freebsd-amd64@FreeBSD.org From: jh@FreeBSD.org X-Mailman-Approved-At: Sat, 12 Mar 2011 13:54:59 +0000 Cc: Subject: Re: amd64/122468: Compile problems after upgrading to 7.0 X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 07:52:17 -0000 Synopsis: Compile problems after upgrading to 7.0 State-Changed-From-To: feedback->closed State-Changed-By: jh State-Changed-When: Sat Mar 12 07:52:16 UTC 2011 State-Changed-Why: Feedback timeout. http://www.freebsd.org/cgi/query-pr.cgi?pr=122468 From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 18:52:12 2011 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00569106566B; Sat, 12 Mar 2011 18:52:12 +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 DD1018FC08; Sat, 12 Mar 2011 18:52:10 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p2CIabr0081680 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 12 Mar 2011 20:36:37 +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.4/8.14.4) with ESMTP id p2CIabRB045121; Sat, 12 Mar 2011 20:36:37 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p2CIab9H045120; Sat, 12 Mar 2011 20:36:37 +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, 12 Mar 2011 20:36:37 +0200 From: Kostik Belousov To: Tim Bird Message-ID: <20110312183637.GY78089@deviant.kiev.zoral.com.ua> References: <4D7AA4E4.3010508@am.sony.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="793AmKFHRt0DieWq" Content-Disposition: inline In-Reply-To: <4D7AA4E4.3010508@am.sony.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_40, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-amd64@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [PATCH] Add support for AVX X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 18:52:12 -0000 --793AmKFHRt0DieWq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 11, 2011 at 02:40:36PM -0800, Tim Bird wrote: > Hello all, >=20 > I am representing a group in Sony that wishes to submit the patch > below to add the described feature to AVX. I know this is somewhat > unconventional, but I am not the original author of the patch, nor > do I have a build or run environment for BSD. However, I have > been asked to be a proxy for our BSD developer to help shepherd > this patch into FreeBSD. If you have questions about the patch, > or issues with it, I will relay the information to the original > author and try to resolve any problems. >=20 > As I am new to FreeBSD, I'm not sure the correct individual or > group to direct this patch to, but hopefully someone can provide > me some pointers. I am starting with freebsd-amd64, but maybe this > should be sent to freebsd-hackers??? The list is fine, but freebsd-arch@ or freebsd-current@ would get your contribution a bigger exposure. I added arch@ to the Cc: due to some issues that I think are critical for the patch. >=20 > Thanks for any assistance you can provide. > -- Tim Bird, Principal Software Engineer > Sony Network Entertainment Thank you for taking interest in the FreeBSD and providing a contribution ! >=20 > --------------------------- > This is a patch that provides support for AVX in FreeBSD. After it is > applied to FreeBSD 9.0-CURRENT, user programs on it can use AVX fully > and also the kernel may use it by calling fpu_kern_enter(). AVX is the > newest SIMD extension for x86 CPUs introduced from Intel's Sandy Bridge > and also will be introduced by AMD's next generation processor Bulldozer. >=20 > This patch can be applied to FreeBSD 9.0-CURRENT r217297. (r217297 is a > revision of subversion in the repository http://svn.freebsd.org/base) > You can use clang to make a kernel with it as well as gcc. The kernel > runs on both amd64 processors either AVX has or not without any > configurations. >=20 > The strategy of the patch is the same as for FPU(MMX)/SSE. Namely, code = that > initializes FPU(MMX)/SSE also initializes AVX, when it saves them it also > saves AVX as well, and restores it too only if the processor has AVX. > If the processor doesn't have AVX, it does nothing and it only adds a > test instruction and a conditional branch instruction. >=20 > Actually it does the followings; > - When a processor boots if the processor has AVX then enable its use. > at sys/amd64/amd64/initcpu.c > - Save AVX context when a thread switching occurs. > at sys/amd64/amd64/cpu_switch.S > - Change fxsave()/fxrstor() to xsave()/xrstor() in order to save/restore = AVX > status whenever it saves/restores FPU(MMX)/SSE. > at sys/amd64/amd64/fpu.c > - Initializes AVX. > fpuinit() at sys/amd64/amd64/fpu.c > - Adjust an alignment of xsave/xrstor's target addrress in order to avoid= GP > exception due to miss alignment. > xsave/xrstor instructions require that a boundary of a target address is > 64B. But the alignment of a stack is 32B. So fpugetregs()/fpusetregs() = adjust > it via a bounce buffer before they issue xsave/xrstor instruction. > fpugetregs()/fpusetregs() at sys/amd64/amd64/fpu.c >=20 > There are two issues in the patch; > 1. Machine code is embedded > The default assembler for building a kernel, as of 2.15 doesn't know > instructions which is added for AVX. So, the patch embeds machine code f= or > xsetbv/xsave/xrstor instruction. This is fine, currently there is no other way to handle our old binutils. The issue is with licensing, and it is outside the project. >=20 > 2. Extra data copying > If an alignment of an address of a stack is less than 64B, in order > to avoid GP exception, it copies contents to/from a bounce buffer. > If callers of fpugetregs()/fpusetregs() can be changed, this extra > data coping is removed. Because of the callers are MI, I hesitated > about changing them. I think it is reasonable to require the struct fpu_kern_ctx, supplied to the fpu_kern_enter(), be properly aligned. In fact, the kernel malloc will provide aligned memory silently. I do not think that allocating struct fpu_kern_ctx on the stack is good practice, and definitely would object against such code entering our tree. The reason is that the structure is large, and kernel stack size is limited. The only left place which might require the copying with your patch is the struct pcb itself, pcb_user_save probably ends up unaligned for XSAVE use. This should be fixed in amd64/amd64/vm_machdep.c:cpu_fork() when calculating the pcb location in the memory block allocated for stack. Also, might be, the kernel stack size should be increased for amd64, to account for larger pcb. >=20 > Thanks, >=20 > Index: sys/amd64/include/ucontext.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/include/ucontext.h (revision 217297) > +++ sys/amd64/include/ucontext.h (working copy) > @@ -87,7 +87,7 @@ > /* > * See for the internals of mc_fpstate[]. > */ > - long mc_fpstate[64] __aligned(16); > + long mc_fpstate[104] __aligned(64); >=20 > __register_t mc_fsbase; > __register_t mc_gsbase; And this part is the most problematic for whole patch. The cause is that you changed the ABI of signal delivery and syscalls sigreturn(2), getcontext(2), swapcontext(2) and setcontext(2). Either some measures should be implemented to provide compatibility syscalls and renumber listed syscalls, or existing syscalls and signal frame layout should be changed to be backward-compatible while still provide the place to store XSAVE header and YMM register context. I would prefer to see the second option implemented. I thought about adding new flag to mc_flags for mcontext_t, lets call it _MC_XSAVE, setting of which cause using two words at the end mc_spare. The words would contain a len and pointer to the XSAVE area, added at the end of mcontext_t. The only issue with this scheme is getcontext(2) syscall, which probably requires much more complex treating. The lesser problem with the patch, comparing with the ABI breakage, is the Intel promise to add further bits into XCR0, requiring further breakage of the signal(2) and context(2) ABIs when more architectural cpu context state is added. I would prefer to have it handled once and for all, esp. if ABI changes are required. Also, it would be nice to have i386 taken care of, both in native variant, and COMPAT_FREEBSD32 case on amd64. The issues with i386 ABI breakage are similar to that of amd64. I wanted to work on YMM stuff, but I still do not own sandybridge system yet. I am very glad to see Sony (wow ! :) to contribute there. Will you work further on the items I listed ? If not, I intend to find the time after I have SB machine in posession. > Index: sys/amd64/include/fpu.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/include/fpu.h (revision 217297) > +++ sys/amd64/include/fpu.h (working copy) > @@ -51,6 +51,11 @@ > u_char xmm_bytes[16]; > }; >=20 > +/* Contents of each AVX extended accumulator */ > +struct ymmacc { > + u_char ymm_bytes[16]; > +}; > + > struct envxmm { > u_int16_t en_cw; /* control word (16bits) */ > u_int16_t en_sw; /* status word (16bits) */ > @@ -71,7 +76,9 @@ > } sv_fp[8]; > struct xmmacc sv_xmm[16]; > u_char sv_pad[96]; > -} __aligned(16); > + u_char xsv_hd[64]; > + struct ymmacc sv_ymm[16]; > +} __aligned(64); >=20 > #ifdef _KERNEL > struct fpu_kern_ctx { > Index: sys/amd64/include/signal.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/include/signal.h (revision 217297) > +++ sys/amd64/include/signal.h (working copy) > @@ -98,7 +98,7 @@ > */ > long sc_fpformat; > long sc_ownedfp; > - long sc_fpstate[64] __aligned(16); > + long sc_fpstate[104] __aligned(64); >=20 > long sc_fsbase; > long sc_gsbase; > Index: sys/amd64/include/specialreg.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/include/specialreg.h (revision 217297) > +++ sys/amd64/include/specialreg.h (working copy) > @@ -66,6 +66,7 @@ > #define CR4_PCE 0x00000100 /* Performance monitoring counter enable */ > #define CR4_FXSR 0x00000200 /* Fast FPU save/restore used by OS */ > #define CR4_XMM 0x00000400 /* enable SIMD/MMX2 to use except 16 */ > +#define CR4_XSAVE 0x00040000 /* enable XSETBV/XGETBV */ >=20 > /* > * Bits in AMD64 special registers. EFER is 64 bits wide. > @@ -134,6 +135,9 @@ > #define CPUID2_MOVBE 0x00400000 > #define CPUID2_POPCNT 0x00800000 > #define CPUID2_AESNI 0x02000000 > +#define CPUID2_XSAVE 0x04000000 > +#define CPUID2_OSXSAVE 0x08000000 > +#define CPUID2_AVX 0x10000000 >=20 > /* > * Important bits in the Thermal and Power Management flags > Index: sys/amd64/amd64/initcpu.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/amd64/initcpu.c (revision 217297) > +++ sys/amd64/amd64/initcpu.c (working copy) > @@ -142,6 +142,19 @@ > } > } >=20 > + > +static void > +xsetbv(unsigned int index, unsigned long value) > +{ > + register_t eax =3D value; > + register_t edx =3D value >> 32; > + > + /* xsetbv */ > + __asm __volatile(".byte 0x0f,0x01,0xd1" :: > + "a"(eax), "d"(edx), "c"(index)); > +} > + > + > /* > * Initialize CPU control registers > */ > @@ -154,6 +167,11 @@ > load_cr4(rcr4() | CR4_FXSR | CR4_XMM); > cpu_fxsr =3D hw_instruction_sse =3D 1; > } > + if (cpu_feature2 & CPUID2_XSAVE) { > + load_cr4(rcr4() | CR4_XSAVE); > + /* enable to use xsave/xrstor */ > + xsetbv(0, 7); > + } > if ((amd_feature & AMDID_NX) !=3D 0) { > msr =3D rdmsr(MSR_EFER) | EFER_NXE; > wrmsr(MSR_EFER, msr); > Index: sys/amd64/amd64/cpu_switch.S > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/amd64/cpu_switch.S (revision 217297) > +++ sys/amd64/amd64/cpu_switch.S (working copy) > @@ -115,7 +115,20 @@ > jne 1f > movq PCB_SAVEFPU(%r8),%r8 > clts > + > + /* if the cpu has AVX, use xsave instead of fxsave */ > + testl $CPUID2_XSAVE,cpu_feature2 > + jne 2f > fxsave (%r8) > + jmp 3f > +2: > + mov $0x7, %eax > + mov %rdx, %rbx > + mov $0x0, %edx > + /* xsave (%r8) fix me when xsave is available */ > + .byte 0x41, 0x0f, 0xae, 0x20 > + mov %rbx, %rdx > +3: > smsw %ax > orb $CR0_TS,%al > lmsw %ax > @@ -302,8 +315,80 @@ > * Update pcb, saving current processor state. > */ > ENTRY(savectx) > + /* Fetch PCB. */ > + movq %rdi,%rcx > + > /* Save caller's return address. */ > movq (%rsp),%rax > + movq %rax,PCB_RIP(%rcx) > + > + movq %cr3,%rax > + movq %rax,PCB_CR3(%rcx) > + > + movq %rbx,PCB_RBX(%rcx) > + movq %rsp,PCB_RSP(%rcx) > + movq %rbp,PCB_RBP(%rcx) > + movq %r12,PCB_R12(%rcx) > + movq %r13,PCB_R13(%rcx) > + movq %r14,PCB_R14(%rcx) > + movq %r15,PCB_R15(%rcx) > + > + /* > + * If fpcurthread =3D=3D NULL, then the fpu h/w state is irrelevant and= the > + * state had better already be in the pcb. This is true for forks > + * but not for dumps (the old book-keeping with FP flags in the pcb > + * always lost for dumps because the dump pcb has 0 flags). > + * > + * If fpcurthread !=3D NULL, then we have to save the fpu h/w state to > + * fpcurthread's pcb and copy it to the requested pcb, or save to the > + * requested pcb and reload. Copying is easier because we would > + * have to handle h/w bugs for reloading. We used to lose the > + * parent's fpu state for forks by forgetting to reload. > + */ > + pushfq > + cli > + movq PCPU(FPCURTHREAD),%rax > + testq %rax,%rax > + je 1f > + > + movq TD_PCB(%rax),%rdi > + leaq PCB_SAVEFPU(%rdi),%rdi > + clts > + > + /* if the cpu has AVX, use xsave instead of fxsave */ > + testl $CPUID2_XSAVE,cpu_feature2 > + jne 2f > + fxsave (%rdi) > + jmp 3f > +2: > + mov $0x7, %eax > + mov $0x0, %edx > + /* xsave (%rdi) fix me when xsave is available */ > + .byte 0x0f, 0xae, 0x27 > +3: > + smsw %ax > + orb $CR0_TS,%al > + lmsw %ax > + > + movq $PCB_SAVEFPU_SIZE,%rdx /* arg 3 */ > + leaq PCB_SAVEFPU(%rcx),%rsi /* arg 2 */ > + /* arg 1 (%rdi) already loaded */ > + call bcopy > +1: > + popfq > + > + ret > +END(savectx) > + > +/* > + * savectx2(xpcb) > + * Update xpcb, saving current processor state. > + */ > +ENTRY(savectx2) > + /* Fetch XPCB. */ > + movq %rdi,%r8 > + /* Save caller's return address. */ > + movq (%rsp),%rax > movq %rax,PCB_RIP(%rdi) >=20 > movq %rbx,PCB_RBX(%rdi) > @@ -355,7 +440,17 @@ > str PCB_TR(%rdi) >=20 > clts > + /* if the cpu has AVX, use xsave instead of fxsave */ > + testl $CPUID2_XSAVE,cpu_feature2 > + jne 1f > fxsave PCB_USERFPU(%rdi) > + jmp 2f > +1: > + mov $0x7, %eax > + mov $0x0, %edx > + /* xsave PCB_USERFPU(%rdi) fix me when xsave is available */ > + .byte 0x0f, 0xae, 0xa7, 0x00, 0x01, 0x00, 0x00 > +2:=09 > movq %rsi,%cr0 /* The previous %cr0 is saved in %rsi. */ >=20 > movl $1,%eax > Index: sys/amd64/amd64/fpu.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/amd64/fpu.c (revision 217297) > +++ sys/amd64/amd64/fpu.c (working copy) > @@ -105,6 +105,40 @@ >=20 > static struct savefpu fpu_initialstate; >=20 > + > +static void > +xsave(struct savefpu *addr) > +{ > + if (cpu_feature2 & CPUID2_XSAVE) { > + /* __asm("xsave %0" : "=3Dm" (*(addr))) -> xsave (%rdi) */ > + __asm __volatile("mov $0x7, %%eax\n" > + "mov $0x0, %%edx\n" > + ".byte 0x0f, 0xae, 0x27" > + :: "D"(addr) > + : "%eax", "%edx", "memory"); > + } else { > + fxsave(addr); > + } > +} > + > + > +static void > +xrstor(struct savefpu *addr) > +{ > + if (cpu_feature2 & CPUID2_XSAVE) { > + /* __asm("xrstor %0" : : "m" (*(addr))) -> xrstor (%rdi) */ > + __asm __volatile("mov $0x7, %%eax\n" > + "mov $0x0, %%edx\n" > + ".byte 0x0f, 0xae, 0x2f" > + :: "D"(addr) > + : "%eax", "%edx"); > + } else { > + fxrstor(addr); > + } > +} > + > + > + > /* > * Initialize the floating point unit. On the boot CPU we generate a > * clean state that is used to initialize the floating point unit when > @@ -128,13 +162,14 @@ > mxcsr =3D __INITIAL_MXCSR__; > ldmxcsr(mxcsr); > if (PCPU_GET(cpuid) =3D=3D 0) { > - fxsave(&fpu_initialstate); > + xsave(&fpu_initialstate); > if (fpu_initialstate.sv_env.en_mxcsr_mask) > cpu_mxcsr_mask =3D fpu_initialstate.sv_env.en_mxcsr_mask; > else > cpu_mxcsr_mask =3D 0xFFBF; > bzero(fpu_initialstate.sv_fp, sizeof(fpu_initialstate.sv_fp)); > bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm)); > + bzero(fpu_initialstate.sv_ymm, sizeof(fpu_initialstate.sv_ymm)); > } > start_emulating(); > intr_restore(saveintr); > @@ -150,7 +185,7 @@ > critical_enter(); > if (curthread =3D=3D PCPU_GET(fpcurthread)) { > stop_emulating(); > - fxsave(PCPU_GET(curpcb)->pcb_save); > + xsave(PCPU_GET(curpcb)->pcb_save); > start_emulating(); > PCPU_SET(fpcurthread, 0); > } > @@ -423,7 +458,7 @@ > * the PCB doesn't contain a clean FPU state. Explicitly > * load an initial state. > */ > - fxrstor(&fpu_initialstate); > + xrstor(&fpu_initialstate); > if (pcb->pcb_initial_fpucw !=3D __INITIAL_FPUCW__) > fldcw(pcb->pcb_initial_fpucw); > if (PCB_USER_FPU(pcb)) > @@ -432,7 +467,7 @@ > else > set_pcb_flags(pcb, PCB_FPUINITDONE); > } else > - fxrstor(pcb->pcb_save); > + xrstor(pcb->pcb_save); > critical_exit(); > } >=20 > @@ -469,7 +504,26 @@ > } > critical_enter(); > if (td =3D=3D PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { > - fxsave(&pcb->pcb_user_save); > + /* > + * FIXME: > + * xsave requires that a boundary of a target address is 64B > + * and struct savefpu has an attribute for aligned 64B. But > + * gcc doesn't treat a variable on stack as 64B boundary. > + * So, it uses a buffer to do xsave safely and copy them the > + * target if a miss aligned address is passed. > + */ > + if ((unsigned long)&pcb->pcb_user_save % 64) { > + char tmp[sizeof(struct savefpu) + 63]; > + void *p =3D (void *)((unsigned long)(tmp + 63) & ~0x3f); > + > + bzero(((struct savefpu*)p)->xsv_hd, 64); > + > + xsave((struct savefpu*)p); > + bcopy(p, &pcb->pcb_user_save, sizeof(struct savefpu)); > + } else { > + bzero(pcb->pcb_user_save.xsv_hd, 64); > + xsave(&pcb->pcb_user_save); > + } > critical_exit(); > return (_MC_FPOWNED_FPU); > } else { > @@ -502,7 +556,24 @@ > pcb =3D td->td_pcb; > critical_enter(); > if (td =3D=3D PCPU_GET(fpcurthread) && PCB_USER_FPU(pcb)) { > - fxrstor(addr); > + > + /* In order to avoid #GP, initialize some of XSAVE.HEADER. */ > + u_long *header =3D (u_long*)(addr->xsv_hd); > + header[0] =3D 7; > + header[1] =3D 0; > + header[2] =3D 0; > + > + /* > + * FIXME: See fpugetregs() > + */ > + if ((unsigned long)addr % 64) { > + char tmp[sizeof(struct savefpu) + 63]; > + void *p =3D (void *)((unsigned long)(tmp + 63) & ~0x3f); > + bcopy(addr, p, sizeof(struct savefpu)); > + xrstor((struct savefpu*)p); > + } else { > + xrstor(addr); > + } > critical_exit(); > set_pcb_flags(pcb, PCB_FPUINITDONE | PCB_USERFPUINITDONE); > } else { > Index: sys/amd64/amd64/identcpu.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- sys/amd64/amd64/identcpu.c (revision 217297) > +++ sys/amd64/amd64/identcpu.c (working copy) > @@ -275,7 +275,7 @@ > "\012SSSE3" /* SSSE3 */ > "\013CNXT-ID" /* L1 context ID available */ > "\014" > - "\015" > + "\015FMA" > "\016CX16" /* CMPXCHG16B Instruction */ > "\017xTPR" /* Send Task Priority Messages*/ > "\020PDCM" /* Perf/Debug Capability MSR */ > @@ -291,7 +291,7 @@ > "\032AESNI" /* AES Crypto*/ > "\033XSAVE" > "\034OSXSAVE" > - "\035" > + "\035AVX" > "\036" > "\037" > "\040" >=20 >=20 >=20 > _______________________________________________ > freebsd-amd64@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-amd64 > To unsubscribe, send any mail to "freebsd-amd64-unsubscribe@freebsd.org" --793AmKFHRt0DieWq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk17vTQACgkQC3+MBN1Mb4g45QCgywazhcRbcACHyMaBpog/ueXM MiMAnjRnrIo6LmnoZARyytIdtXVEwcSG =xt2a -----END PGP SIGNATURE----- --793AmKFHRt0DieWq-- From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 17:20:10 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81AE5106566C for ; Sat, 12 Mar 2011 17:20:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 44E818FC1C for ; Sat, 12 Mar 2011 17:20:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2CHKAnk089661 for ; Sat, 12 Mar 2011 17:20:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2CHKANX089660; Sat, 12 Mar 2011 17:20:10 GMT (envelope-from gnats) Resent-Date: Sat, 12 Mar 2011 17:20:10 GMT Resent-Message-Id: <201103121720.p2CHKANX089660@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-amd64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Edward O'Callaghan" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 770C9106566C for ; Sat, 12 Mar 2011 17:19:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 66BC48FC08 for ; Sat, 12 Mar 2011 17:19:39 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p2CHJcAK042534 for ; Sat, 12 Mar 2011 17:19:38 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p2CHJcYB042533; Sat, 12 Mar 2011 17:19:38 GMT (envelope-from nobody) Message-Id: <201103121719.p2CHJcYB042533@red.freebsd.org> Date: Sat, 12 Mar 2011 17:19:38 GMT From: "Edward O'Callaghan" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 X-Mailman-Approved-At: Sat, 12 Mar 2011 19:42:30 +0000 Cc: Subject: amd64/155498: ral(4) needs to be resynced with OpenBSD's to gain RT2860/2870 support. X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 17:20:10 -0000 >Number: 155498 >Category: amd64 >Synopsis: ral(4) needs to be resynced with OpenBSD's to gain RT2860/2870 support. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-amd64 >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Mar 12 17:20:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Edward O'Callaghan >Release: FreeBSD 8.2-RELEASE >Organization: >Environment: FreeBSD 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: My friend has a Asus PCE-N13 which is technically a RaLink RT2860 chipset. He wants to run FreeBSD as Linux wifi is full of problems. I told him to check the Hardware notes and he said the RT2860 isn't supported however it is on OpenBSD. According to ral(4) on FreeBSD 8.2: AUTHORS The original ral driver was written by Damien Bergamini . According to ral(4) on OpenBSD 4.9: AUTHORS The ral driver was written by Damien Bergamini . Hence it follows that, Damien maybe the person to ask for a resync between the two drivers. However I shall open a ticket here to track this issue. Thanks for your time! Edward. >How-To-Repeat: Any RaLink RT2860 chipset will do, try to modload ral(4). >Fix: Integrate patches from OpenBSD's version of ral(4). >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-amd64@FreeBSD.ORG Sat Mar 12 20:35:31 2011 Return-Path: Delivered-To: freebsd-amd64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0AD7106566C; Sat, 12 Mar 2011 20:35:31 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9D5538FC18; Sat, 12 Mar 2011 20:35:31 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p2CKZVia075511; Sat, 12 Mar 2011 20:35:31 GMT (envelope-from linimon@freefall.freebsd.org) Received: (from linimon@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p2CKZVH1075507; Sat, 12 Mar 2011 20:35:31 GMT (envelope-from linimon) Date: Sat, 12 Mar 2011 20:35:31 GMT Message-Id: <201103122035.p2CKZVH1075507@freefall.freebsd.org> To: linimon@FreeBSD.org, freebsd-amd64@FreeBSD.org, freebsd-net@FreeBSD.org From: linimon@FreeBSD.org Cc: Subject: Re: kern/155498: [ral] ral(4) needs to be resynced with OpenBSD's to gain RT2860/2870 support. X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Mar 2011 20:35:31 -0000 Old Synopsis: ral(4) needs to be resynced with OpenBSD's to gain RT2860/2870 support. New Synopsis: [ral] ral(4) needs to be resynced with OpenBSD's to gain RT2860/2870 support. Responsible-Changed-From-To: freebsd-amd64->freebsd-net Responsible-Changed-By: linimon Responsible-Changed-When: Sat Mar 12 20:34:54 UTC 2011 Responsible-Changed-Why: reclassify and assign. http://www.freebsd.org/cgi/query-pr.cgi?pr=155498