From owner-svn-src-user@FreeBSD.ORG Sun Jan 25 15:09:54 2015 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 572B1EAC; Sun, 25 Jan 2015 15:09:54 +0000 (UTC) Received: from svn.freebsd.org (svn.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 38240E96; Sun, 25 Jan 2015 15:09:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t0PF9sFH016901; Sun, 25 Jan 2015 15:09:54 GMT (envelope-from pho@FreeBSD.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t0PF9r3h016897; Sun, 25 Jan 2015 15:09:53 GMT (envelope-from pho@FreeBSD.org) Message-Id: <201501251509.t0PF9r3h016897@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pho set sender to pho@FreeBSD.org using -f From: Peter Holm Date: Sun, 25 Jan 2015 15:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r277705 - 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.18-1 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: Sun, 25 Jan 2015 15:09:54 -0000 Author: pho Date: Sun Jan 25 15:09:52 2015 New Revision: 277705 URL: https://svnweb.freebsd.org/changeset/base/277705 Log: Added default.cfg, make test program name conform to script name and whitespace cleanup. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/datamove.sh user/pho/stress2/misc/datamove2.sh user/pho/stress2/misc/datamove3.sh user/pho/stress2/misc/datamove4.sh Modified: user/pho/stress2/misc/datamove.sh ============================================================================== --- user/pho/stress2/misc/datamove.sh Sun Jan 25 15:02:28 2015 (r277704) +++ user/pho/stress2/misc/datamove.sh Sun Jan 25 15:09:52 2015 (r277705) @@ -28,40 +28,42 @@ # $FreeBSD$ # -# There is a well-known problem in FreeBSD, caused by allowing page faults -# while doing filesystem data move to or from userspace during read(2) and -# write(2). The issue is that if the userspace address being read or write -# from/to is backed by the mapping of the same file we are doing i/o to, +# There is a well-known problem in FreeBSD, caused by allowing page faults +# while doing filesystem data move to or from userspace during read(2) and +# write(2). The issue is that if the userspace address being read or write +# from/to is backed by the mapping of the same file we are doing i/o to, # we deadlock. # Test scenario by ups [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + here=`pwd` cd /tmp -sed '1,/^EOF/d' < $here/$0 > dl.c -cc -o dl -Wall dl.c -rm -f dl.c +sed '1,/^EOF/d' < $here/$0 > datamove.c +cc -o datamove -Wall datamove.c +rm -f datamove.c n=5 old=`sysctl vm.old_msync | awk '{print $NF}'` sysctl vm.old_msync=1 for i in `jot $n`; do - mkdir -p /tmp/dl.dir.$i - cd /tmp/dl.dir.$i - /tmp/dl & + mkdir -p /tmp/datamove.dir.$i + cd /tmp/datamove.dir.$i + /tmp/datamove & done cd /tmp for i in `jot $n`; do wait done for i in `jot $n`; do - rm -rf /tmp/dl.dir.$i + rm -rf /tmp/datamove.dir.$i done sysctl vm.old_msync=$old -rm -rf /tmp/dl +rm -rf /tmp/datamove exit 0 EOF /*- @@ -123,7 +125,7 @@ int prepareFile(char* filename,int* fdp) perror("Creating file"); return fd; } - + len = write(fd,wbuffer,FILESIZE); if (len < 0) { @@ -171,11 +173,11 @@ int mapBuffer(char** bufferp,int fd1,int perror("Mmap failed"); return 1; } - + buffer = addr; - addr = mmap(buffer + pagesize,pagesize, PROT_READ | PROT_WRITE , MAP_FIXED | -MAP_SHARED, fd2, 0); - + addr = mmap(buffer + pagesize,pagesize, PROT_READ | PROT_WRITE , MAP_FIXED | + MAP_SHARED, fd2, 0); + if (addr == MAP_FAILED) { perror("Mmap2 failed"); @@ -190,7 +192,7 @@ int startIO(int fd,char *buffer) { ssize_t len; len = write(fd,buffer,2*pagesize); - if (len == -1) + if (len == -1) { perror("write failed"); return 1; @@ -216,7 +218,7 @@ int main(int argc,char *argv[],char *env || (mapBuffer(&bufferA,fdDelayA,fdB)) || (mapBuffer(&bufferB,fdDelayB,fdA))) exit(1); - + pid = fork(); if (pid == 0) @@ -233,8 +235,3 @@ int main(int argc,char *argv[],char *env exit(status); } - - - - - Modified: user/pho/stress2/misc/datamove2.sh ============================================================================== --- user/pho/stress2/misc/datamove2.sh Sun Jan 25 15:02:28 2015 (r277704) +++ user/pho/stress2/misc/datamove2.sh Sun Jan 25 15:09:52 2015 (r277705) @@ -34,18 +34,20 @@ # Test scenario by ups +. ../default.cfg + here=`pwd` cd /tmp -sed '1,/^EOF/d' < $here/$0 > dl.c -cc -o dl -Wall dl.c -rm -f dl.c +sed '1,/^EOF/d' < $here/$0 > datamove2.c +cc -o datamove2 -Wall datamove2.c +rm -f datamove2.c for i in `jot 2`; do $here/../testcases/swap/swap -t 10m -i 200 -h & - /tmp/dl + /tmp/datamove2 ps | grep swap | grep -v swap | awk '{print $1}' | xargs kill done -rm -rf /tmp/dl +rm -rf /tmp/datamove2 exit 0 EOF /*- @@ -95,7 +97,7 @@ int pagesize; char wbuffer [FILESIZE]; /* Create a FILESIZE sized file - then remove file data from the cache */ -int +int prepareFile(char *filename, int *fdp) { int fd; @@ -139,7 +141,7 @@ prepareFile(char *filename, int *fdp) /* mmap a 2 page buffer - first page is from fd1, second page from fd2 */ -int +int mapBuffer(char **bufferp, int fd1, int fd2) { void *addr; @@ -171,7 +173,7 @@ unmapBuffer(char *bufferp) err(1, "unmap 2. buffer"); } -int +int startIO(int fd, char *buffer) { ssize_t len; @@ -185,7 +187,7 @@ startIO(int fd, char *buffer) } -int +int main(int argc, char *argv[], char *envp[]) { Modified: user/pho/stress2/misc/datamove3.sh ============================================================================== --- user/pho/stress2/misc/datamove3.sh Sun Jan 25 15:02:28 2015 (r277704) +++ user/pho/stress2/misc/datamove3.sh Sun Jan 25 15:09:52 2015 (r277705) @@ -34,30 +34,32 @@ [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 +. ../default.cfg + here=`pwd` cd /tmp -sed '1,/^EOF/d' < $here/$0 > dl.c -cc -o dl -Wall dl.c -lpthread -rm -f dl.c +sed '1,/^EOF/d' < $here/$0 > datamove3.c +cc -o datamove3 -Wall datamove3.c -lpthread +rm -f datamove3.c n=5 old=`sysctl vm.old_msync | awk '{print $NF}'` sysctl vm.old_msync=1 for i in `jot $n`; do - mkdir -p /tmp/dl.dir.$i - cd /tmp/dl.dir.$i - /tmp/dl & + mkdir -p /tmp/datamove3.dir.$i + cd /tmp/datamove3.dir.$i + /tmp/datamove3 & done cd /tmp for i in `jot $n`; do wait done for i in `jot $n`; do - rm -rf /tmp/dl.dir.$i + rm -rf /tmp/datamove3.dir.$i done sysctl vm.old_msync=$old -rm -rf /tmp/dl +rm -rf /tmp/datamove3 exit 0 EOF /*- @@ -114,7 +116,7 @@ int pagesize; char wbuffer [FILESIZE]; /* Create a FILESIZE sized file - then remove file data from the cache */ -int +int prepareFile(char *filename, int *fdp) { int fd; @@ -180,7 +182,7 @@ mapBuffer(void *ar) } -int +int startIO(int fd, char *buffer) { ssize_t len; @@ -195,7 +197,7 @@ startIO(int fd, char *buffer) -int +int main(int argc, char *argv[], char *envp[]) { Modified: user/pho/stress2/misc/datamove4.sh ============================================================================== --- user/pho/stress2/misc/datamove4.sh Sun Jan 25 15:02:28 2015 (r277704) +++ user/pho/stress2/misc/datamove4.sh Sun Jan 25 15:09:52 2015 (r277705) @@ -37,22 +37,22 @@ here=`pwd` cd /tmp -sed '1,/^EOF/d' < $here/$0 > dl.c -cc -o dl -Wall -Wextra -O2 -g dl.c -rm -f dl.c +sed '1,/^EOF/d' < $here/$0 > datamove4.c +cc -o datamove4 -Wall -Wextra -O2 -g datamove4.c +rm -f datamove4.c mount | grep -q "$mntpoint " && umount $mntpoint mount -t tmpfs tmpfs $mntpoint chmod 777 $mntpoint for i in `jot 5`; do - su $testuser -c "cd $mntpoint; /tmp/dl" + su $testuser -c "cd $mntpoint; /tmp/datamove4" done while mount | grep -q $mntpoint; do umount -f $mntpoint > /dev/null 2>&1 done -rm -rf /tmp/dl +rm -rf /tmp/datamove4 exit 0 EOF /*- @@ -102,7 +102,7 @@ int pagesize; char wbuffer [FILESIZE]; /* Create a FILESIZE sized file - then remove file data from the cache */ -int +int prepareFile(char *filename, int *fdp) { int fd; @@ -146,7 +146,7 @@ prepareFile(char *filename, int *fdp) /* mmap a 2 page buffer - first page is from fd1, second page from fd2 */ -int +int mapBuffer(char **bufferp, int fd1, int fd2) { void *addr; @@ -178,7 +178,7 @@ unmapBuffer(char *bufferp) err(1, "unmap 2. buffer"); } -int +int startIO(int fd, char *buffer) { ssize_t len; @@ -192,7 +192,7 @@ startIO(int fd, char *buffer) } -int +int main() {