All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Doktor" <ldoktor@redhat.com>
To: KVM list <kvm@vger.kernel.org>, Jason Wang <jasowang@redhat.com>,
	Lucas Meneghel Rodrigues <lmr@redhat.com>,
	Michael Goldish <mgoldish@redhat.com>
Subject: [KVM_AUTOTEST] add kvm hugepage variant
Date: Fri, 10 Jul 2009 12:01:51 +0200	[thread overview]
Message-ID: <4A57118F.3030907@redhat.com> (raw)
In-Reply-To: <4A55B759.5080302@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]

After discussion I split the patches.

This patch adds kvm_hugepage variant. It prepares the host system and
start vm with -mem-path option. It does not clean after itself, because 
  it's impossible to unmount and free hugepages before all guests are 
destroyed.

I need to ask you what to do with change of qemu parameter. Newest 
versions are using -mempath insted of -mem-path. This is impossible to 
fix using current config file. I can see 2 solutions:
1) direct change in kvm_vm.py (parse output and try another param)
2) detect qemu capabilities outside and create additional layer (better 
for future occurrence)

Dne 9.7.2009 11:24, Lukáš Doktor napsal(a):
> This patch adds kvm_hugepage variant. It prepares the host system and
> start vm with -mem-path option. It does not clean after itself, because
> it's impossible to unmount and free hugepages before all guests are
> destroyed.
>
> There is also added autotest.libhugetlbfs test.
>
> I need to ask you what to do with change of qemu parameter. Newest
> versions are using -mempath insted of -mem-path. This is impossible to
> fix using current config file. I can see 2 solutions:
> 1) direct change in kvm_vm.py (parse output and try another param)
> 2) detect qemu capabilities outside and create additional layer (better
> for future occurrence)
>
> Tested by:ldoktor@redhat.com on RHEL5.4 with kvm-83-72.el5


[-- Attachment #2: kvm_hugepage.patch --]
[-- Type: text/plain, Size: 2787 bytes --]

diff -Narup orig/client/tests/kvm/kvm_tests.cfg.sample new/client/tests/kvm/kvm_tests.cfg.sample
--- orig/client/tests/kvm/kvm_tests.cfg.sample	2009-07-08 13:18:07.000000000 +0200
+++ new/client/tests/kvm/kvm_tests.cfg.sample	2009-07-09 10:15:58.000000000 +0200
@@ -546,6 +549,12 @@ variants:
         only default
         image_format = raw
 
+variants:
+    - @kvm_smallpages:
+    - kvm_hugepages:
+        pre_command = "/bin/bash scripts/hugepage.sh /mnt/hugepage"
+        extra_params += " -mem-path /mnt/hugepage"
+
 
 variants:
     - @basic:
@@ -559,6 +568,7 @@ variants:
         only Fedora.8.32
         only install setup boot shutdown
         only rtl8139
+        only kvm_smallpages
     - @sample1:
         only qcow2
         only ide
diff -Narup orig/client/tests/kvm/kvm_vm.py new/client/tests/kvm/kvm_vm.py
--- orig/client/tests/kvm/kvm_vm.py	2009-07-08 13:18:07.000000000 +0200
+++ new/client/tests/kvm/kvm_vm.py	2009-07-09 10:05:19.000000000 +0200
@@ -400,6 +400,13 @@ class VM:
                 self.destroy()
                 return False
 
+            if output:
+                logging.debug("qemu produced some output:\n%s", output)
+                if "alloc_mem_area" in output:
+                    logging.error("Could not allocate hugepage memory"
+                                 " -- qemu command:\n%s", qemu_command)
+                    return False
+
             logging.debug("VM appears to be alive with PID %d", self.pid)
             return True

diff -Narup orig/client/tests/kvm/scripts/hugepage.sh new/client/tests/kvm/scripts/hugepage.sh
--- orig/client/tests/kvm/scripts/hugepage.sh	1970-01-01 01:00:00.000000000 +0100
+++ new/client/tests/kvm/scripts/hugepage.sh	2009-07-09 09:47:14.000000000 +0200
@@ -0,0 +1,34 @@
+#!/bin/bash
+# Alocates enough hugepages and mount hugetlbfs to $1.
+if [ $# -ne 1 ]; then
+	echo "USAGE: $0 mem_path"
+	exit 1
+fi
+
+Hugepagesize=$(grep Hugepagesize /proc/meminfo | cut -d':'  -f 2 | \
+		 xargs | cut -d' ' -f1)
+VMS=$(expr $(echo $KVM_TEST_vms | grep -c ' ') + 1)
+if [ "$KVM_TEST_max_vms" ] && [ "$VMS" -lt "$KVM_TEST_max_vms" ]; then
+        VMS="$KVM_TEST_max_vms"
+fi
+VMSM=$(expr $(expr $VMS \* $KVM_TEST_mem) + $(expr $VMS \* 64 ))
+TARGET=$(expr $VMSM \* 1024 \/ $Hugepagesize)
+
+NR=$(cat /proc/sys/vm/nr_hugepages)
+while [ "$NR" -ne "$TARGET" ]; do
+	NR_="$NR";echo $TARGET > /proc/sys/vm/nr_hugepages
+	sleep 5s
+	NR=$(cat /proc/sys/vm/nr_hugepages)
+	if [ "$NR" -eq "$NR_" ] ; then
+		echo "Can not alocate $TARGET of hugepages"
+		exit 2
+	fi
+done
+
+if [ ! "$(mount | grep /mnt/hugepage |grep hugetlbfs)" ]; then
+	mkdir -p $1
+	mount -t hugetlbfs none $1 || \
+		(echo "Can not mount hugetlbfs filesystem to $1"; exit 3)
+else
+	echo "hugetlbfs filesystem already mounted"
+fi

  parent reply	other threads:[~2009-07-10 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09  9:24 [KVM_AUTOTEST] add kvm hugepage variant and test Lukáš Doktor
2009-07-09 12:30 ` Michael Goldish
2009-07-09 12:55   ` Lukáš Doktor
2009-07-10  4:38 ` sudhir kumar
2009-07-10  6:48   ` Lukáš Doktor
2009-07-10  8:03 ` Lukáš Doktor
2009-07-10 10:01 ` Lukáš Doktor [this message]
2009-07-20 12:58   ` [KVM_AUTOTEST] add kvm hugepage variant Lucas Meneghel Rodrigues
2009-07-21 16:04     ` Lukáš Doktor
2009-07-22  5:57       ` [Autotest] " sudhir kumar
2009-07-27 21:05       ` Lucas Meneghel Rodrigues
2009-07-10 10:04 ` [KVM_AUTOTEST] add autotest.libhugetlbfs test Lukáš Doktor
2009-07-10 10:37   ` sudhir kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A57118F.3030907@redhat.com \
    --to=ldoktor@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lmr@redhat.com \
    --cc=mgoldish@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.