From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: KVM performance Date: Tue, 30 Jan 2007 09:11:50 -0600 Message-ID: <45BF6036.8060704@cs.utexas.edu> References: <1169857267.30807.44.camel@localhost.localdomain> <45BB0E85.9060303@qumranet.com> <1169902138.32208.25.camel@localhost.localdomain> <45BC6F98.908@qumranet.com> <1170161536.17669.10.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010004050500070604030405" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, tim.c.chen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org To: Rusty Russell Return-path: In-Reply-To: <1170161536.17669.10.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------010004050500070604030405 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Rusty Russell wrote: > On Sun, 2007-01-28 at 11:40 +0200, Avi Kivity wrote: > >> Rusty Russell wrote: >> I use virtbench (http://ozlabs.org/~rusty/virtbench) to try >> >>> to measure optimization results; it still needs more tests (and an >>> explicit kvm backend). >>> >> A kvm backend would be appreciated. >> > > Yes, and patches are most welcome 8) Actually, I'll work on this week. Attached patch was my initial attempt. I wanted it to work with mostly unmodified guest images so the only requirement is that a getty is spawned on ttyS0. I ran in to quite a few problems with virtbench though once I started launching multiple guests and haven't gotten around to debugging those yet. Regards, Anthony Liguori > > >>>> - after modifying a pte, kvm doesn't preload the modified pte into >>>> shadow, but instead lets the guest fault it in >>>> >>> lguest doesn't either, but don't you still want the fault to update the >>> host accessed bit? >>> >> The story here is that the guest is handling a pagefault and writing the >> new guest pte. kvm traps the write (guest pagetables are write >> protected), and has the option of updating the shadow pte to reflect the >> guest pte. >> >> The clever guest kernel will set the accessed bit (and the dirty bit on >> writable ptes) to avoid an rmw cycle by the hardware pagetable walker. >> >> [two instrumented runs later] >> >> Both Linux and Windows seem to do this optimization. >> > > Right. This (trivial!) optimization wins lguest a good 10%: > > Before: > Time for one Copy-on-Write fault: 13622 nsec > Time to exec client once: 1085481 nsec > Time for one fork/exit/wait: 700796 nsec > After: > Time for one Copy-on-Write fault: 12036 nsec > Time to exec client once: 969899 nsec > Time for one fork/exit/wait: 664601 nsec > > Thanks! > Rusty. > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > kvm-devel mailing list > kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > https://lists.sourceforge.net/lists/listinfo/kvm-devel > --------------010004050500070604030405 Content-Type: text/x-patch; name="virtbench-kvm.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="virtbench-kvm.diff" diff -r 03813abef33e kvm/SETTINGS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kvm/SETTINGS Mon Jan 15 15:50:09 2007 -0600 @@ -0,0 +1,3 @@ +# Sources from all scripts +ROOT_FILE="/mnt/FC-5-i386.img" +QEMU=qemu diff -r 03813abef33e kvm/serial.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kvm/serial.py Mon Jan 15 16:00:13 2007 -0600 @@ -0,0 +1,58 @@ +import sys, socket, binascii, commands + +if len(sys.argv) != 9: + print 'Usage: serial IP PORT LOGIN PASSWORD PATH ID IP PORT' + sys.exit(1) + +sys.stderr.write('foo\n') + +login='login: ' +password='Password: ' +prompt=']# ' + +s = socket.socket(socket.AF_INET) +s.connect((sys.argv[1], int(sys.argv[2]))) + +def wait_for(string): + buf = '' + while True: + f = s.recv(4096) + buf += f + if buf.endswith(string): + break + +s.sendall('\n') +wait_for(login) +s.sendall('%s\n' % sys.argv[3]) + +wait_for(password) +s.sendall('%s\n' % sys.argv[4]) + +wait_for(prompt) +status, output = commands.getstatusoutput('uuencode %s /tmp/virtclient' % + sys.argv[5]) + +f = open(sys.argv[5]) +d = binascii.b2a_base64(f.read()) +f.close() + +s.sendall("stty -echo\n") +wait_for(prompt) + +s.sendall("cat > /tmp/virtclient.b64 </dev/null ; then +# modules="kvm kvm-amd" +#else +# modules="kvm kvm-intel" +#fi + +#[ -c /dev/kvm ] || modprobe $modules diff -r 03813abef33e kvm/start_machine --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kvm/start_machine Sat Jan 27 11:09:40 2007 -0600 @@ -0,0 +1,10 @@ +#! /bin/sh + +. kvm/SETTINGS + +serial_port=$((1025 + $1)) + +$QEMU -m 128 -hda "${ROOT_FILE}" -snapshot -serial tcp:localhost:${serial_port},server,nowait -kernel-kqemu & +sleep 2 +python kvm/serial.py 127.0.0.1 ${serial_port} root ibm4xen virtclient $1 $2 $3 & +jobs -p %1 diff -r 03813abef33e kvm/stop --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kvm/stop Mon Jan 15 11:32:55 2007 -0600 @@ -0,0 +1,4 @@ +#! /bin/sh + +. kvm/SETTINGS +exit 0 diff -r 03813abef33e kvm/stop_machine --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kvm/stop_machine Mon Jan 15 11:43:29 2007 -0600 @@ -0,0 +1,5 @@ +#! /bin/sh + +. kvm/SETTINGS + +kill $1 diff -r 03813abef33e server.c --- a/server.c Thu Jan 11 13:56:30 2007 +1100 +++ b/server.c Mon Jan 15 16:02:11 2007 -0600 @@ -227,7 +227,7 @@ static struct sockaddr_in get_server_add socklen_t socklen = sizeof(saddr); /* This assumes we have an eth0. */ - strcpy(ifr.ifr_name, "eth0"); + strcpy(ifr.ifr_name, "ath0"); sin->sin_family = AF_INET; if (ioctl(sock, SIOCGIFADDR, &ifr) != 0) err(1, "Getting interface address for eth0"); --------------010004050500070604030405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --------------010004050500070604030405 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------010004050500070604030405--