rpms/qemu/devel qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch, NONE, 1.1 ksm.init, 1.4, 1.5 ksmtuned, 1.2, 1.3 ksmtuned.conf, 1.1, 1.2 qemu.spec, 1.155, 1.156

Justin M. Forbes jforbes at fedoraproject.org
Thu Feb 4 15:58:29 UTC 2010


Author: jforbes

Update of /cvs/pkgs/rpms/qemu/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1564

Modified Files:
	ksm.init ksmtuned ksmtuned.conf qemu.spec 
Added Files:
	qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch 
Log Message:
- Avoid creating too large iovecs in multiwrite merge (#559717)
- Don't try to set max_kernel_pages during ksm init on newer kernels (#558281)
- Add logfile options for ksmtuned debug.


qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch:
 block.c       |    4 ++++
 qemu-common.h |    4 ++++
 2 files changed, 8 insertions(+)

--- NEW FILE qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch ---
If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.

Add a MAX_IOV defintion for platforms that don't have it.  For now we use
the same 1024 define that's used on Linux and various other platforms,
but until the windows block backend implements some kind of vectored I/O
it doesn't matter.

Signed-off-by: Christoph Hellwig <hch at lst.de>

Index: qemu/block.c
===================================================================
--- qemu.orig/block.c	2010-01-26 10:59:39.757004445 +0100
+++ qemu/block.c	2010-01-26 11:01:38.056023231 +0100
@@ -1689,6 +1689,10 @@ static int multiwrite_merge(BlockDriverS
             merge = bs->drv->bdrv_merge_requests(bs, &reqs[outidx], &reqs[i]);
         }
 
+        if (reqs[outidx].qiov->niov + reqs[i].qiov->niov + 1 > IOV_MAX) {
+            merge = 0;
+        }
+
         if (merge) {
             size_t size;
             QEMUIOVector *qiov = qemu_mallocz(sizeof(*qiov));
Index: qemu/qemu-common.h
===================================================================
--- qemu.orig/qemu-common.h	2010-01-26 14:41:40.894254285 +0100
+++ qemu/qemu-common.h	2010-01-26 14:42:27.267275698 +0100
@@ -54,6 +54,10 @@ struct iovec {
     void *iov_base;
     size_t iov_len;
 };
+/*
+ * Use the same value as Linux for now.
+ */
+#define IOV_MAX		1024
 #else
 #include <sys/uio.h>
 #endif



Index: ksm.init
===================================================================
RCS file: /cvs/pkgs/rpms/qemu/devel/ksm.init,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- ksm.init	3 Nov 2009 15:12:29 -0000	1.4
+++ ksm.init	4 Feb 2010 15:58:29 -0000	1.5
@@ -40,8 +40,10 @@ default_max_kernel_pages () {
 
 start() {
     echo -n $"Starting $prog: "
-    KSM_MAX_KERNEL_PAGES=${KSM_MAX_KERNEL_PAGES:-`default_max_kernel_pages`}
-    echo $KSM_MAX_KERNEL_PAGES > /sys/kernel/mm/ksm/max_kernel_pages
+    if [ -f /sys/kernel/mm/ksm/max_kernel_pages ]; then
+        KSM_MAX_KERNEL_PAGES=${KSM_MAX_KERNEL_PAGES:-`default_max_kernel_pages`}
+        echo $KSM_MAX_KERNEL_PAGES > /sys/kernel/mm/ksm/max_kernel_pages
+    fi
     echo 1 > /sys/kernel/mm/ksm/run
     RETVAL=$?
     [ $RETVAL = 0 ] && success $"$prog startup" || failure $"$prog startup"


Index: ksmtuned
===================================================================
RCS file: /cvs/pkgs/rpms/qemu/devel/ksmtuned,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- ksmtuned	6 Oct 2009 13:26:24 -0000	1.2
+++ ksmtuned	4 Feb 2010 15:58:29 -0000	1.3
@@ -21,6 +21,14 @@ if [ -f /etc/ksmtuned.conf ]; then
     . /etc/ksmtuned.conf
 fi
 
+debug() {
+    if [ -n "$DEBUG" ]; then
+        s="`/bin/date`: $*"
+        [ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
+    fi
+}
+
+
 KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
 KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
 KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}
@@ -35,17 +43,17 @@ KSM_THRES_COEF=${KSM_THRES_COEF:-20}
 KSM_THRES_CONST=${KSM_THRES_CONST:-2048}
 
 total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
-[ -n "$DEBUG" ] && echo total $total
+debug total $total
 
 npages=0
 sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
 [ $sleep -le 10 ] && sleep=10
-[ -n "$DEBUG" ] && echo sleep $sleep
+debug sleep $sleep
 thres=$[total * KSM_THRES_COEF / 100]
 if [ $KSM_THRES_CONST -gt $thres ]; then
     thres=$KSM_THRES_CONST
 fi
-[ -n "$DEBUG" ] && echo thres $thres
+debug thres $thres
 
 KSMCTL () {
     case x$1 in
@@ -89,22 +97,22 @@ adjust () {
     local free committed
     free=`free_memory`
     committed=`committed_memory`
-    [ -n "$DEBUG" ] && echo committed $committed free $free
+    debug committed $committed free $free
     if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
         KSMCTL stop
-        [ -n "$DEBUG" ] && echo "$[committed + thres] < $total and free > $thres, stop ksm"
+        debug "$[committed + thres] < $total and free > $thres, stop ksm"
         return 1
     fi
-    [ -n "$DEBUG" ] && echo "$[committed + thres] > $total, start ksm"
+    debug "$[committed + thres] > $total, start ksm"
     if [ $free -lt $thres ]; then
         npages=`increase_npages $KSM_NPAGES_BOOST`
-        [ -n "$DEBUG" ] && echo "$free < $thres, boost"
+        debug "$free < $thres, boost"
     else
         npages=`increase_npages $KSM_NPAGES_DECAY`
-        [ -n "$DEBUG" ] && echo "$free > $thres, decay"
+        debug "$free > $thres, decay"
     fi
     KSMCTL start $npages $sleep
-    [ -n "$DEBUG" ] && echo "KSMCTL start $npages $sleep"
+    debug "KSMCTL start $npages $sleep"
     return 0
 }
 


Index: ksmtuned.conf
===================================================================
RCS file: /cvs/pkgs/rpms/qemu/devel/ksmtuned.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- ksmtuned.conf	16 Sep 2009 17:31:15 -0000	1.1
+++ ksmtuned.conf	4 Feb 2010 15:58:29 -0000	1.2
@@ -14,3 +14,8 @@
 
 # KSM_THRES_COEF=20
 # KSM_THRES_CONST=2048
+
+# uncomment the following if you want ksmtuned debug info
+
+# LOGFILE=/var/log/ksmtuned
+# DEBUG=1


Index: qemu.spec
===================================================================
RCS file: /cvs/pkgs/rpms/qemu/devel/qemu.spec,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -p -r1.155 -r1.156
--- qemu.spec	27 Jan 2010 18:20:38 -0000	1.155
+++ qemu.spec	4 Feb 2010 15:58:29 -0000	1.156
@@ -1,7 +1,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 0.12.2
-Release: 4%{?dist}
+Release: 5%{?dist}
 # Epoch because we pushed a qemu-1.0 package
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
@@ -35,6 +35,8 @@ Patch07: qemu-Move-virtio-serial-to-Make
 Patch08: qemu-virtio-serial-Use-MSI-vectors-for-port-virtqueues.patch
 Patch09: qemu-virtio-console-Rename-virtio-serial.c-back-to-virti.patch
 
+Patch10: qemu-v2-block-avoid-creating-too-large-iovecs-in-multiwrite_merge.patch
+
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
@@ -232,6 +234,7 @@ such as kvmtrace and kvm_stat.
 %patch07 -p1
 %patch08 -p1
 %patch09 -p1
+%patch10 -p1
 
 %build
 # --build-id option is used fedora 8 onwards for giving info to the debug packages.
@@ -515,6 +518,11 @@ fi
 %{_mandir}/man1/qemu-img.1*
 
 %changelog
+* Thu Feb 04 2010 Justin M. Forbes <jforbes at redhat.com> - 2:0.12.2-5
+- Avoid creating too large iovecs in multiwrite merge (#559717)
+- Don't try to set max_kernel_pages during ksm init on newer kernels (#558281)
+- Add logfile options for ksmtuned debug.
+
 * Wed Jan 27 2010 Amit Shah <amit.shah at redhat.com> - 2:0.12.2-4
 - Remove build dependency on iasl now that we have seabios
 



More information about the scm-commits mailing list