From owner-svn-src-user@freebsd.org Tue Aug 18 09:03:26 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 90E579BBF77 for ; Tue, 18 Aug 2015 09:03:26 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 825A08F1; Tue, 18 Aug 2015 09:03:26 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7I93Qin026088; Tue, 18 Aug 2015 09:03:26 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7I93Q5N026087; Tue, 18 Aug 2015 09:03:26 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508180903.t7I93Q5N026087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 18 Aug 2015 09:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286875 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2015 09:03:26 -0000 Author: pho Date: Tue Aug 18 09:03:25 2015 New Revision: 286875 URL: https://svnweb.freebsd.org/changeset/base/286875 Log: Limit runtime. Cleanup code while here. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/rename12.sh Modified: user/pho/stress2/misc/rename12.sh ============================================================================== --- user/pho/stress2/misc/rename12.sh Tue Aug 18 08:29:13 2015 (r286874) +++ user/pho/stress2/misc/rename12.sh Tue Aug 18 09:03:25 2015 (r286875) @@ -49,18 +49,22 @@ newfs $newfs_flags md${mdstart}$part > / mount /dev/md${mdstart}$part $mntpoint inodes=`df -i $mntpoint | tail -1 | awk '{print $7}'` -N=12 -for i in `jot 4`; do - for j in `jot $N`; do +loops=4 +parallel=12 +timeout=1200 +start=`date '+%s'` +for i in `jot $loops`; do + for j in `jot $parallel`; do mkdir -p $mntpoint/d$j/dir1 mkdir -p $mntpoint/d$j/dir2 (cd $mntpoint/d$j; /tmp/rename12 $((inodes/N)) ) & done - for j in `jot $N`; do - wait + wait + for j in `jot $parallel`; do rmdir $mntpoint/d$j/dir1 rmdir $mntpoint/d$j/dir2 done + [ $((`date '+%s'` - start)) -lt $timeout ] && break done while mount | grep "on $mntpoint " | grep -q /dev/md; do @@ -72,6 +76,10 @@ mdconfig -d -u $mdstart rm -rf /tmp/rename12 exit 0 EOF +#include +#include +#include + #include #include #include @@ -79,9 +87,6 @@ EOF #include #include #include -#include -#include -#include #include pid_t crpid; @@ -159,7 +164,6 @@ main(int argc, char **argv) errx(1, "Usage %s ", argv[0]); n = atol(argv[1]); if (n > 32765) { -// fprintf(stderr, "Changing number of dirs from %ld to 32765\n", n); n = 32765 - 1; } From owner-svn-src-user@freebsd.org Tue Aug 18 09:05:59 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E05F89BC04C for ; Tue, 18 Aug 2015 09:05:59 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2130A31; Tue, 18 Aug 2015 09:05:59 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7I95xPO026258; Tue, 18 Aug 2015 09:05:59 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7I95xGi026257; Tue, 18 Aug 2015 09:05:59 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508180905.t7I95xGi026257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 18 Aug 2015 09:05:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286876 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2015 09:06:00 -0000 Author: pho Date: Tue Aug 18 09:05:59 2015 New Revision: 286876 URL: https://svnweb.freebsd.org/changeset/base/286876 Log: Added problem found and minor cleanup of the code. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/kevent6.sh Modified: user/pho/stress2/misc/kevent6.sh ============================================================================== --- user/pho/stress2/misc/kevent6.sh Tue Aug 18 09:03:25 2015 (r286875) +++ user/pho/stress2/misc/kevent6.sh Tue Aug 18 09:05:59 2015 (r286876) @@ -31,6 +31,10 @@ # "Sleeping thread (tid 101094, pid 13104) owns a non-sleepable lock" seen. # Fixed in r255798. +# panic: Memory modified after free: +# https://people.freebsd.org/~pho/stress/log/alan011.txt +# https://people.freebsd.org/~pho/stress/log/kevent6.txt + . ../default.cfg odir=`pwd` @@ -75,6 +79,7 @@ EOF #include #include +#define LOOPS 500000 #define PARALLEL 8 static char path[80]; @@ -106,7 +111,7 @@ test(void *arg __unused) struct kevent ev; struct timespec ts; - for (i = 0; i < 500000; i++) { + for (i = 0; i < LOOPS; i++) { if ((kq = kqueue()) < 0) err(1, "kqueue()"); From owner-svn-src-user@freebsd.org Tue Aug 18 12:26:39 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A26929BC320 for ; Tue, 18 Aug 2015 12:26:39 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93A35CCE; Tue, 18 Aug 2015 12:26:39 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7ICQd8s010231; Tue, 18 Aug 2015 12:26:39 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7ICQcgX010226; Tue, 18 Aug 2015 12:26:38 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508181226.t7ICQcgX010226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Tue, 18 Aug 2015 12:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286884 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Aug 2015 12:26:39 -0000 Author: pho Date: Tue Aug 18 12:26:38 2015 New Revision: 286884 URL: https://svnweb.freebsd.org/changeset/base/286884 Log: Minor cleanup. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/crossmp.sh user/pho/stress2/misc/crossmp3.sh user/pho/stress2/misc/crossmp4.sh Modified: user/pho/stress2/misc/crossmp.sh ============================================================================== --- user/pho/stress2/misc/crossmp.sh Tue Aug 18 11:52:45 2015 (r286883) +++ user/pho/stress2/misc/crossmp.sh Tue Aug 18 12:26:38 2015 (r286884) @@ -58,9 +58,7 @@ if [ $# -eq 0 ]; then ./$0 find & done - for i in `jot $mounts`; do - wait; wait - done + wait for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) Modified: user/pho/stress2/misc/crossmp3.sh ============================================================================== --- user/pho/stress2/misc/crossmp3.sh Tue Aug 18 11:52:45 2015 (r286883) +++ user/pho/stress2/misc/crossmp3.sh Tue Aug 18 12:26:38 2015 (r286884) @@ -40,6 +40,7 @@ . ../default.cfg +CONT=/tmp/crossmp3.continue N=`sysctl -n hw.ncpu` usermem=`sysctl -n hw.usermem` [ `swapinfo | wc -l` -eq 1 ] && usermem=$((usermem/100*80)) @@ -50,7 +51,8 @@ mounts=$N # Number of parallel scripts if [ $# -eq 0 ]; then for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) - [ ! -d ${mntpoint}$m ] && mkdir ${mntpoint}$m + [ ! -d ${mntpoint}$m ] && + { mkdir ${mntpoint}$m; chmod 755 ${mntpoint}$m; } mount | grep "${mntpoint}$m" | grep -q md$m && umount ${mntpoint}$m mdconfig -l | grep -q md$m && mdconfig -d -u $m @@ -60,26 +62,23 @@ if [ $# -eq 0 ]; then done # start the parallel tests + touch $CONT for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) ./$0 $m & ./$0 find & done - for i in `jot $mounts`; do - wait; wait - done + wait for i in `jot $mounts`; do m=$(( i + mdstart - 1 )) mdconfig -d -u $m - rm -f $D$m done else - touch /tmp/crossmp.continue if [ $1 = find ]; then - while [ -f /tmp/crossmp.continue ]; do + while [ -f $CONT ]; do find ${mntpoint}* -type f > /dev/null 2>&1 done else @@ -87,8 +86,8 @@ else # The test: Parallel mount and unmounts for i in `jot 3`; do m=$1 - mount /dev/md${m}${part} ${mntpoint}$m - chmod 777 ${mntpoint}$m + mount /dev/md${m}${part} ${mntpoint}$m && + chmod 777 ${mntpoint}$m export RUNDIR=${mntpoint}$m/stressX export CTRLDIR=${mntpoint}$m/stressX.control (cd ${mntpoint}$m && find . -delete) @@ -98,8 +97,9 @@ else while mount | grep -q "on ${mntpoint}$m "; do opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-f") umount $opt ${mntpoint}$m > /dev/null 2>&1 + [ -f $CONT ] || break 2 done done - rm -f /tmp/crossmp.continue + rm -f $CONT fi fi Modified: user/pho/stress2/misc/crossmp4.sh ============================================================================== --- user/pho/stress2/misc/crossmp4.sh Tue Aug 18 11:52:45 2015 (r286883) +++ user/pho/stress2/misc/crossmp4.sh Tue Aug 18 12:26:38 2015 (r286884) @@ -63,13 +63,8 @@ if [ $# -eq 0 ]; then ./$0 find & done - for i in `jot $mounts`; do - wait; wait - done + wait - for i in `jot $mounts`; do - rm -f $D$m - done while mount | grep -q "on $mntpoint "; do umount $mntpoint > /dev/null 2>&1 || sleep 1 done From owner-svn-src-user@freebsd.org Wed Aug 19 15:30:56 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BAE39BE04C for ; Wed, 19 Aug 2015 15:30:56 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1E5ED92; Wed, 19 Aug 2015 15:30:55 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7JFUtQ6001347; Wed, 19 Aug 2015 15:30:55 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7JFUtku001346; Wed, 19 Aug 2015 15:30:55 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508191530.t7JFUtku001346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Wed, 19 Aug 2015 15:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286925 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Aug 2015 15:30:56 -0000 Author: pho Date: Wed Aug 19 15:30:55 2015 New Revision: 286925 URL: https://svnweb.freebsd.org/changeset/base/286925 Log: Added a problem fixed by. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/kevent6.sh Modified: user/pho/stress2/misc/kevent6.sh ============================================================================== --- user/pho/stress2/misc/kevent6.sh Wed Aug 19 15:18:32 2015 (r286924) +++ user/pho/stress2/misc/kevent6.sh Wed Aug 19 15:30:55 2015 (r286925) @@ -34,6 +34,7 @@ # panic: Memory modified after free: # https://people.freebsd.org/~pho/stress/log/alan011.txt # https://people.freebsd.org/~pho/stress/log/kevent6.txt +# Fixed by: r286921 . ../default.cfg From owner-svn-src-user@freebsd.org Fri Aug 21 05:02:29 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28D009BDA1A for ; Fri, 21 Aug 2015 05:02:29 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 187651732; Fri, 21 Aug 2015 05:02:29 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7L52TQb058211; Fri, 21 Aug 2015 05:02:29 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7L52RaI058201; Fri, 21 Aug 2015 05:02:27 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201508210502.t7L52RaI058201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 21 Aug 2015 05:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286979 - in user/marcel/libvdsk: bhyve bhyveload X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 05:02:29 -0000 Author: marcel Date: Fri Aug 21 05:02:26 2015 New Revision: 286979 URL: https://svnweb.freebsd.org/changeset/base/286979 Log: Sync with ^/head@286949 Added: user/marcel/libvdsk/bhyve/Makefile.depend - copied unchanged from r286949, head/usr.sbin/bhyve/Makefile.depend user/marcel/libvdsk/bhyve/bootrom.c - copied unchanged from r286949, head/usr.sbin/bhyve/bootrom.c user/marcel/libvdsk/bhyve/bootrom.h - copied unchanged from r286949, head/usr.sbin/bhyve/bootrom.h Modified: user/marcel/libvdsk/bhyve/Makefile user/marcel/libvdsk/bhyve/acpi.c user/marcel/libvdsk/bhyve/ahci.h user/marcel/libvdsk/bhyve/bhyve.8 user/marcel/libvdsk/bhyve/bhyverun.c user/marcel/libvdsk/bhyve/block_if.c user/marcel/libvdsk/bhyve/block_if.h user/marcel/libvdsk/bhyve/dbgport.c user/marcel/libvdsk/bhyve/inout.c user/marcel/libvdsk/bhyve/ioapic.c user/marcel/libvdsk/bhyve/ioapic.h user/marcel/libvdsk/bhyve/pci_ahci.c user/marcel/libvdsk/bhyve/pci_emul.c user/marcel/libvdsk/bhyve/pci_hostbridge.c user/marcel/libvdsk/bhyve/pci_irq.c user/marcel/libvdsk/bhyve/pci_irq.h user/marcel/libvdsk/bhyve/pci_lpc.c user/marcel/libvdsk/bhyve/pci_lpc.h user/marcel/libvdsk/bhyve/pci_passthru.c user/marcel/libvdsk/bhyve/pci_virtio_block.c user/marcel/libvdsk/bhyve/pci_virtio_net.c user/marcel/libvdsk/bhyve/pci_virtio_rnd.c user/marcel/libvdsk/bhyve/pm.c user/marcel/libvdsk/bhyve/task_switch.c user/marcel/libvdsk/bhyve/uart_emul.c user/marcel/libvdsk/bhyve/virtio.c user/marcel/libvdsk/bhyve/virtio.h user/marcel/libvdsk/bhyveload/Makefile user/marcel/libvdsk/bhyveload/bhyveload.8 user/marcel/libvdsk/bhyveload/bhyveload.c Directory Properties: user/marcel/libvdsk/bhyve/ (props changed) user/marcel/libvdsk/bhyveload/ (props changed) Modified: user/marcel/libvdsk/bhyve/Makefile ============================================================================== --- user/marcel/libvdsk/bhyve/Makefile Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/Makefile Fri Aug 21 05:02:26 2015 (r286979) @@ -13,6 +13,7 @@ SRCS= \ acpi.c \ bhyverun.c \ block_if.c \ + bootrom.c \ consport.c \ dbgport.c \ inout.c \ @@ -43,8 +44,8 @@ SRCS= \ .PATH: /sys/amd64/vmm SRCS+= vmm_instruction_emul.c -DPADD= ${LIBVDSK} ${LIBVMMAPI} ${LIBMD} ${LIBUTIL} ${LIBPTHREAD} -LDADD= -lvdsk -lvmmapi -lmd -lutil -lpthread +DPADD= ${LIBVDSK} ${LIBVMMAPI} ${LIBMD} ${LIBPTHREAD} +LDADD= -lvdsk -lvmmapi -lmd -lpthread WARNS?= 2 Copied: user/marcel/libvdsk/bhyve/Makefile.depend (from r286949, head/usr.sbin/bhyve/Makefile.depend) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/marcel/libvdsk/bhyve/Makefile.depend Fri Aug 21 05:02:26 2015 (r286979, copy of r286949, head/usr.sbin/bhyve/Makefile.depend) @@ -0,0 +1,22 @@ +# $FreeBSD$ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + gnu/lib/csu \ + gnu/lib/libgcc \ + include \ + include/xlocale \ + lib/${CSU_DIR} \ + lib/libc \ + lib/libcompiler_rt \ + lib/libmd \ + lib/libthr \ + lib/libutil \ + lib/libvmmapi \ + + +.include + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif Modified: user/marcel/libvdsk/bhyve/acpi.c ============================================================================== --- user/marcel/libvdsk/bhyve/acpi.c Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/acpi.c Fri Aug 21 05:02:26 2015 (r286979) @@ -386,7 +386,7 @@ basl_fwrite_fadt(FILE *fp) EFPRINTF(fp, "[0001]\t\tDuty Cycle Width : 00\n"); EFPRINTF(fp, "[0001]\t\tRTC Day Alarm Index : 00\n"); EFPRINTF(fp, "[0001]\t\tRTC Month Alarm Index : 00\n"); - EFPRINTF(fp, "[0001]\t\tRTC Century Index : 00\n"); + EFPRINTF(fp, "[0001]\t\tRTC Century Index : 32\n"); EFPRINTF(fp, "[0002]\t\tBoot Flags (decoded below) : 0000\n"); EFPRINTF(fp, "\t\t\tLegacy Devices Supported (V2) : 0\n"); EFPRINTF(fp, "\t\t\t8042 Present on ports 60/64 (V2) : 0\n"); Modified: user/marcel/libvdsk/bhyve/ahci.h ============================================================================== --- user/marcel/libvdsk/bhyve/ahci.h Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/ahci.h Fri Aug 21 05:02:26 2015 (r286979) @@ -96,13 +96,14 @@ #define ATA_SS_SPD_NO_SPEED 0x00000000 #define ATA_SS_SPD_GEN1 0x00000010 #define ATA_SS_SPD_GEN2 0x00000020 -#define ATA_SS_SPD_GEN3 0x00000040 +#define ATA_SS_SPD_GEN3 0x00000030 #define ATA_SS_IPM_MASK 0x00000f00 #define ATA_SS_IPM_NO_DEVICE 0x00000000 #define ATA_SS_IPM_ACTIVE 0x00000100 #define ATA_SS_IPM_PARTIAL 0x00000200 #define ATA_SS_IPM_SLUMBER 0x00000600 +#define ATA_SS_IPM_DEVSLEEP 0x00000800 #define ATA_SERROR 14 #define ATA_SE_DATA_CORRECTED 0x00000001 @@ -133,17 +134,19 @@ #define ATA_SC_SPD_NO_SPEED 0x00000000 #define ATA_SC_SPD_SPEED_GEN1 0x00000010 #define ATA_SC_SPD_SPEED_GEN2 0x00000020 -#define ATA_SC_SPD_SPEED_GEN3 0x00000040 +#define ATA_SC_SPD_SPEED_GEN3 0x00000030 #define ATA_SC_IPM_MASK 0x00000f00 #define ATA_SC_IPM_NONE 0x00000000 #define ATA_SC_IPM_DIS_PARTIAL 0x00000100 #define ATA_SC_IPM_DIS_SLUMBER 0x00000200 +#define ATA_SC_IPM_DIS_DEVSLEEP 0x00000400 #define ATA_SACTIVE 16 #define AHCI_MAX_PORTS 32 #define AHCI_MAX_SLOTS 32 +#define AHCI_MAX_IRQS 16 /* SATA AHCI v1.0 register defines */ #define AHCI_CAP 0x00 @@ -208,6 +211,9 @@ #define AHCI_CAP2_BOH 0x00000001 #define AHCI_CAP2_NVMP 0x00000002 #define AHCI_CAP2_APST 0x00000004 +#define AHCI_CAP2_SDS 0x00000008 +#define AHCI_CAP2_SADM 0x00000010 +#define AHCI_CAP2_DESO 0x00000020 #define AHCI_OFFSET 0x100 #define AHCI_STEP 0x80 @@ -265,6 +271,7 @@ #define AHCI_P_CMD_ACTIVE 0x10000000 #define AHCI_P_CMD_PARTIAL 0x20000000 #define AHCI_P_CMD_SLUMBER 0x60000000 +#define AHCI_P_CMD_DEVSLEEP 0x80000000 #define AHCI_P_TFD 0x20 #define AHCI_P_SIG 0x24 @@ -284,6 +291,17 @@ #define AHCI_P_FBS_ADO_SHIFT 12 #define AHCI_P_FBS_DWE 0x000f0000 #define AHCI_P_FBS_DWE_SHIFT 16 +#define AHCI_P_DEVSLP 0x44 +#define AHCI_P_DEVSLP_ADSE 0x00000001 +#define AHCI_P_DEVSLP_DSP 0x00000002 +#define AHCI_P_DEVSLP_DETO 0x000003fc +#define AHCI_P_DEVSLP_DETO_SHIFT 2 +#define AHCI_P_DEVSLP_MDAT 0x00007c00 +#define AHCI_P_DEVSLP_MDAT_SHIFT 10 +#define AHCI_P_DEVSLP_DITO 0x01ff8000 +#define AHCI_P_DEVSLP_DITO_SHIFT 15 +#define AHCI_P_DEVSLP_DM 0x0e000000 +#define AHCI_P_DEVSLP_DM_SHIFT 25 /* Just to be sure, if building as module. */ #if MAXPHYS < 512 * 1024 Modified: user/marcel/libvdsk/bhyve/bhyve.8 ============================================================================== --- user/marcel/libvdsk/bhyve/bhyve.8 Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/bhyve.8 Fri Aug 21 05:02:26 2015 (r286979) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2014 +.Dd August 7, 2015 .Dt BHYVE 8 .Os .Sh NAME @@ -32,7 +32,7 @@ .Nd "run a guest operating system inside a virtual machine" .Sh SYNOPSIS .Nm -.Op Fl abehuwxACHPWY +.Op Fl abehuwxACHPSWY .Op Fl c Ar numcpus .Op Fl g Ar gdbport .Op Fl l Ar lpcdev Ns Op , Ns Ar conf @@ -50,7 +50,7 @@ Parameters such as the number of virtual I/O connectivity can be specified with command-line parameters. .Pp The guest operating system must be loaded with -.Xr bhyveload 4 +.Xr bhyveload 8 or a similar boot loader before running .Nm . .Pp @@ -61,8 +61,8 @@ exit is detected. .Bl -tag -width 10n .It Fl a The guest's local APIC is configured in xAPIC mode. -The xAPIC mode is the default setting so this option is redundant. It will be -deprecated in a future version. +The xAPIC mode is the default setting so this option is redundant. +It will be deprecated in a future version. .It Fl A Generate ACPI tables. Required for @@ -99,10 +99,12 @@ Yield the virtual CPU thread when a HLT If this option is not specified, virtual CPUs will use 100% of a host CPU. .It Fl l Ar lpcdev Ns Op , Ns Ar conf Allow devices behind the LPC PCI-ISA bridge to be configured. -The only supported devices are the TTY-class devices, -.Li com1 +The only supported devices are the TTY-class devices +.Ar com1 and -.Li com2 . +.Ar com2 +and the boot ROM device +.Ar bootrom . .It Fl m Ar size Ns Op Ar K|k|M|m|G|g|T|t Guest physical memory size in bytes. This must be the same size that was given to @@ -122,7 +124,7 @@ Force the guest virtual CPU to exit when .It Fl s Ar slot,emulation Ns Op , Ns Ar conf Configure a virtual PCI slot and function. .Pp -.Nm bhyve +.Nm provides PCI bus emulation and virtual devices that can be attached to slots on the bus. There are 32 available slots, with the option of providing up to 8 functions @@ -134,11 +136,19 @@ per slot. .Pp The .Ar pcislot -value is 0 to 31. The optional function value is 0 to 7. The optional +value is 0 to 31. +The optional +.Ar function +value is 0 to 7. +The optional .Ar bus value is 0 to 255. -If not specified, the function value defaults to 0. -If not specified, the bus value defaults to 0. +If not specified, the +.Ar function +value defaults to 0. +If not specified, the +.Ar bus +value defaults to 0. .It Ar emulation .Bl -tag -width 10n .It Li hostbridge | Li amd_hostbridge @@ -165,8 +175,8 @@ AHCI controller attached to a SATA hard- .It Li uart PCI 16550 serial device. .It Li lpc -LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports. The LPC bridge -emulation can only be configured on bus 0. +LPC PCI-ISA bridge with COM1 and COM2 16550 serial ports and a boot ROM. +The LPC bridge emulation can only be configured on bus 0. .El .It Op Ar conf This optional parameter describes the backend for device emulations. @@ -193,8 +203,13 @@ format. .Pp Block storage devices: .Bl -tag -width 10n -.It Pa /filename Ns Oo , Ns Li nocache Oc Ns Oo , Ns Li direct Oc Ns Oo , Ns Li ro Oc -.It Pa /dev/xxx Ns Oo , Ns Ar nocache Oc Ns Oo , Ns Ar direct Oc Ns Oo , Ns Ar ro Oc +.It Pa /filename Ns Oo , Ns Ar block-device-options Oc +.It Pa /dev/xxx Ns Oo , Ns Ar block-device-options Oc +.El +.Pp +The +.Ar block-device-options +are: .Bl -tag -width 8n .It Li nocache Open the file with @@ -204,25 +219,31 @@ Open the file using .Dv O_SYNC . .It Li ro Force the file to be opened read-only. -.El -.Pp -The -.Li nocache , -.Li direct , -and -.Li ro -options are not available for virtio block devices. +.It Li sectorsize= Ns Ar logical Ns Oo / Ns Ar physical Oc +Specify the logical and physical sector sizes of the emulated disk. +The physical sector size is optional and is equal to the logical sector size +if not explicitly specified. .El .Pp TTY devices: .Bl -tag -width 10n .It Li stdio Connect the serial port to the standard input and output of -the bhyve process. +the +.Nm +process. .It Pa /dev/xxx Use the host TTY device for serial port I/O. .El .Pp +Boot ROM device: +.Bl -tag -width 10n +.It Pa romfile +Map +.Ar romfile +in the guest address space reserved for boot firmware. +.El +.Pp Pass-through devices: .Bl -tag -width 10n .It Ns Ar slot Ns / Ns Ar bus Ns / Ns Ar function @@ -234,11 +255,17 @@ and numbers. .El .Pp +Guest memory must be wired using the +.Fl S +option when a pass-through device is configured. +.Pp The host device must have been reserved at boot-time using the .Va pptdev loader variable as described in .Xr vmm 4 . .El +.It Fl S +Wire guest memory. .It Fl u RTC keeps UTC time. .It Fl U Ar uuid @@ -248,7 +275,8 @@ in the guest's System Management BIOS Sy By default a UUID is generated from the host's hostname and .Ar vmname . .It Fl w -Ignore accesses to unimplemented Model Specific Registers (MSRs). This is intended for debug purposes. +Ignore accesses to unimplemented Model Specific Registers (MSRs). +This is intended for debug purposes. .It Fl W Force virtio PCI device emulations to use MSI interrupts instead of MSI-X interrupts. @@ -263,7 +291,7 @@ This should be the same as that created .El .Sh EXAMPLES The guest operating system must have been loaded with -.Xr bhyveload 4 +.Xr bhyveload 8 or a similar boot loader before .Xr bhyve 4 can be run. @@ -291,9 +319,9 @@ Run an 8GB quad-CPU virtual machine with CD-ROM, a single virtio network port, an AMD hostbridge, and the console port connected to an .Xr nmdm 4 -null-model device. +null-modem device. .Bd -literal -offset indent -bhyve -c 4 \e\ +bhyve -c 4 \\ -s 0,amd_hostbridge -s 1,lpc \\ -s 1:0,ahci-hd,/images/disk.1 \\ -s 1:1,ahci-hd,/images/disk.2 \\ @@ -303,7 +331,7 @@ bhyve -c 4 \e\ -s 1:5,ahci-hd,/images/disk.6 \\ -s 1:6,ahci-hd,/images/disk.7 \\ -s 1:7,ahci-hd,/images/disk.8 \\ - -s 2,ahci-cd,/images.install.iso \\ + -s 2,ahci-cd,/images/install.iso \\ -s 3,virtio-net,tap0 \\ -l com1,/dev/nmdm0A \\ -A -H -P -m 8G Modified: user/marcel/libvdsk/bhyve/bhyverun.c ============================================================================== --- user/marcel/libvdsk/bhyve/bhyverun.c Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/bhyverun.c Fri Aug 21 05:02:26 2015 (r286979) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -100,7 +101,7 @@ static struct vm_exit vmexit[VM_MAXCPU]; struct bhyvestats { uint64_t vmexit_bogus; - uint64_t vmexit_bogus_switch; + uint64_t vmexit_reqidle; uint64_t vmexit_hlt; uint64_t vmexit_pause; uint64_t vmexit_mtrap; @@ -122,7 +123,7 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPWY] [-c vcpus] [-g ] [-l ]\n" + "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" @@ -137,6 +138,7 @@ usage(int code) " -p: pin 'vcpu' to 'hostcpu'\n" " -P: vmexit from the guest on pause\n" " -s: PCI slot config\n" + " -S: guest memory cannot be swapped\n" " -u: RTC keeps UTC time\n" " -U: uuid\n" " -w: ignore unimplemented MSRs\n" @@ -325,8 +327,10 @@ vmexit_inout(struct vmctx *ctx, struct v error = emulate_inout(ctx, vcpu, vme, strictio); if (error) { - fprintf(stderr, "Unhandled %s%c 0x%04x\n", in ? "in" : "out", - bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), port); + fprintf(stderr, "Unhandled %s%c 0x%04x at 0x%lx\n", + in ? "in" : "out", + bytes == 1 ? 'b' : (bytes == 2 ? 'w' : 'l'), + port, vmexit->rip); return (VMEXIT_ABORT); } else { return (VMEXIT_CONTINUE); @@ -459,6 +463,17 @@ vmexit_bogus(struct vmctx *ctx, struct v } static int +vmexit_reqidle(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) +{ + + assert(vmexit->inst_length == 0); + + stats.vmexit_reqidle++; + + return (VMEXIT_CONTINUE); +} + +static int vmexit_hlt(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { @@ -495,22 +510,27 @@ vmexit_mtrap(struct vmctx *ctx, struct v static int vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) { - int err; + int err, i; + struct vie *vie; + stats.vmexit_inst_emul++; + vie = &vmexit->u.inst_emul.vie; err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa, - &vmexit->u.inst_emul.vie, &vmexit->u.inst_emul.paging); + vie, &vmexit->u.inst_emul.paging); if (err) { - if (err == EINVAL) { - fprintf(stderr, - "Failed to emulate instruction at 0x%lx\n", - vmexit->rip); - } else if (err == ESRCH) { + if (err == ESRCH) { fprintf(stderr, "Unhandled memory access to 0x%lx\n", vmexit->u.inst_emul.gpa); } + fprintf(stderr, "Failed to emulate instruction ["); + for (i = 0; i < vie->num_valid; i++) { + fprintf(stderr, "0x%02x%s", vie->inst[i], + i != (vie->num_valid - 1) ? " " : ""); + } + fprintf(stderr, "] at 0x%lx\n", vmexit->rip); return (VMEXIT_ABORT); } @@ -564,6 +584,7 @@ static vmexit_handler_t handler[VM_EXITC [VM_EXITCODE_VMX] = vmexit_vmx, [VM_EXITCODE_SVM] = vmexit_svm, [VM_EXITCODE_BOGUS] = vmexit_bogus, + [VM_EXITCODE_REQIDLE] = vmexit_reqidle, [VM_EXITCODE_RDMSR] = vmexit_rdmsr, [VM_EXITCODE_WRMSR] = vmexit_wrmsr, [VM_EXITCODE_MTRAP] = vmexit_mtrap, @@ -681,26 +702,82 @@ fbsdrun_set_capabilities(struct vmctx *c vm_set_capability(ctx, cpu, VM_CAP_ENABLE_INVPCID, 1); } +static struct vmctx * +do_open(const char *vmname) +{ + struct vmctx *ctx; + int error; + bool reinit, romboot; + + reinit = romboot = false; + + if (lpc_bootrom()) + romboot = true; + + error = vm_create(vmname); + if (error) { + if (errno == EEXIST) { + if (romboot) { + reinit = true; + } else { + /* + * The virtual machine has been setup by the + * userspace bootloader. + */ + } + } else { + perror("vm_create"); + exit(1); + } + } else { + if (!romboot) { + /* + * If the virtual machine was just created then a + * bootrom must be configured to boot it. + */ + fprintf(stderr, "virtual machine cannot be booted\n"); + exit(1); + } + } + + ctx = vm_open(vmname); + if (ctx == NULL) { + perror("vm_open"); + exit(1); + } + + if (reinit) { + error = vm_reinit(ctx); + if (error) { + perror("vm_reinit"); + exit(1); + } + } + return (ctx); +} + int main(int argc, char *argv[]) { int c, error, gdb_port, err, bvmcons; - int dump_guest_memory, max_vcpus, mptgen; + int max_vcpus, mptgen, memflags; int rtc_localtime; struct vmctx *ctx; uint64_t rip; size_t memsize; + char *optstr; bvmcons = 0; - dump_guest_memory = 0; progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; memsize = 256 * MB; mptgen = 1; rtc_localtime = 1; + memflags = 0; - while ((c = getopt(argc, argv, "abehuwxACHIPWYp:g:c:s:m:l:U:")) != -1) { + optstr = "abehuwxACHIPSWYp:g:c:s:m:l:U:"; + while ((c = getopt(argc, argv, optstr)) != -1) { switch (c) { case 'a': x2apic_mode = 0; @@ -721,7 +798,7 @@ main(int argc, char *argv[]) guest_ncpus = atoi(optarg); break; case 'C': - dump_guest_memory = 1; + memflags |= VM_MEM_F_INCORE; break; case 'g': gdb_port = atoi(optarg); @@ -737,6 +814,9 @@ main(int argc, char *argv[]) exit(1); else break; + case 'S': + memflags |= VM_MEM_F_WIRED; + break; case 'm': error = vm_parse_memsize(optarg, &memsize); if (error) @@ -791,10 +871,10 @@ main(int argc, char *argv[]) usage(1); vmname = argv[0]; + ctx = do_open(vmname); - ctx = vm_open(vmname); - if (ctx == NULL) { - perror("vm_open"); + if (guest_ncpus < 1) { + fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus); exit(1); } @@ -807,11 +887,10 @@ main(int argc, char *argv[]) fbsdrun_set_capabilities(ctx, BSP); - if (dump_guest_memory) - vm_set_memflags(ctx, VM_MEM_F_INCORE); + vm_set_memflags(ctx, memflags); err = vm_setup_memory(ctx, memsize, VM_MMAP_ALL); if (err) { - fprintf(stderr, "Unable to setup memory (%d)\n", err); + fprintf(stderr, "Unable to setup memory (%d)\n", errno); exit(1); } @@ -841,6 +920,16 @@ main(int argc, char *argv[]) if (bvmcons) init_bvmcons(); + if (lpc_bootrom()) { + if (vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1)) { + fprintf(stderr, "ROM boot failed: unrestricted guest " + "capability not available\n"); + exit(1); + } + error = vcpu_reset(ctx, BSP); + assert(error == 0); + } + error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip); assert(error == 0); Modified: user/marcel/libvdsk/bhyve/block_if.c ============================================================================== --- user/marcel/libvdsk/bhyve/block_if.c Fri Aug 21 02:42:14 2015 (r286978) +++ user/marcel/libvdsk/bhyve/block_if.c Fri Aug 21 05:02:26 2015 (r286979) @@ -53,16 +53,19 @@ __FBSDID("$FreeBSD$"); #define BLOCKIF_SIG 0xb109b109 -#define BLOCKIF_MAXREQ 33 +#define BLOCKIF_NUMTHR 8 +#define BLOCKIF_MAXREQ (64 + BLOCKIF_NUMTHR) enum blockop { BOP_READ, BOP_WRITE, - BOP_FLUSH + BOP_FLUSH, + BOP_DELETE }; enum blockstat { BST_FREE, + BST_BLOCK, BST_PEND, BST_BUSY, BST_DONE @@ -74,21 +77,22 @@ struct blockif_elem { enum blockop be_op; enum blockstat be_status; pthread_t be_tid; + off_t be_block; }; struct blockif_ctxt { int bc_magic; + int bc_candelete; int bc_rdonly; - pthread_t bc_btid; + int bc_closing; + pthread_t bc_btid[BLOCKIF_NUMTHR]; pthread_mutex_t bc_mtx; pthread_cond_t bc_cond; - int bc_closing; /* Request elements and free/pending/busy queues */ TAILQ_HEAD(, blockif_elem) bc_freeq; TAILQ_HEAD(, blockif_elem) bc_pendq; TAILQ_HEAD(, blockif_elem) bc_busyq; - u_int bc_req_count; struct blockif_elem bc_reqs[BLOCKIF_MAXREQ]; }; @@ -107,69 +111,95 @@ static int blockif_enqueue(struct blockif_ctxt *bc, struct blockif_req *breq, enum blockop op) { - struct blockif_elem *be; - - assert(bc->bc_req_count < BLOCKIF_MAXREQ); + struct blockif_elem *be, *tbe; + off_t off; + int i; be = TAILQ_FIRST(&bc->bc_freeq); assert(be != NULL); assert(be->be_status == BST_FREE); - TAILQ_REMOVE(&bc->bc_freeq, be, be_link); - be->be_status = BST_PEND; be->be_req = breq; be->be_op = op; + switch (op) { + case BOP_READ: + case BOP_WRITE: + case BOP_DELETE: + off = breq->br_offset; + for (i = 0; i < breq->br_iovcnt; i++) + off += breq->br_iov[i].iov_len; + break; + default: + off = OFF_MAX; + } + be->be_block = off; + TAILQ_FOREACH(tbe, &bc->bc_pendq, be_link) { + if (tbe->be_block == breq->br_offset) + break; + } + if (tbe == NULL) { + TAILQ_FOREACH(tbe, &bc->bc_busyq, be_link) { + if (tbe->be_block == breq->br_offset) + break; + } + } + if (tbe == NULL) + be->be_status = BST_PEND; + else + be->be_status = BST_BLOCK; TAILQ_INSERT_TAIL(&bc->bc_pendq, be, be_link); - - bc->bc_req_count++; - - return (0); + return (be->be_status == BST_PEND); } static int -blockif_dequeue(struct blockif_ctxt *bc, struct blockif_elem **bep) +blockif_dequeue(struct blockif_ctxt *bc, pthread_t t, struct blockif_elem **bep) { struct blockif_elem *be; - if (bc->bc_req_count == 0) - return (ENOENT); - - be = TAILQ_FIRST(&bc->bc_pendq); - assert(be != NULL); - assert(be->be_status == BST_PEND); + TAILQ_FOREACH(be, &bc->bc_pendq, be_link) { + if (be->be_status == BST_PEND) + break; + assert(be->be_status == BST_BLOCK); + } + if (be == NULL) + return (0); TAILQ_REMOVE(&bc->bc_pendq, be, be_link); be->be_status = BST_BUSY; - be->be_tid = bc->bc_btid; + be->be_tid = t; TAILQ_INSERT_TAIL(&bc->bc_busyq, be, be_link); - *bep = be; - - return (0); + return (1); } static void blockif_complete(struct blockif_ctxt *bc, struct blockif_elem *be) { - assert(be->be_status == BST_DONE); + struct blockif_elem *tbe; - TAILQ_REMOVE(&bc->bc_busyq, be, be_link); + if (be->be_status == BST_DONE || be->be_status == BST_BUSY) + TAILQ_REMOVE(&bc->bc_busyq, be, be_link); + else + TAILQ_REMOVE(&bc->bc_pendq, be, be_link); + TAILQ_FOREACH(tbe, &bc->bc_pendq, be_link) { + if (tbe->be_req->br_offset == be->be_block) + tbe->be_status = BST_PEND; + } be->be_tid = 0; be->be_status = BST_FREE; be->be_req = NULL; TAILQ_INSERT_TAIL(&bc->bc_freeq, be, be_link); - - bc->bc_req_count--; } static void -blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be) +blockif_proc(struct blockif_ctxt *bc, struct blockif_elem *be, uint8_t *buf) { struct blockif_req *br; int err; br = be->be_req; + if (br->br_iovcnt <= 1) + buf = NULL; err = 0; - switch (be->be_op) { case BOP_READ: err = vdsk_read(bc, br->br_iov, br->br_iovcnt, br->br_offset); @@ -180,6 +210,14 @@ blockif_proc(struct blockif_ctxt *bc, st case BOP_FLUSH: err = vdsk_flush(bc); break; + case BOP_DELETE: + if (!bc->bc_candelete) + err = EOPNOTSUPP; + else if (bc->bc_rdonly) + err = EROFS; + else + err = EOPNOTSUPP; + break; default: err = EINVAL; break; @@ -195,28 +233,27 @@ blockif_thr(void *arg) { struct blockif_ctxt *bc; struct blockif_elem *be; + pthread_t t; bc = arg; + t = pthread_self(); + pthread_mutex_lock(&bc->bc_mtx); for (;;) { - pthread_mutex_lock(&bc->bc_mtx); - while (!blockif_dequeue(bc, &be)) { + while (blockif_dequeue(bc, t, &be)) { pthread_mutex_unlock(&bc->bc_mtx); - blockif_proc(bc, be); + blockif_proc(bc, be, NULL); pthread_mutex_lock(&bc->bc_mtx); blockif_complete(bc, be); } - pthread_cond_wait(&bc->bc_cond, &bc->bc_mtx); - pthread_mutex_unlock(&bc->bc_mtx); - - /* - * Check ctxt status here to see if exit requested - */ + /* Check ctxt status here to see if exit requested */ if (bc->bc_closing) - pthread_exit(NULL); + break; + pthread_cond_wait(&bc->bc_cond, &bc->bc_mtx); } + pthread_mutex_unlock(&bc->bc_mtx); - /* Not reached */ + pthread_exit(NULL); return (NULL); } @@ -256,13 +293,14 @@ struct blockif_ctxt * blockif_open(const char *optstr, const char *ident) { char tname[MAXCOMLEN + 1]; - char *nopt, *xopts; + char *nopt, *xopts, *cp; struct blockif_ctxt *bc; int extra, i; - int nocache, sync, ro; + int nocache, sync, ro, candelete, ssopt, pssopt; pthread_once(&blockif_once, blockif_init); + ssopt = 0; nocache = 0; sync = 0; ro = 0; @@ -271,16 +309,25 @@ blockif_open(const char *optstr, const c * The first element in the optstring is always a pathname. * Optional elements follow */ - nopt = strdup(optstr); - for (xopts = strtok(nopt, ","); - xopts != NULL; - xopts = strtok(NULL, ",")) { - if (!strcmp(xopts, "nocache")) + nopt = xopts = strdup(optstr); + while (xopts != NULL) { + cp = strsep(&xopts, ","); + if (cp == nopt) /* file or device pathname */ + continue; + else if (!strcmp(cp, "nocache")) nocache = 1; - else if (!strcmp(xopts, "sync")) + else if (!strcmp(cp, "sync") || !strcmp(cp, "direct")) sync = 1; - else if (!strcmp(xopts, "ro")) + else if (!strcmp(cp, "ro")) ro = 1; + else if (sscanf(cp, "sectorsize=%d/%d", &ssopt, &pssopt) == 2) + ; + else if (sscanf(cp, "sectorsize=%d", &ssopt) == 1) + pssopt = ssopt; + else { + fprintf(stderr, "Invalid device option \"%s\"\n", cp); + return (NULL); + } } extra = 0; @@ -302,22 +349,23 @@ blockif_open(const char *optstr, const c } bc->bc_magic = BLOCKIF_SIG; + bc->bc_candelete = candelete; bc->bc_rdonly = ro; pthread_mutex_init(&bc->bc_mtx, NULL); pthread_cond_init(&bc->bc_cond, NULL); TAILQ_INIT(&bc->bc_freeq); TAILQ_INIT(&bc->bc_pendq); TAILQ_INIT(&bc->bc_busyq); - bc->bc_req_count = 0; for (i = 0; i < BLOCKIF_MAXREQ; i++) { bc->bc_reqs[i].be_status = BST_FREE; TAILQ_INSERT_HEAD(&bc->bc_freeq, &bc->bc_reqs[i], be_link); } - pthread_create(&bc->bc_btid, NULL, blockif_thr, bc); - - snprintf(tname, sizeof(tname), "blk-%s", ident); - pthread_set_name_np(bc->bc_btid, tname); + for (i = 0; i < BLOCKIF_NUMTHR; i++) { + pthread_create(&bc->bc_btid[i], NULL, blockif_thr, bc); + snprintf(tname, sizeof(tname), "blk-%s-%d", ident, i); + pthread_set_name_np(bc->bc_btid[i], tname); + } return (bc); } @@ -331,13 +379,13 @@ blockif_request(struct blockif_ctxt *bc, err = 0; pthread_mutex_lock(&bc->bc_mtx); - if (bc->bc_req_count < BLOCKIF_MAXREQ) { + if (!TAILQ_EMPTY(&bc->bc_freeq)) { /* * Enqueue and inform the block i/o thread * that there is work available */ - blockif_enqueue(bc, breq, op); - pthread_cond_signal(&bc->bc_cond); + if (blockif_enqueue(bc, breq, op)) + pthread_cond_signal(&bc->bc_cond); } else { /* * Callers are not allowed to enqueue more than @@ -377,6 +425,14 @@ blockif_flush(struct blockif_ctxt *bc, s } int +blockif_delete(struct blockif_ctxt *bc, struct blockif_req *breq) +{ + + assert(bc->bc_magic == BLOCKIF_SIG); + return (blockif_request(bc, breq, BOP_DELETE)); +} + +int blockif_cancel(struct blockif_ctxt *bc, struct blockif_req *breq) { struct blockif_elem *be; @@ -395,11 +451,7 @@ blockif_cancel(struct blockif_ctxt *bc, /* * Found it. */ - TAILQ_REMOVE(&bc->bc_pendq, be, be_link); - be->be_status = BST_FREE; - be->be_req = NULL; - TAILQ_INSERT_TAIL(&bc->bc_freeq, be, be_link); - bc->bc_req_count--; + blockif_complete(bc, be); pthread_mutex_unlock(&bc->bc_mtx); return (0); @@ -460,7 +512,7 @@ int blockif_close(struct blockif_ctxt *bc) { void *jval; - int err; + int err, i; err = 0; @@ -469,9 +521,12 @@ blockif_close(struct blockif_ctxt *bc) /* * Stop the block i/o thread */ + pthread_mutex_lock(&bc->bc_mtx); bc->bc_closing = 1; - pthread_cond_signal(&bc->bc_cond); - pthread_join(bc->bc_btid, &jval); + pthread_mutex_unlock(&bc->bc_mtx); + pthread_cond_broadcast(&bc->bc_cond); + for (i = 0; i < BLOCKIF_NUMTHR; i++) + pthread_join(bc->bc_btid[i], &jval); /* XXX Cancel queued i/o's ??? */ @@ -552,6 +607,15 @@ blockif_sectsz(struct blockif_ctxt *bc) return (vdsk_sectorsize(bc)); } +void +blockif_psectsz(struct blockif_ctxt *bc, int *size, int *off) +{ + + assert(bc->bc_magic == BLOCKIF_SIG); + *size = vdsk_sectorsize(bc); + *off = 0; +} + int blockif_queuesz(struct blockif_ctxt *bc) { @@ -567,3 +631,11 @@ blockif_is_ro(struct blockif_ctxt *bc) assert(bc->bc_magic == BLOCKIF_SIG); return (bc->bc_rdonly); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@freebsd.org Fri Aug 21 05:03:04 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 722B19BDA36 for ; Fri, 21 Aug 2015 05:03:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63A7D1836; Fri, 21 Aug 2015 05:03:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7L5348H058304; Fri, 21 Aug 2015 05:03:04 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7L534c1058303; Fri, 21 Aug 2015 05:03:04 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201508210503.t7L534c1058303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 21 Aug 2015 05:03:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286980 - user/marcel/libvdsk X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 05:03:04 -0000 Author: marcel Date: Fri Aug 21 05:03:03 2015 New Revision: 286980 URL: https://svnweb.freebsd.org/changeset/base/286980 Log: Add a convenience wrapper around vmrun.sh Added: user/marcel/libvdsk/vmrun.sh (contents, props changed) Added: user/marcel/libvdsk/vmrun.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/marcel/libvdsk/vmrun.sh Fri Aug 21 05:03:03 2015 (r286980) @@ -0,0 +1,36 @@ +#!/bin/sh + +# Set our defaults +brif=bridge0 +memsz=1024M +ncpu=`sysctl -n hw.ncpu` +netif=`netstat -4rn | grep -e '^default ' | awk '{print $NF}'` +tapif=tap0 + +netif_exists() { + local netif=$1 + local iflist=`ifconfig -l` + for I in $iflist; do + if test $I == $netif; then + return 0 + fi + done + return 1 +} + +if ! kldstat -qm vmm; then + kldload vmm +fi + +if ! netif_exists $tapif; then + ifconfig $tapif create + sysctl net.link.tap.up_on_open=1 +fi + +if ! netif_exists $brif; then + ifconfig $brif create + ifconfig $brif addm $netif addm $tapif + ifconfig $brif up +fi + +exec sh /usr/share/examples/bhyve/vmrun.sh -c $ncpu -m $memsz -t $tapif "$@" From owner-svn-src-user@freebsd.org Fri Aug 21 10:40:32 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 647C29BC37F for ; Fri, 21 Aug 2015 10:40:32 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3C50C2A2; Fri, 21 Aug 2015 10:40:32 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LAeWrb002237; Fri, 21 Aug 2015 10:40:32 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7LAeWTU002236; Fri, 21 Aug 2015 10:40:32 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508211040.t7LAeWTU002236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Fri, 21 Aug 2015 10:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286987 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 10:40:32 -0000 Author: pho Date: Fri Aug 21 10:40:31 2015 New Revision: 286987 URL: https://svnweb.freebsd.org/changeset/base/286987 Log: Limit runtime. Minor cleanup. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/linger4.sh Modified: user/pho/stress2/misc/linger4.sh ============================================================================== --- user/pho/stress2/misc/linger4.sh Fri Aug 21 09:28:20 2015 (r286986) +++ user/pho/stress2/misc/linger4.sh Fri Aug 21 10:40:31 2015 (r286987) @@ -46,7 +46,7 @@ mdconfig -l | grep -q md$mdstart && mdc mdconfig -a -t swap -s 2g -u $mdstart bsdlabel -w md$mdstart auto [ $# -eq 1 ] && opt="$1" -[ $# -eq 0 ] && opt=$newfs_flags # No argument == default flag +[ $# -eq 0 ] && opt="$newfs_flags -n" # No argument == default flag echo "newfs $opt md${mdstart}$part" newfs $opt md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint @@ -67,20 +67,21 @@ rm -f /tmp/linger4 exit 0 EOF #include +#include +#include + #include #include #include -#include #include #include -#include -#include -#include +#include #include -#define PARALLEL 4 - +#define LOOPS 300 #define NUMBER 80000 / PARALLEL /* Number of files to use. Max is 131068 */ +#define PARALLEL 4 +#define TIMEOUT (20 * 60) void Creat(int loopno) @@ -124,14 +125,15 @@ Creat(int loopno) _exit(e); } - int main() { + time_t start; int e, i, j, status; e = 0; - for (j = 0; j < 300; j++) { + start = time(NULL); + for (j = 0; j < LOOPS; j++) { for (i = 0; i < PARALLEL; i++) { if (fork() == 0) Creat(j); @@ -144,6 +146,11 @@ main() if (e != 0) break; // sleep(60); /* No problems if this is included */ + if (time(NULL) - start > TIMEOUT) { + fprintf(stderr, "Timeout.\n"); + e++; + break; + } } return (e); From owner-svn-src-user@freebsd.org Fri Aug 21 10:41:23 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4CF99BC3CA for ; Fri, 21 Aug 2015 10:41:23 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B61E97D8; Fri, 21 Aug 2015 10:41:23 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LAfNJY004738; Fri, 21 Aug 2015 10:41:23 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7LAfNA1004737; Fri, 21 Aug 2015 10:41:23 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508211041.t7LAfNA1004737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Fri, 21 Aug 2015 10:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286988 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 10:41:23 -0000 Author: pho Date: Fri Aug 21 10:41:22 2015 New Revision: 286988 URL: https://svnweb.freebsd.org/changeset/base/286988 Log: Less verbose. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/suj5.sh Modified: user/pho/stress2/misc/suj5.sh ============================================================================== --- user/pho/stress2/misc/suj5.sh Fri Aug 21 10:40:31 2015 (r286987) +++ user/pho/stress2/misc/suj5.sh Fri Aug 21 10:41:22 2015 (r286988) @@ -49,7 +49,7 @@ newfs -j md${mdstart}$part > /dev/null mount /dev/md${mdstart}$part $mntpoint chmod 777 $mntpoint -su $testuser -c "cd $mntpoint; /tmp/suj5" +su $testuser -c "cd $mntpoint; /tmp/suj5" > /dev/null while mount | grep $mntpoint | grep -q /dev/md; do umount $mntpoint || sleep 1 From owner-svn-src-user@freebsd.org Fri Aug 21 10:42:50 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB3F69BC44E for ; Fri, 21 Aug 2015 10:42:50 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0B10969; Fri, 21 Aug 2015 10:42:50 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LAgonu004836; Fri, 21 Aug 2015 10:42:50 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7LAgoDi004835; Fri, 21 Aug 2015 10:42:50 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508211042.t7LAgoDi004835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Fri, 21 Aug 2015 10:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286989 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 10:42:50 -0000 Author: pho Date: Fri Aug 21 10:42:49 2015 New Revision: 286989 URL: https://svnweb.freebsd.org/changeset/base/286989 Log: Added a "vm.overcommit" test scenario. Sponsored by: EMC / Isilon storage division Added: user/pho/stress2/misc/overcommit2.sh (contents, props changed) Added: user/pho/stress2/misc/overcommit2.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/overcommit2.sh Fri Aug 21 10:42:49 2015 (r286989) @@ -0,0 +1,69 @@ +#!/bin/sh + +# +# Copyright (c) 2014 EMC Corp. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +# Test vm.overcommit. Variation of overcommit.sh +# Use a swap backed MD disk with the size of 1.2 * hw.usermem. +# Deadlock seen: https://people.freebsd.org/~pho/stress/log/alan007.txt + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +[ `swapinfo | wc -l` -eq 1 ] && exit 0 + +. ../default.cfg + +old=`sysctl -n vm.overcommit` +[ $old -eq 1 ] && exit + +size=$((`sysctl -n hw.usermem` / 1024 / 1024)) # in MB +size=$((size + size / 100 * 20)) # 120% of hw.usermem +sysctl vm.overcommit=1 + +mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint +mdconfig -l | grep -q md$mdstart && mdconfig -d -u $mdstart +mdconfig -a -t swap -s ${size}m -u $mdstart +bsdlabel -w md$mdstart auto +newfs $newfs_flags md${mdstart}$part > /dev/null +mount /dev/md${mdstart}$part $mntpoint + +echo "Expect: +/mnt: write failed, filesystem is full +dd: /mnt/big.1: No space left on device" + +for i in `jot 10`; do + dd if=/dev/zero of=/mnt/big.$i bs=1m 2>&1 | \ + egrep -v "records|transferred" & +done +wait + +while mount | grep "on $mntpoint " | grep -q /dev/md; do + umount $mntpoint || sleep 1 +done +mdconfig -d -u $mdstart + +sysctl vm.overcommit=$old From owner-svn-src-user@freebsd.org Fri Aug 21 10:49:13 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D73F9BC5D6 for ; Fri, 21 Aug 2015 10:49:13 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F139BF0; Fri, 21 Aug 2015 10:49:13 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LAnDjH005135; Fri, 21 Aug 2015 10:49:13 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7LAnDBM005134; Fri, 21 Aug 2015 10:49:13 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201508211049.t7LAnDBM005134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Fri, 21 Aug 2015 10:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286990 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 10:49:13 -0000 Author: pho Date: Fri Aug 21 10:49:12 2015 New Revision: 286990 URL: https://svnweb.freebsd.org/changeset/base/286990 Log: Discard newfs(8) output. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/umount.sh Modified: user/pho/stress2/misc/umount.sh ============================================================================== --- user/pho/stress2/misc/umount.sh Fri Aug 21 10:42:49 2015 (r286989) +++ user/pho/stress2/misc/umount.sh Fri Aug 21 10:49:12 2015 (r286990) @@ -42,7 +42,7 @@ mdconfig -l | grep md${mdstart} > /dev/n mdconfig -a -t vnode -f $D -u ${mdstart} bsdlabel -w md${mdstart} auto -newfs md${mdstart}${part} +newfs md${mdstart}${part} > /dev/null mount /dev/md${mdstart}${part} $mntpoint export RUNDIR=$mntpoint/stressX export runRUNTIME=3m # Run tests for three minutes From owner-svn-src-user@freebsd.org Fri Aug 21 15:20:04 2015 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 869C69BF59E for ; Fri, 21 Aug 2015 15:20:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76AC8143; Fri, 21 Aug 2015 15:20:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7LFK4wI029066; Fri, 21 Aug 2015 15:20:04 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7LFK13C029055; Fri, 21 Aug 2015 15:20:01 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201508211520.t7LFK13C029055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 21 Aug 2015 15:20:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r286996 - in user/marcel/libvdsk: bhyve bhyveload libvdsk X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2015 15:20:04 -0000 Author: marcel Date: Fri Aug 21 15:20:01 2015 New Revision: 286996 URL: https://svnweb.freebsd.org/changeset/base/286996 Log: o Add vdsk_trim() to support BOP_DELETE. o Reorder arguments to vdsk_read() and vdsk_write() so that the offset is second, like for vdsk_trim(). Modified: user/marcel/libvdsk/bhyve/block_if.c user/marcel/libvdsk/bhyveload/bhyveload.c user/marcel/libvdsk/libvdsk/qcow.c user/marcel/libvdsk/libvdsk/raw.c user/marcel/libvdsk/libvdsk/vdsk.c user/marcel/libvdsk/libvdsk/vdsk.h user/marcel/libvdsk/libvdsk/vdsk_int.h user/marcel/libvdsk/libvdsk/vhd.c user/marcel/libvdsk/libvdsk/vmdk.c Modified: user/marcel/libvdsk/bhyve/block_if.c ============================================================================== --- user/marcel/libvdsk/bhyve/block_if.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/bhyve/block_if.c Fri Aug 21 15:20:01 2015 (r286996) @@ -202,21 +202,16 @@ blockif_proc(struct blockif_ctxt *bc, st err = 0; switch (be->be_op) { case BOP_READ: - err = vdsk_read(bc, br->br_iov, br->br_iovcnt, br->br_offset); + err = vdsk_read(bc, br->br_offset, br->br_iov, br->br_iovcnt); break; case BOP_WRITE: - err = vdsk_write(bc, br->br_iov, br->br_iovcnt, br->br_offset); + err = vdsk_write(bc, br->br_offset, br->br_iov, br->br_iovcnt); break; case BOP_FLUSH: err = vdsk_flush(bc); break; case BOP_DELETE: - if (!bc->bc_candelete) - err = EOPNOTSUPP; - else if (bc->bc_rdonly) - err = EROFS; - else - err = EOPNOTSUPP; + err = vdsk_trim(bc, br->br_offset, br->br_resid); break; default: err = EINVAL; Modified: user/marcel/libvdsk/bhyveload/bhyveload.c ============================================================================== --- user/marcel/libvdsk/bhyveload/bhyveload.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/bhyveload/bhyveload.c Fri Aug 21 15:20:01 2015 (r286996) @@ -296,7 +296,7 @@ cb_diskread(void *arg, int unit, uint64_ iov.iov_base = to; iov.iov_len = size; - error = vdsk_read(disk[unit], &iov, 1, from); + error = vdsk_read(disk[unit], from, &iov, 1); if (!error) *resid = 0; Modified: user/marcel/libvdsk/libvdsk/qcow.c ============================================================================== --- user/marcel/libvdsk/libvdsk/qcow.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/qcow.c Fri Aug 21 15:20:01 2015 (r286996) @@ -117,16 +117,24 @@ qcow_close(struct vdsk *vdsk __unused) } static int -qcow_read(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +qcow_read(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) { return (ENOSYS); } static int -qcow_write(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +qcow_write(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) +{ + + return (ENOSYS); +} + +static int +qcow_trim(struct vdsk *vdsk __unused, off_t offset __unused, + ssize_t length __unused) { return (ENOSYS); @@ -148,6 +156,7 @@ static struct vdsk_format qcow_format = .close = qcow_close, .read = qcow_read, .write = qcow_write, + .trim = qcow_trim, .flush = qcow_flush, }; FORMAT_DEFINE(qcow_format); Modified: user/marcel/libvdsk/libvdsk/raw.c ============================================================================== --- user/marcel/libvdsk/libvdsk/raw.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/raw.c Fri Aug 21 15:20:01 2015 (r286996) @@ -62,7 +62,7 @@ raw_close(struct vdsk *vdsk __unused) } static int -raw_read(struct vdsk *vdsk, const struct iovec *iov, int iovcnt, off_t offset) +raw_read(struct vdsk *vdsk, off_t offset, const struct iovec *iov, int iovcnt) { ssize_t res; @@ -71,7 +71,7 @@ raw_read(struct vdsk *vdsk, const struct } static int -raw_write(struct vdsk *vdsk, const struct iovec *iov, int iovcnt, off_t offset) +raw_write(struct vdsk *vdsk, off_t offset, const struct iovec *iov, int iovcnt) { ssize_t res; @@ -80,6 +80,14 @@ raw_write(struct vdsk *vdsk, const struc } static int +raw_trim(struct vdsk *vdsk __unused, off_t offset __unused, + ssize_t length __unused) +{ + + return (EOPNOTSUPP); +} + +static int raw_flush(struct vdsk *vdsk) { int res; @@ -97,6 +105,7 @@ static struct vdsk_format raw_format = { .close = raw_close, .read = raw_read, .write = raw_write, + .trim = raw_trim, .flush = raw_flush, }; FORMAT_DEFINE(raw_format); Modified: user/marcel/libvdsk/libvdsk/vdsk.c ============================================================================== --- user/marcel/libvdsk/libvdsk/vdsk.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/vdsk.c Fri Aug 21 15:20:01 2015 (r286996) @@ -209,21 +209,31 @@ vdsk_sectorsize(vdskctx ctx) } int -vdsk_read(vdskctx ctx, const struct iovec *iov, int iovcnt, off_t offset) +vdsk_read(vdskctx ctx, off_t offset, const struct iovec *iov, int iovcnt) { struct vdsk *vdsk = vdsk_deref(ctx); - return (vdsk->fmt->read(vdsk, iov, iovcnt, offset)); + return (vdsk->fmt->read(vdsk, offset, iov, iovcnt)); } int -vdsk_write(vdskctx ctx, const struct iovec *iov, int iovcnt, off_t offset) +vdsk_write(vdskctx ctx, off_t offset, const struct iovec *iov, int iovcnt) { struct vdsk *vdsk = vdsk_deref(ctx); if ((vdsk->fflags & FWRITE) == 0) return (EROFS); - return (vdsk->fmt->write(vdsk, iov, iovcnt, offset)); + return (vdsk->fmt->write(vdsk, offset, iov, iovcnt)); +} + +int +vdsk_trim(vdskctx ctx, off_t offset, ssize_t length) +{ + struct vdsk *vdsk = vdsk_deref(ctx); + + if ((vdsk->fflags & FWRITE) == 0) + return (EROFS); + return (vdsk->fmt->trim(vdsk, offset, length)); } int Modified: user/marcel/libvdsk/libvdsk/vdsk.h ============================================================================== --- user/marcel/libvdsk/libvdsk/vdsk.h Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/vdsk.h Fri Aug 21 15:20:01 2015 (r286996) @@ -41,9 +41,9 @@ int vdsk_close(vdskctx); off_t vdsk_capacity(vdskctx); int vdsk_sectorsize(vdskctx); -int vdsk_read(vdskctx, const struct iovec *, int, off_t); -int vdsk_write(vdskctx, const struct iovec *, int, off_t); - +int vdsk_read(vdskctx, off_t, const struct iovec *, int); +int vdsk_write(vdskctx, off_t, const struct iovec *, int); +int vdsk_trim(vdskctx, off_t, ssize_t); int vdsk_flush(vdskctx); #endif /* __VDSK_H__ */ Modified: user/marcel/libvdsk/libvdsk/vdsk_int.h ============================================================================== --- user/marcel/libvdsk/libvdsk/vdsk_int.h Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/vdsk_int.h Fri Aug 21 15:20:01 2015 (r286996) @@ -48,8 +48,9 @@ struct vdsk_format { int (*probe)(struct vdsk *); int (*open)(struct vdsk *); int (*close)(struct vdsk *); - int (*read)(struct vdsk *, const struct iovec *, int, off_t); - int (*write)(struct vdsk *, const struct iovec *, int, off_t); + int (*read)(struct vdsk *, off_t, const struct iovec *, int); + int (*write)(struct vdsk *, off_t, const struct iovec *, int); + int (*trim)(struct vdsk *, off_t, ssize_t); int (*flush)(struct vdsk *); }; Modified: user/marcel/libvdsk/libvdsk/vhd.c ============================================================================== --- user/marcel/libvdsk/libvdsk/vhd.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/vhd.c Fri Aug 21 15:20:01 2015 (r286996) @@ -63,16 +63,24 @@ vhd_close(struct vdsk *vdsk __unused) } static int -vhd_read(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +vhd_read(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) { return (ENOSYS); } static int -vhd_write(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +vhd_write(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) +{ + + return (ENOSYS); +} + +static int +vhd_trim(struct vdsk *vdsk __unused, off_t offset __unused, + ssize_t length __unused) { return (ENOSYS); @@ -94,6 +102,7 @@ static struct vdsk_format vhd_format = { .close = vhd_close, .read = vhd_read, .write = vhd_write, + .trim = vhd_trim, .flush = vhd_flush, }; FORMAT_DEFINE(vhd_format); Modified: user/marcel/libvdsk/libvdsk/vmdk.c ============================================================================== --- user/marcel/libvdsk/libvdsk/vmdk.c Fri Aug 21 15:15:22 2015 (r286995) +++ user/marcel/libvdsk/libvdsk/vmdk.c Fri Aug 21 15:20:01 2015 (r286996) @@ -63,16 +63,24 @@ vmdk_close(struct vdsk *vdsk __unused) } static int -vmdk_read(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +vmdk_read(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) { return (ENOSYS); } static int -vmdk_write(struct vdsk *vdsk __unused, const struct iovec *iov __unused, - int iovcnt __unused, off_t offset __unused) +vmdk_write(struct vdsk *vdsk __unused, off_t offset __unused, + const struct iovec *iov __unused, int iovcnt __unused) +{ + + return (ENOSYS); +} + +static int +vmdk_trim(struct vdsk *vdsk __unused, off_t offset __unused, + ssize_t length __unused) { return (ENOSYS); @@ -94,6 +102,7 @@ static struct vdsk_format vmdk_format = .close = vmdk_close, .read = vmdk_read, .write = vmdk_write, + .trim = vmdk_trim, .flush = vmdk_flush, }; FORMAT_DEFINE(vmdk_format);