Compare commits

...

25 Commits
master ... f12

Author SHA1 Message Date
Fedora Release Engineering 073dff44d1 dist-git conversion 2010-07-29 10:59:06 +00:00
Justin M. Forbes f8c36ac20d own docdir, fix non-existent NIC error 2010-04-23 14:57:11 +00:00
Justin M. Forbes d8106ee041 Require the noarch seabios-bin 2010-04-20 21:13:24 +00:00
Justin M. Forbes 3319c35ea1 Detect cdrom via ioctl (#473154) re add increased buffer for USB control
requests (#546483)
2010-03-16 02:28:00 +00:00
Justin M. Forbes b85e6209ac Update to 0.12.3, require seabios, Migration clear the fd in error cases
(#518032)
2010-03-10 18:09:38 +00:00
Justin M. Forbes 81e6cc02b8 correct date 2010-01-20 21:51:27 +00:00
Justin M. Forbes 0d830c725b - Re-enable preadv/pwritev support (#545006)
- Fix buffer overflow in usb-linux.c (#546483)
2010-01-20 21:50:36 +00:00
Bill Nottingham 4d460524c1 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:16:14 +00:00
Mark McLoughlin 978033114a - Fix a use-after-free crasher in the slirp code (#539583)
- Fix overflow in the parallels image format support (#533573)
2009-11-20 18:28:23 +00:00
Mark McLoughlin fe0964651c - Temporarily disable preadv/pwritev support to fix data corruption
(#526549)
2009-11-04 17:37:52 +00:00
Justin M. Forbes 5b4ffa80c4 Default ksm and ksmtuned services on 2009-11-03 15:14:32 +00:00
Mark McLoughlin 070979f585 Fix typo in patch 2009-10-29 12:55:06 +00:00
Mark McLoughlin 7ec637da08 - Fix dropped packets with non-virtio NICs (#531419) 2009-10-29 11:45:24 +00:00
Glauber Costa 690ee5d1c6 Properly save kvm time registers (#524229) 2009-10-21 19:25:00 +00:00
Mark McLoughlin 98f6658c28 - Fix potential segfault from too small MSR_COUNT (#528901) 2009-10-19 10:33:42 +00:00
Mark McLoughlin db5d58fff4 Assume --build-id is always available 2009-10-14 15:57:53 +00:00
Mark McLoughlin 033dcb407b Fixup qemu-img description 2009-10-14 15:45:53 +00:00
Mark McLoughlin 2ce182b43c remove trailing blanks 2009-10-14 15:34:00 +00:00
Mark McLoughlin ed1eefd2ae - Fix fs errors with virtio and qcow2 backing file (#524734)
- Fix ksm initscript errors on kernel missing ksm (#527653)
- Add missing Requires(post): getent, useradd, groupadd (#527087)
2009-10-09 14:34:17 +00:00
Mark McLoughlin 5d0557b407 Fix syntax error in ksmtuned.init 2009-10-06 13:33:26 +00:00
Mark McLoughlin 7cc048b3d4 - Add 'retune' verb to ksmtuned init script 2009-10-06 13:26:58 +00:00
Mark McLoughlin 252dbd0999 - Use rtl8029 PXE rom for ne2k_pci, not ne (#526777)
- Also, replace the gpxe-roms-qemu pkg requires with file-based requires
2009-10-05 14:26:45 +00:00
Justin M. Forbes 9e6624c00e Update the Release for build 2009-10-01 22:38:01 +00:00
Justin M. Forbes c63c2b38da Improve error reporting on file access (#524695) 2009-10-01 21:29:40 +00:00
Jesse Keating 840b728482 Initialize branch F-12 for qemu 2009-09-29 06:40:17 +00:00
22 changed files with 601 additions and 930 deletions

View File

View File

@ -0,0 +1,53 @@
From c0c1147350005b47068285a288f848cf75eb60c6 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Tue, 26 Jan 2010 14:49:08 +0100
Subject: [PATCH] block: avoid creating too large iovecs in multiwrite_merge
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@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
block.c | 4 ++++
qemu-common.h | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 97af3f5..9697dc9 100644
--- a/block.c
+++ b/block.c
@@ -1669,6 +1669,10 @@ static int multiwrite_merge(BlockDriverState *bs, BlockRequest *reqs,
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));
diff --git a/qemu-common.h b/qemu-common.h
index 1c5c0b2..b604ddf 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -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
--
1.6.6.1

View File

@ -0,0 +1,100 @@
From baaa7b9f8498f73d14c8457e0150d0dfdcdbd245 Mon Sep 17 00:00:00 2001
From: Juan Quintela <quintela@redhat.com>
Date: Tue, 9 Mar 2010 23:58:50 +0100
Subject: [PATCH] migration: Clear fd also in error cases
Not clearing the fd and closing the file makes qemu spin using 100%CPU
after incoming migration error.
See for instance bug:
https://bugzilla.redhat.com/show_bug.cgi?id=518032
Signed-off-by: Juan Quintela <quintela@trasno.org>
---
migration-exec.c | 3 +--
migration-fd.c | 3 +--
migration-tcp.c | 5 ++---
migration-unix.c | 5 ++---
4 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/migration-exec.c b/migration-exec.c
index 87f645b..e57a55d 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -120,12 +120,11 @@ static void exec_accept_incoming_migration(void *opaque)
}
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the fd */
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
if (autostart)
vm_start();
err:
+ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
qemu_fclose(f);
}
diff --git a/migration-fd.c b/migration-fd.c
index ef7edbc..7325d13 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -113,12 +113,11 @@ static void fd_accept_incoming_migration(void *opaque)
}
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the fd */
- qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
if (autostart)
vm_start();
err:
+ qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
qemu_fclose(f);
}
diff --git a/migration-tcp.c b/migration-tcp.c
index 2cfa8cb..c328e73 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -170,15 +170,14 @@ static void tcp_accept_incoming_migration(void *opaque)
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the server socket */
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
- close(s);
if (autostart)
vm_start();
out_fopen:
qemu_fclose(f);
out:
+ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ close(s);
close(c);
}
diff --git a/migration-unix.c b/migration-unix.c
index a141dbb..9685c4b 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -176,13 +176,12 @@ static void unix_accept_incoming_migration(void *opaque)
qemu_announce_self();
dprintf("successfully loaded vm state\n");
- /* we've successfully migrated, close the server socket */
- qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
- close(s);
out_fopen:
qemu_fclose(f);
out:
+ qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
+ close(s);
close(c);
}
--
1.6.6.1

View File

@ -0,0 +1,61 @@
From 78a27b6a8f394c5a987c31aaf308e11556280f6a Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Thu, 14 Jan 2010 16:19:40 +0000
Subject: [PATCH] raw-posix: Detect CDROM via ioctl on linux
Current CDROM detection is hardcoded based on source file name.
Make this smarter on linux by attempting a CDROM specific ioctl.
This makes '-cdrom /dev/sr0' succeed with no media present.
v2:
Give ioctl check higher priority than filename check.
v3:
Actually initialize 'prio' variable.
Check for ioctl success rather than absence of specific failure.
v4:
Explicitly mention that change is linux specific.
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
block/raw-posix.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index c204cf9..1c777a1 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1142,9 +1142,25 @@ static int cdrom_open(BlockDriverState *bs, const char *filename, int flags)
static int cdrom_probe_device(const char *filename)
{
+ int fd, ret;
+ int prio = 0;
+
if (strstart(filename, "/dev/cd", NULL))
- return 100;
- return 0;
+ prio = 50;
+
+ fd = open(filename, O_RDONLY | O_NONBLOCK);
+ if (fd < 0) {
+ goto out;
+ }
+
+ /* Attempt to detect via a CDROM specific ioctl */
+ ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
+ if (ret >= 0)
+ prio = 100;
+
+ close(fd);
+out:
+ return prio;
}
static int cdrom_is_inserted(BlockDriverState *bs)
--
1.6.6.1

View File

@ -0,0 +1,33 @@
From 67e6ab59a04db24c4c947b7653d0f9e3078192bd Mon Sep 17 00:00:00 2001
From: Christian Krause <chkr@plauener.de>
Date: Sun, 24 Jan 2010 16:34:52 +0000
Subject: [PATCH] usb-linux: increase buffer for USB control requests
The WLAN USB stick ZyXEL NWD271N (0586:3417) uses very large
usb control transfers of more than 2048 bytes which won't fit
into the buffer of the ctrl_struct. This results in an error message
"husb: ctrl buffer too small" and a non-working device.
Increasing the buffer size to 8192 seems to be a safe choice.
Signed-off-by: Christian Krause <chkr@plauener.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
usb-linux.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/usb-linux.c b/usb-linux.c
index 5619b30..e6cd432 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -113,7 +113,7 @@ struct ctrl_struct {
uint16_t offset;
uint8_t state;
struct usb_ctrlrequest req;
- uint8_t buffer[2048];
+ uint8_t buffer[8192];
};
struct USBAutoFilter {
--
1.6.6.1

View File

@ -0,0 +1,43 @@
From 048294d62e2d61dfbe1e89d1dadb914371bba010 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:51 -0300
Subject: [PATCH] net: remove NICInfo.bootable field
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
It is just set by net_set_boot_mask() and never used. The logic for rom loading
changed a lot since this field was introduced. It is not needed anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
net.c | 1 -
net.h | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/net.c b/net.c
index 029b0d7..4030e39 100644
--- a/net.c
+++ b/net.c
@@ -1196,7 +1196,6 @@ void net_set_boot_mask(int net_boot_mask)
for (i = 0; i < nb_nics; i++) {
if (net_boot_mask & (1 << i)) {
- nd_table[i].bootable = 1;
net_boot_mask &= ~(1 << i);
}
}
diff --git a/net.h b/net.h
index 673b355..508d02e 100644
--- a/net.h
+++ b/net.h
@@ -132,7 +132,6 @@ struct NICInfo {
VLANState *vlan;
VLANClientState *netdev;
int used;
- int bootable;
int nvectors;
};
--
1.6.6.1

View File

@ -0,0 +1,100 @@
From a4e7898d9442efc0e9b60d5e50d531effa095b63 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:52 -0300
Subject: [PATCH] net: remove broken net_set_boot_mask() boot device validation
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
There are many problems with net_set_boot_mask():
1) It is broken when using the device model instead of "-net nic". Example:
$ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n
Cannot boot from non-existent NIC
$
2) The mask was previously used to set which boot ROMs were supposed to be
loaded, but this was changed long time ago. Now all ROM images are loaded,
and SeaBIOS takes care of jumping to the right boot entry point depending on
the boot settings.
3) Interpretation and validation of the boot parameter letters is done on
the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot
device letters. mac99 accepts only a,b,c,d,e,f.
As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n"
on a machine with no network devices. Checking if the requested boot device is
valid is now a task for the BIOS or the machine-type code.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
net.c | 19 -------------------
net.h | 1 -
vl.c | 5 +----
3 files changed, 1 insertions(+), 24 deletions(-)
diff --git a/net.c b/net.c
index 4030e39..28b6b43 100644
--- a/net.c
+++ b/net.c
@@ -1187,25 +1187,6 @@ void net_host_device_remove(Monitor *mon, const QDict *qdict)
qemu_del_vlan_client(vc);
}
-void net_set_boot_mask(int net_boot_mask)
-{
- int i;
-
- /* Only the first four NICs may be bootable */
- net_boot_mask = net_boot_mask & 0xF;
-
- for (i = 0; i < nb_nics; i++) {
- if (net_boot_mask & (1 << i)) {
- net_boot_mask &= ~(1 << i);
- }
- }
-
- if (net_boot_mask) {
- fprintf(stderr, "Cannot boot from non-existent NIC\n");
- exit(1);
- }
-}
-
void do_info_network(Monitor *mon)
{
VLANState *vlan;
diff --git a/net.h b/net.h
index 508d02e..be0ee12 100644
--- a/net.h
+++ b/net.h
@@ -162,7 +162,6 @@ int net_client_parse(QemuOptsList *opts_list, const char *str);
int net_init_clients(void);
void net_check_clients(void);
void net_cleanup(void);
-void net_set_boot_mask(int boot_mask);
void net_host_device_add(Monitor *mon, const QDict *qdict);
void net_host_device_remove(Monitor *mon, const QDict *qdict);
diff --git a/vl.c b/vl.c
index 59f8084..98d390e 100644
--- a/vl.c
+++ b/vl.c
@@ -4909,7 +4909,7 @@ int main(int argc, char **argv, char **envp)
const char *gdbstub_dev = NULL;
uint32_t boot_devices_bitmap = 0;
int i;
- int snapshot, linux_boot, net_boot;
+ int snapshot, linux_boot;
const char *initrd_filename;
const char *kernel_filename, *kernel_cmdline;
char boot_devices[33] = "cad"; /* default to HD->floppy->CD-ROM */
@@ -5948,9 +5948,6 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- net_boot = (boot_devices_bitmap >> ('n' - 'a')) & 0xF;
- net_set_boot_mask(net_boot);
-
/* init the bluetooth world */
if (foreach_device_config(DEV_BT, bt_parse))
exit(1);
--
1.6.6.1

View File

@ -0,0 +1,63 @@
From fbd17986e80087d0d686c5b13a5b39998c845f2c Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Tue, 6 Apr 2010 19:38:53 -0300
Subject: [PATCH] boot: remove unused boot_devices_bitmap variable
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=561078
In addition to removing the variable, this also renames the parse_bootdevices()
function to validate_bootdevices(), as we don't need its return value anymore.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
vl.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index 98d390e..2c97805 100644
--- a/vl.c
+++ b/vl.c
@@ -2514,7 +2514,7 @@ int qemu_boot_set(const char *boot_devices)
return boot_set_handler(boot_set_opaque, boot_devices);
}
-static int parse_bootdevices(char *devices)
+static void validate_bootdevices(char *devices)
{
/* We just do some generic consistency checks */
const char *p;
@@ -2540,7 +2540,6 @@ static int parse_bootdevices(char *devices)
}
bitmap |= 1 << (*p - 'a');
}
- return bitmap;
}
static void restore_boot_devices(void *opaque)
@@ -4907,7 +4906,6 @@ static int virtcon_parse(const char *devname)
int main(int argc, char **argv, char **envp)
{
const char *gdbstub_dev = NULL;
- uint32_t boot_devices_bitmap = 0;
int i;
int snapshot, linux_boot;
const char *initrd_filename;
@@ -5202,13 +5200,13 @@ int main(int argc, char **argv, char **envp)
if (legacy ||
get_param_value(buf, sizeof(buf), "order", optarg)) {
- boot_devices_bitmap = parse_bootdevices(buf);
+ validate_bootdevices(buf);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
}
if (!legacy) {
if (get_param_value(buf, sizeof(buf),
"once", optarg)) {
- boot_devices_bitmap |= parse_bootdevices(buf);
+ validate_bootdevices(buf);
standard_boot_devices = qemu_strdup(boot_devices);
pstrcpy(boot_devices, sizeof(boot_devices), buf);
qemu_register_reset(restore_boot_devices,
--
1.6.6.1

View File

@ -1,21 +0,0 @@
# Makefile for source rpm: qemu
# $Id$
NAME := qemu
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -7,7 +7,7 @@
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: - 84 16
# chkconfig: 345 84 16
# description: The KSM init script starts and stops the ksm kernel thread.
# config: /etc/sysconfig/ksm
#
@ -16,6 +16,7 @@
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Short-Description: start and stop ksm
# Description: The KSM init script starts and stops the ksm kernel thread.
### END INIT INFO
@ -39,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"
@ -56,6 +59,19 @@ stop() {
echo
}
status() {
if [ ! -f /sys/kernel/mm/ksm/run ] ; then
echo $"$prog not supported"
RETVAL=1
else if [ "$(cat /sys/kernel/mm/ksm/run 2>/dev/null)" != "1" ]; then
echo $"$prog is not running"
RETVAL=1
else
echo $"$prog is running"
RETVAL=0
fi; fi
}
case "$1" in
start)
start
@ -64,13 +80,7 @@ case "$1" in
stop
;;
status)
is_run=`cat /sys/kernel/mm/ksm/run`
RETVAL=$?
if [ $is_run -eq 1 ]; then
echo $"$prog is running"
else
echo $"$prog is not running"
fi
status
;;
restart)
stop

View File

@ -12,12 +12,23 @@
# make ksm work harder and harder untill memory load falls below that
# threshold.
#
# send SIGUSR1 to this process right after a new qemu process is started, or
# following its death, to retune ksm accordingly
#
# needs testing and ironing. contact danken@redhat.com if something breaks.
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}
@ -32,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
@ -86,29 +97,35 @@ 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
}
function nothing () {
:
}
loop () {
trap nothing SIGUSR1
while true
do
sleep $KSM_MONITOR_INTERVAL
sleep $KSM_MONITOR_INTERVAL &
wait $!
adjust
done
}

View File

@ -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

View File

@ -7,7 +7,7 @@
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: - 85 15
# chkconfig: 345 85 15
# description: The KSM tuning daemon controls whether (and with what vigor) \
# ksm should ksm search duplicated pages.
# processname: ksmtuned
@ -19,6 +19,7 @@
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Short-Description: tune the speed of ksm
# Description: The Kernel Samepage Merging control Daemon is a simple script
# that controls whether (and with what vigor) should ksm search duplicated
@ -75,8 +76,12 @@ case "$1" in
condrestart)
condrestart
;;
retune)
kill -SIGUSR1 `cat ${pidfile}`
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|status|help}"
echo $"Usage: $prog {start|stop|restart|condrestart|status|retune|help}"
RETVAL=3
esac

View File

@ -1,42 +0,0 @@
From c6c94b043e8b3593d0beb52966dce43069233840 Mon Sep 17 00:00:00 2001
From: Izik Eidus <ieidus@redhat.com>
Date: Tue, 28 Jul 2009 19:14:26 +0300
Subject: [PATCH] kvm userspace: ksm support
rfc for ksm support to kvm userpsace.
Signed-off-by: Izik Eidus <ieidus@redhat.com>
signed-off-by: Justin M. Forbes <jforbes@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-add-ksm-support.patch
---
exec.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index 0655b4b..a0e2203 100644
--- a/exec.c
+++ b/exec.c
@@ -65,6 +65,9 @@
#undef DEBUG_TB_CHECK
#endif
+/* Quick hack to enable KSM support */
+#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
+
#define SMC_BITMAP_USE_THRESHOLD 10
#if defined(TARGET_SPARC64)
@@ -2579,6 +2582,9 @@ ram_addr_t qemu_ram_alloc(ram_addr_t size)
new_block->host = file_ram_alloc(size, mem_path);
if (!new_block->host) {
new_block->host = qemu_vmalloc(size);
+#ifdef MADV_MERGEABLE
+ madvise(new_block->host, size, MADV_MERGEABLE);
+#endif
}
new_block->offset = last_ram_offset;
new_block->length = size;
--
1.6.2.5

View File

@ -1,37 +0,0 @@
From 8ab0d97572264051176ff45171484fa463d1287f Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Fri, 4 Sep 2009 11:24:03 +0100
Subject: [PATCH] Allow pulseaudio backend to be the default
We're seeing various issues with the SDL audio backend and want to
switch to the pulseaudio backend. See e.g.
https://bugzilla.redhat.com/495964
https://bugzilla.redhat.com/519540
https://bugzilla.redhat.com/496627
The pulseaudio backend seems to work well, so we should allow it to be
selected as the default.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-allow-pulseaudio-to-be-the-default.patch
---
audio/paaudio.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/audio/paaudio.c b/audio/paaudio.c
index a50fccc..547e252 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -507,7 +507,7 @@ struct audio_driver pa_audio_driver = {
INIT_FIELD (init = ) qpa_audio_init,
INIT_FIELD (fini = ) qpa_audio_fini,
INIT_FIELD (pcm_ops = ) &qpa_pcm_ops,
- INIT_FIELD (can_be_default = ) 0,
+ INIT_FIELD (can_be_default = ) 1,
INIT_FIELD (max_voices_out = ) INT_MAX,
INIT_FIELD (max_voices_in = ) INT_MAX,
INIT_FIELD (voice_size_out = ) sizeof (PAVoiceOut),
--
1.6.2.5

View File

@ -1,81 +0,0 @@
From b5c99e96655e8dc938f801e1ac0dbdf2d6dfba37 Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Wed, 24 Jun 2009 14:31:41 +0100
Subject: [PATCH] compute checksum for roms bigger than a segment
Some option roms (e1000 provided by gpxe project as an example)
are bigger than a segment. The current algorithm to compute the
checksum fails in such case. To proper compute the checksum, this
patch deals with the possibility of the rom's size crossing a
segment border.
We don't need to worry about it crossing more than one segment
border, since the option roms format only save one byte to store
the image size (thus, maximum size = 0xff = 128k = 2 segments)
[ including improvements suggested by malc ]
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-bios-bigger-roms.patch
---
kvm/bios/rombios.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
diff --git a/kvm/bios/rombios.c b/kvm/bios/rombios.c
index 6e1d446..8a96d8e 100644
--- a/kvm/bios/rombios.c
+++ b/kvm/bios/rombios.c
@@ -10189,22 +10189,43 @@ no_serial:
ret
rom_checksum:
- push ax
- push bx
- push cx
+ pusha
+ push ds
+
xor ax, ax
xor bx, bx
xor cx, cx
+ xor dx, dx
+
mov ch, [2]
shl cx, #1
+
+ jnc checksum_loop
+ xchg dx, cx
+ dec cx
+
checksum_loop:
add al, [bx]
inc bx
loop checksum_loop
+
+ test dx, dx
+ je checksum_out
+
+ add al, [bx]
+ mov cx, dx
+ mov dx, ds
+ add dh, #0x10
+ mov ds, dx
+ xor dx, dx
+ xor bx, bx
+
+ jmp checksum_loop
+
+checksum_out:
and al, #0xff
- pop cx
- pop bx
- pop ax
+ pop ds
+ popa
ret
--
1.6.2.5

View File

@ -1,118 +0,0 @@
From 3675a0dde74f890404f392e194f1adc6b24285f7 Mon Sep 17 00:00:00 2001
From: Glauber Costa <glommer@redhat.com>
Date: Wed, 23 Sep 2009 09:49:43 +0100
Subject: [PATCH] Correctly free nd structure
When we "free" a NICInfo structure, we can leak pointers, since we don't do
much more than setting used = 0.
We free() the model parameter, but we don't set it to NULL. This means that
a new user of this structure will see garbage in there. It was not noticed
before because reusing a NICInfo is not that common, but it can be, for
users of device pci hotplug.
A user hit it, described at https://bugzilla.redhat.com/524022
This patch memset's the whole structure, guaranteeing that anyone reusing it
will see a fresh NICinfo. Also, we free some other strings that are currently
leaking.
This codebase is quite old, so this patch should feed all stable trees.
Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-correctly-free-nic-info-structure.patch
---
net.c | 16 +++++++++++-----
net.h | 8 ++++----
vl.c | 2 +-
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/net.c b/net.c
index a1c1111..da2f428 100644
--- a/net.c
+++ b/net.c
@@ -2559,7 +2559,7 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
int i, exit_status = 0;
if (!nd->model)
- nd->model = strdup(default_model);
+ nd->model = qemu_strdup(default_model);
if (strcmp(nd->model, "?") != 0) {
for (i = 0 ; models[i]; i++)
@@ -2629,6 +2629,7 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
goto out;
}
nd = &nd_table[idx];
+ memset(nd, 0, sizeof(*nd));
macaddr = nd->macaddr;
macaddr[0] = 0x52;
macaddr[1] = 0x54;
@@ -2645,13 +2646,13 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
}
}
if (get_param_value(buf, sizeof(buf), "model", p)) {
- nd->model = strdup(buf);
+ nd->model = qemu_strdup(buf);
}
if (get_param_value(buf, sizeof(buf), "addr", p)) {
- nd->devaddr = strdup(buf);
+ nd->devaddr = qemu_strdup(buf);
}
if (get_param_value(buf, sizeof(buf), "id", p)) {
- nd->id = strdup(buf);
+ nd->id = qemu_strdup(buf);
}
nd->nvectors = NIC_NVECTORS_UNSPECIFIED;
if (get_param_value(buf, sizeof(buf), "vectors", p)) {
@@ -2998,8 +2999,13 @@ void net_client_uninit(NICInfo *nd)
{
nd->vlan->nb_guest_devs--;
nb_nics--;
+
+ qemu_free(nd->model);
+ qemu_free(nd->name);
+ qemu_free(nd->devaddr);
+ qemu_free(nd->id);
+
nd->used = 0;
- free((void *)nd->model);
}
static int net_host_check_device(const char *device)
diff --git a/net.h b/net.h
index 57ab031..94db0d7 100644
--- a/net.h
+++ b/net.h
@@ -101,10 +101,10 @@ enum {
struct NICInfo {
uint8_t macaddr[6];
- const char *model;
- const char *name;
- const char *devaddr;
- const char *id;
+ char *model;
+ char *name;
+ char *devaddr;
+ char *id;
VLANState *vlan;
VLANClientState *vc;
void *private;
diff --git a/vl.c b/vl.c
index 26bced8..d7c7ab1 100644
--- a/vl.c
+++ b/vl.c
@@ -2594,7 +2594,7 @@ static int usb_device_add(const char *devname, int is_hotplug)
if (net_client_init(NULL, "nic", p) < 0)
return -1;
- nd_table[nic].model = "usb";
+ nd_table[nic].model = qemu_strdup("usb");
dev = usb_net_init(&nd_table[nic]);
} else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
dev = usb_bt_init(devname[2] ? hci_init(p) :
--
1.6.2.5

View File

@ -1,100 +0,0 @@
From 0ce1af6e7d4b1e2ffa4dedf6d415c4d86a1af490 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Fri, 25 Sep 2009 03:53:50 +0200
Subject: [PATCH] Make it obvious that pci_nic_init() can't fail
Before this patch, pci_nic_init() returns NULL when it can't find the
model in pci_nic_models[]. Except this can't happen, because
qemu_check_nic_model_list() just searched for model in
pci_nic_models[], and terminated the program on failure.
Repeating the search here is pointless. Instead, change
qemu_check_nic_model_list() to return the model's array index.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com
Fedora-patch: qemu-do-not-exit-on-pci-hotplug-invalid-nic1.patch
---
hw/pci.c | 25 +++++++++----------------
net.c | 6 +++---
net.h | 4 ++--
3 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index a575d4a..eb990f9 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -937,22 +937,15 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
DeviceState *dev;
int i;
- qemu_check_nic_model_list(nd, pci_nic_models, default_model);
-
- for (i = 0; pci_nic_models[i]; i++) {
- if (strcmp(nd->model, pci_nic_models[i]) == 0) {
- pci_dev = pci_create(pci_nic_names[i], devaddr);
- dev = &pci_dev->qdev;
- if (nd->id)
- dev->id = qemu_strdup(nd->id);
- dev->nd = nd;
- qdev_init(dev);
- nd->private = dev;
- return pci_dev;
- }
- }
-
- return NULL;
+ i = qemu_check_nic_model_list(nd, pci_nic_models, default_model);
+ pci_dev = pci_create(pci_nic_names[i], devaddr);
+ dev = &pci_dev->qdev;
+ if (nd->id)
+ dev->id = qemu_strdup(nd->id);
+ dev->nd = nd;
+ qdev_init(dev);
+ nd->private = dev;
+ return pci_dev;
}
typedef struct {
diff --git a/net.c b/net.c
index da2f428..047e72e 100644
--- a/net.c
+++ b/net.c
@@ -2553,8 +2553,8 @@ void qemu_check_nic_model(NICInfo *nd, const char *model)
qemu_check_nic_model_list(nd, models, model);
}
-void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
- const char *default_model)
+int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
+ const char *default_model)
{
int i, exit_status = 0;
@@ -2564,7 +2564,7 @@ void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
if (strcmp(nd->model, "?") != 0) {
for (i = 0 ; models[i]; i++)
if (strcmp(nd->model, models[i]) == 0)
- return;
+ return i;
fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model);
exit_status = 1;
diff --git a/net.h b/net.h
index 94db0d7..9662988 100644
--- a/net.h
+++ b/net.h
@@ -80,8 +80,8 @@ void qemu_purge_queued_packets(VLANClientState *vc);
void qemu_flush_queued_packets(VLANClientState *vc);
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
void qemu_check_nic_model(NICInfo *nd, const char *model);
-void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
- const char *default_model);
+int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
+ const char *default_model);
void qemu_handler_true(void *opaque);
void do_info_network(Monitor *mon);
--
1.6.2.5

View File

@ -1,324 +0,0 @@
From 0ba615f4e6ecf13839b7688c762961aa1d092504 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Fri, 25 Sep 2009 03:53:51 +0200
Subject: [PATCH] Fix pci_add nic not to exit on bad model
Monitor command "pci_add ADDR nic model=MODEL" uses pci_nic_init() to
create the NIC. When MODEL is unknown or "?", this prints to stderr
and terminates the program.
Change pci_nic_init() not to treat "?" specially, and to return NULL
on failure. Switch uses during startup to new convenience wrapper
pci_nic_init_nofail(), which behaves just like pci_nic_init() used to
do.
[markmc:
- rebase to stable-0.11
- drop qemu_error() usage
- go back to pci_create() in pci_nic_init
- qdev_init() doesn't have an error return
]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-do-not-exit-on-pci-hotplug-invalid-nic2.patch
---
hw/mips_malta.c | 2 +-
hw/pc.c | 2 +-
hw/pci.c | 19 ++++++++++++++++++-
hw/pci.h | 2 ++
hw/ppc440_bamboo.c | 2 +-
hw/ppc_newworld.c | 2 +-
hw/ppc_oldworld.c | 2 +-
hw/ppc_prep.c | 2 +-
hw/ppce500_mpc8544ds.c | 2 +-
hw/r2d.c | 2 +-
hw/realview.c | 2 +-
hw/sun4u.c | 2 +-
hw/versatilepb.c | 2 +-
net.c | 41 +++++++++++++++++++++++++----------------
net.h | 5 +++--
15 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index 7728e58..ed86d4b 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -486,7 +486,7 @@ static void network_init(void)
/* The malta board has a PCNet card using PCI SLOT 11 */
default_devaddr = "0b";
- pci_nic_init(nd, "pcnet", default_devaddr);
+ pci_nic_init_nofail(nd, "pcnet", default_devaddr);
}
}
diff --git a/hw/pc.c b/hw/pc.c
index bcd2989..3b226f4 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1360,7 +1360,7 @@ static void pc_init1(ram_addr_t ram_size,
if (!pci_enabled || (nd->model && strcmp(nd->model, "ne2k_isa") == 0))
pc_init_ne2k_isa(nd, i8259);
else
- pci_nic_init(nd, "rtl8139", NULL);
+ pci_nic_init_nofail(nd, "rtl8139", NULL);
}
piix4_acpi_system_hot_add_init(cpu_model);
diff --git a/hw/pci.c b/hw/pci.c
index eb990f9..9bcf49d 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -937,7 +937,10 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
DeviceState *dev;
int i;
- i = qemu_check_nic_model_list(nd, pci_nic_models, default_model);
+ i = qemu_find_nic_model(nd, pci_nic_models, default_model);
+ if (i < 0)
+ return NULL;
+
pci_dev = pci_create(pci_nic_names[i], devaddr);
dev = &pci_dev->qdev;
if (nd->id)
@@ -948,6 +951,20 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
return pci_dev;
}
+PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
+ const char *default_devaddr)
+{
+ PCIDevice *res;
+
+ if (qemu_show_nic_models(nd->model, pci_nic_models))
+ exit(0);
+
+ res = pci_nic_init(nd, default_model, default_devaddr);
+ if (!res)
+ exit(1);
+ return res;
+}
+
typedef struct {
PCIDevice dev;
PCIBus *bus;
diff --git a/hw/pci.h b/hw/pci.h
index 7ca3ba9..18a05f5 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -291,6 +291,8 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name,
PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
const char *default_devaddr);
+PCIDevice *pci_nic_init_nofail(NICInfo *nd, const char *default_model,
+ const char *default_devaddr);
void pci_data_write(void *opaque, uint32_t addr, uint32_t val, int len);
uint32_t pci_data_read(void *opaque, uint32_t addr, int len);
int pci_bus_num(PCIBus *s);
diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c
index c74aa2f..9f22623 100644
--- a/hw/ppc440_bamboo.c
+++ b/hw/ppc440_bamboo.c
@@ -128,7 +128,7 @@ static void bamboo_init(ram_addr_t ram_size,
for (i = 0; i < nb_nics; i++) {
/* There are no PCI NICs on the Bamboo board, but there are
* PCI slots, so we can pick whatever default model we want. */
- pci_nic_init(&nd_table[i], "e1000", NULL);
+ pci_nic_init_nofail(&nd_table[i], "e1000", NULL);
}
}
diff --git a/hw/ppc_newworld.c b/hw/ppc_newworld.c
index 45480ea..5fa9e82 100644
--- a/hw/ppc_newworld.c
+++ b/hw/ppc_newworld.c
@@ -304,7 +304,7 @@ static void ppc_core99_init (ram_addr_t ram_size,
serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
for(i = 0; i < nb_nics; i++)
- pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
fprintf(stderr, "qemu: too many IDE bus\n");
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index 5c745a0..49c8a00 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -315,7 +315,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
serial_hds[1], ESCC_CLOCK, 4);
for(i = 0; i < nb_nics; i++)
- pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 7a21977..a8f0002 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -681,7 +681,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
if (strcmp(nd_table[i].model, "ne2k_isa") == 0) {
isa_ne2000_init(ne2000_io[i], i8259[ne2000_irq[i]], &nd_table[i]);
} else {
- pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
}
}
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index db52cdd..5f2b526 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -228,7 +228,7 @@ static void mpc8544ds_init(ram_addr_t ram_size,
/* Register network interfaces. */
for (i = 0; i < nb_nics; i++) {
- pci_nic_init(&nd_table[i], "virtio", NULL);
+ pci_nic_init_nofail(&nd_table[i], "virtio", NULL);
}
}
diff --git a/hw/r2d.c b/hw/r2d.c
index 8ce6832..af229d4 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -231,7 +231,7 @@ static void r2d_init(ram_addr_t ram_size,
/* NIC: rtl8139 on-board, and 2 slots. */
for (i = 0; i < nb_nics; i++)
- pci_nic_init(&nd_table[i], "rtl8139", i==0 ? "2" : NULL);
+ pci_nic_init_nofail(&nd_table[i], "rtl8139", i==0 ? "2" : NULL);
/* Todo: register on board registers */
if (kernel_filename) {
diff --git a/hw/realview.c b/hw/realview.c
index 8e176b9..70c129b 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -125,7 +125,7 @@ static void realview_init(ram_addr_t ram_size,
smc91c111_init(nd, 0x4e000000, pic[28]);
done_smc = 1;
} else {
- pci_nic_init(nd, "rtl8139", NULL);
+ pci_nic_init_nofail(nd, "rtl8139", NULL);
}
}
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 9d2a7f5..9fb5dcd 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -497,7 +497,7 @@ static void sun4uv_init(ram_addr_t RAM_size,
}
for(i = 0; i < nb_nics; i++)
- pci_nic_init(&nd_table[i], "ne2k_pci", NULL);
+ pci_nic_init_nofail(&nd_table[i], "ne2k_pci", NULL);
if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) {
fprintf(stderr, "qemu: too many IDE bus\n");
diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 3371121..8e06c31 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -212,7 +212,7 @@ static void versatile_init(ram_addr_t ram_size,
smc91c111_init(nd, 0x10010000, sic[25]);
done_smc = 1;
} else {
- pci_nic_init(nd, "rtl8139", NULL);
+ pci_nic_init_nofail(nd, "rtl8139", NULL);
}
}
if (usb_enabled) {
diff --git a/net.c b/net.c
index 047e72e..3572c48 100644
--- a/net.c
+++ b/net.c
@@ -2543,6 +2543,19 @@ static int nic_get_free_idx(void)
return -1;
}
+int qemu_show_nic_models(const char *arg, const char *const *models)
+{
+ int i;
+
+ if (!arg || strcmp(arg, "?"))
+ return 0;
+
+ fprintf(stderr, "qemu: Supported NIC models: ");
+ for (i = 0 ; models[i]; i++)
+ fprintf(stderr, "%s%c", models[i], models[i+1] ? ',' : '\n');
+ return 1;
+}
+
void qemu_check_nic_model(NICInfo *nd, const char *model)
{
const char *models[2];
@@ -2550,31 +2563,27 @@ void qemu_check_nic_model(NICInfo *nd, const char *model)
models[0] = model;
models[1] = NULL;
- qemu_check_nic_model_list(nd, models, model);
+ if (qemu_show_nic_models(nd->model, models))
+ exit(0);
+ if (qemu_find_nic_model(nd, models, model) < 0)
+ exit(1);
}
-int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
- const char *default_model)
+int qemu_find_nic_model(NICInfo *nd, const char * const *models,
+ const char *default_model)
{
- int i, exit_status = 0;
+ int i;
if (!nd->model)
nd->model = qemu_strdup(default_model);
- if (strcmp(nd->model, "?") != 0) {
- for (i = 0 ; models[i]; i++)
- if (strcmp(nd->model, models[i]) == 0)
- return i;
-
- fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model);
- exit_status = 1;
+ for (i = 0 ; models[i]; i++) {
+ if (strcmp(nd->model, models[i]) == 0)
+ return i;
}
- fprintf(stderr, "qemu: Supported NIC models: ");
- for (i = 0 ; models[i]; i++)
- fprintf(stderr, "%s%c", models[i], models[i+1] ? ',' : '\n');
-
- exit(exit_status);
+ fprintf(stderr, "qemu: Unsupported NIC model: %s\n", nd->model);
+ return -1;
}
static int net_handle_fd_param(Monitor *mon, const char *param)
diff --git a/net.h b/net.h
index 9662988..07b4c9a 100644
--- a/net.h
+++ b/net.h
@@ -79,9 +79,10 @@ ssize_t qemu_send_packet_async(VLANClientState *vc, const uint8_t *buf,
void qemu_purge_queued_packets(VLANClientState *vc);
void qemu_flush_queued_packets(VLANClientState *vc);
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
+int qemu_show_nic_models(const char *arg, const char *const *models);
void qemu_check_nic_model(NICInfo *nd, const char *model);
-int qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
- const char *default_model);
+int qemu_find_nic_model(NICInfo *nd, const char * const *models,
+ const char *default_model);
void qemu_handler_true(void *opaque);
void do_info_network(Monitor *mon);
--
1.6.2.5

View File

@ -1,135 +0,0 @@
From 8f4d4cb4e4e73d0533aa2cb421c14210c75f6edc Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc@redhat.com>
Date: Mon, 29 Jun 2009 14:49:03 +0100
Subject: [PATCH] Fix linux-user build on ppc
kvm-87 build fails on ppc:
https://koji.fedoraproject.org/koji/getfile?taskID=1441042&name=build.log
gcc -I. -I.. -I/builddir/build/BUILD/qemu-kvm-devel-87/target-i386
-I/builddir/build/BUILD/qemu-kvm-devel-87 -MMD -MT elfload.o -MP
-DNEED_CPU_H -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-D__user= -I/builddir/build/BUILD/qemu-kvm-devel-87/tcg
-I/builddir/build/BUILD/qemu-kvm-devel-87/tcg/ppc64
-I/builddir/build/BUILD/qemu-kvm-devel-87/fpu
-I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user
-I/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/i386 -O2 -g -pipe
-Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mminimal-toc -g -fno-strict-aliasing
-O2 -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes
-Wstrict-prototypes -Wredundant-decls -c -o elfload.o
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:214: error: conflicting types for 'elf_greg_t'
/usr/include/asm/elf.h:123: note: previous declaration of 'elf_greg_t' was here
/builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:220: error: conflicting types for 'elf_gregset_t'
/usr/include/asm/elf.h:124: note: previous declaration of 'elf_gregset_t' was here
In file included from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:697:
../elf.h:457:1: warning: "R_PPC_NUM" redefined
In file included from /usr/include/asm/sigcontext.h:13,
from /usr/include/bits/sigcontext.h:28,
from /usr/include/signal.h:339,
from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/qemu.h:4,
from /builddir/build/BUILD/qemu-kvm-devel-87/linux-user/elfload.c:16:
/usr/include/asm/elf.h:81:1: warning: this is the location of the previous definition
Problem seems to be that signal.h is pulling in a bunch of ppc
headers which expose elf_greg_t, R_PPC_* and PPC_FEATURE_*.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-fix-linux-user-build-on-ppc.patch
---
elf.h | 2 ++
linux-user/elfload.c | 10 ++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/elf.h b/elf.h
index b042002..14f8aa1 100644
--- a/elf.h
+++ b/elf.h
@@ -454,7 +454,9 @@ typedef struct {
#define R_PPC_SECTOFF_HI 35
#define R_PPC_SECTOFF_HA 36
/* Keep this the last entry. */
+#ifndef R_PPC_NUM
#define R_PPC_NUM 37
+#endif /* R_PPC_NUM */
/* ARM specific declarations */
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 3a8268b..d283f73 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -134,6 +134,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->rip = infop->entry;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef target_ulong elf_greg_t;
typedef uint32_t target_uid_t;
typedef uint32_t target_gid_t;
@@ -179,6 +180,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
(*regs)[25] = env->segs[R_FS].selector & 0xffff;
(*regs)[26] = env->segs[R_GS].selector & 0xffff;
}
+#endif /* FIX_BROKEN_PPC_BUILD */
#else
@@ -211,6 +213,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->edx = 0;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef target_ulong elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
@@ -246,9 +249,12 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
(*regs)[15] = env->regs[R_ESP];
(*regs)[16] = env->segs[R_SS].selector & 0xffff;
}
+#endif /* FIX_BROKEN_PPC_BUILD */
#endif
+#ifdef FIX_BROKEN_PPC_BUILD
#define USE_ELF_CORE_DUMP
+#endif /* FIX_BROKEN_PPC_BUILD */
#define ELF_EXEC_PAGESIZE 4096
#endif
@@ -286,6 +292,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
regs->ARM_r10 = infop->start_data;
}
+#ifdef FIX_BROKEN_PPC_BUILD
typedef uint32_t elf_greg_t;
typedef uint16_t target_uid_t;
typedef uint16_t target_gid_t;
@@ -318,6 +325,7 @@ static void elf_core_copy_regs(elf_gregset_t *regs, const CPUState *env)
}
#define USE_ELF_CORE_DUMP
+#endif /* FIX_BROKEN_PPC_BUILD */
#define ELF_EXEC_PAGESIZE 4096
enum
@@ -421,6 +429,7 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
/* Feature masks for the Aux Vector Hardware Capabilities (AT_HWCAP).
See arch/powerpc/include/asm/cputable.h. */
+#ifndef PPC_FEATURE_32
enum {
PPC_FEATURE_32 = 0x80000000,
PPC_FEATURE_64 = 0x40000000,
@@ -452,6 +461,7 @@ enum {
PPC_FEATURE_TRUE_LE = 0x00000002,
PPC_FEATURE_PPC_LE = 0x00000001,
};
+#endif /* !defined(PPC_FEATURE_32) */
#define ELF_HWCAP get_elf_hwcap()
--
1.6.2.5

137
qemu.spec
View File

@ -1,7 +1,7 @@
Summary: QEMU is a FAST! processor emulator
Name: qemu
Version: 0.11.0
Release: 2%{?dist}
Version: 0.12.3
Release: 4%{?dist}
# Epoch because we pushed a qemu-1.0 package
Epoch: 2
License: GPLv2+ and LGPLv2+ and BSD
@ -24,28 +24,18 @@ Source6: ksmtuned.init
Source7: ksmtuned
Source8: ksmtuned.conf
# Not upstream, why?
Patch01: qemu-bios-bigger-roms.patch
# Works around broken linux-user build on ppc
Patch02: qemu-fix-linux-user-build-on-ppc.patch
# Allow the pulseudio backend to be the default
Patch03: qemu-allow-pulseaudio-to-be-the-default.patch
# Add KSM support - see https://fedoraproject.org/wiki/Features/KSM
Patch04: qemu-add-ksm-support.patch
# Fix issue causing NIC hotplug confusion when no model is specified (#524022)
Patch05: qemu-correctly-free-nic-info-structure.patch
# Do not exit during PCI hotplug when an invalid NIC model is passed (#524022)
Patch06: qemu-do-not-exit-on-pci-hotplug-invalid-nic1.patch
Patch07: qemu-do-not-exit-on-pci-hotplug-invalid-nic2.patch
Patch01: 0001-block-avoid-creating-too-large-iovecs-in-multiwrite_.patch
Patch02: 0002-migration-Clear-fd-also-in-error-cases.patch
Patch03: 0003-raw-posix-Detect-CDROM-via-ioctl-on-linux.patch
Patch04: 0004-usb-linux-increase-buffer-for-USB-control-requests.patch
Patch05: 0005-net-remove-NICInfo.bootable-field.patch
Patch06: 0006-net-remove-broken-net_set_boot_mask-boot-device-vali.patch
Patch07: 0007-boot-remove-unused-boot_devices_bitmap-variable.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
BuildRequires: rsync dev86 iasl
BuildRequires: libaio-devel
BuildRequires: rsync
BuildRequires: pciutils-devel
BuildRequires: pulseaudio-libs-devel
BuildRequires: ncurses-devel
@ -94,14 +84,14 @@ will install qemu-system-x86
Summary: QEMU command line tool for manipulating disk images
Group: Development/Tools
%description img
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the command line tool for manipulating disk images
This package provides a command line tool for manipulating disk images
%package common
Summary: QEMU common files needed by all QEMU targets
Group: Development/Tools
Requires(post): /usr/bin/getent
Requires(post): /usr/sbin/groupadd
Requires(post): /usr/sbin/useradd
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/service /sbin/chkconfig
Requires(postun): /sbin/service
@ -128,11 +118,15 @@ This package provides the user mode emulation of qemu targets
Summary: QEMU system emulator for x86
Group: Development/Tools
Requires: %{name}-common = %{epoch}:%{version}-%{release}
Requires: gpxe-roms-qemu
Requires: vgabios
Requires: bochs-bios >= 2.3.8-0.8
Provides: kvm = 85
Obsoletes: kvm < 85
Requires: vgabios
Requires: seabios-bin
Requires: /usr/share/gpxe/e1000-0x100e.rom
Requires: /usr/share/gpxe/rtl8029.rom
Requires: /usr/share/gpxe/pcnet32.rom
Requires: /usr/share/gpxe/rtl8139.rom
Requires: /usr/share/gpxe/virtio-net.rom
%description system-x86
QEMU is a generic and open source processor emulator which achieves a good
@ -235,21 +229,9 @@ such as kvmtrace and kvm_stat.
%patch07 -p1
%build
# systems like rhel build system does not have a recent enough linker so
# --build-id works. this option is used fedora 8 onwards for giving info
# to the debug packages.
build_id_available() {
echo "int main () { return 0; }" | gcc -x c -Wl,--build-id - 2>/dev/null
}
if build_id_available; then
extraldflags="-Wl,--build-id";
buildldflags="VL_LDFLAGS=-Wl,--build-id"
else
extraldflags=""
buildldflags=""
fi
# --build-id option is used fedora 8 onwards for giving info to the debug packages.
extraldflags="-Wl,--build-id";
buildldflags="VL_LDFLAGS=-Wl,--build-id"
%ifarch %{ix86} x86_64
# sdl outputs to alsa or pulseaudio depending on system config, but it's broken (#495964)
@ -355,13 +337,13 @@ pxe_link() {
}
pxe_link e1000 e1000-0x100e
pxe_link ne2k_pci ne
pxe_link ne2k_pci rtl8029
pxe_link pcnet pcnet32
pxe_link rtl8139 rtl8139
pxe_link virtio virtio-net
ln -s ../vgabios/VGABIOS-lgpl-latest.bin %{buildroot}/%{_datadir}/%{name}/vgabios.bin
ln -s ../vgabios/VGABIOS-lgpl-latest.cirrus.bin %{buildroot}/%{_datadir}/%{name}/vgabios-cirrus.bin
ln -s ../bochs/BIOS-bochs-kvm %{buildroot}/%{_datadir}/%{name}/bios.bin
ln -s ../seabios/bios.bin %{buildroot}/%{_datadir}/%{name}/bios.bin
ln -s ../openbios/openbios-ppc %{buildroot}/%{_datadir}/%{name}/openbios-ppc
ln -s ../openbios/openbios-sparc32 %{buildroot}/%{_datadir}/%{name}/openbios-sparc32
ln -s ../openbios/openbios-sparc64 %{buildroot}/%{_datadir}/%{name}/openbios-sparc64
@ -414,7 +396,7 @@ if [ $1 -ge 1 ]; then
/sbin/service qemu condrestart &>/dev/null || :
fi
%files
%files
%defattr(-,root,root)
%files kvm
@ -422,13 +404,14 @@ fi
%files common
%defattr(-,root,root)
%dir %{qemudocdir}
%doc %{qemudocdir}/Changelog
%doc %{qemudocdir}/README
%doc %{qemudocdir}/TODO
%doc %{qemudocdir}/qemu-doc.html
%doc %{qemudocdir}/qemu-doc.html
%doc %{qemudocdir}/qemu-tech.html
%doc %{qemudocdir}/COPYING
%doc %{qemudocdir}/COPYING.LIB
%doc %{qemudocdir}/COPYING
%doc %{qemudocdir}/COPYING.LIB
%doc %{qemudocdir}/LICENSE
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/keymaps/
@ -466,7 +449,9 @@ fi
%{_bindir}/qemu
%{_bindir}/qemu-system-x86_64
%{_datadir}/%{name}/bios.bin
%{_datadir}/%{name}/linuxboot.bin
%{_datadir}/%{name}/multiboot.bin
%{_datadir}/%{name}/vapic.bin
%{_datadir}/%{name}/vgabios.bin
%{_datadir}/%{name}/vgabios-cirrus.bin
%{_datadir}/%{name}/pxe-e1000.bin
@ -526,6 +511,60 @@ fi
%{_mandir}/man1/qemu-img.1*
%changelog
* Fri Apr 23 2010 Justin M. Forbes <jforbes@redhat.com> - 2:0.12.3-4
- Add ownership of docdir to qemu-common (#572110)
- Fix "Cannot boot from non-existent NIC" error when using virt-install (#577851)
* Tue Apr 20 2010 Justin M. Forbes <jforbes@redhat.com> - 2:0.12.3-3
- Require seabios-bin which is noarch.
* Mon Mar 15 2010 Justin M. Forbes <jforbes@redhat.com> - 2:0.12.3-2
- Detect cdrom via ioctl (#473154)
- re add increased buffer for USB control requests (#546483)
* Wed Mar 10 2010 Justin M. Forbes <jforbes@redhat.com> - 2:0.12.3-1
- Update to 0.12.3 upstream
- Require seabios
- Migration clear the fd in error cases (#518032)
* Wed Jan 20 2010 Justin M. Forbes <jforbes@redhat.com> - 2:0.11.0-13
- Re-enable preadv/pwritev support (#545006)
- Fix buffer overflow in usb-linux.c (#546483)
* Fri Nov 20 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-12
- Fix a use-after-free crasher in the slirp code (#539583)
- Fix overflow in the parallels image format support (#533573)
* Wed Nov 4 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-11
- Temporarily disable preadv/pwritev support to fix data corruption (#526549)
* Tue Nov 3 2009 Justin M. Forbes <jforbes@redhat.com> - 2:0.11.0-10
- Default ksm and ksmtuned services on.
* Thu Oct 29 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-9
- Fix dropped packets with non-virtio NICs (#531419)
* Wed Oct 21 2009 Glauber Costa <gcosta@redhat.com> - 2:0.11.0-8
- Properly save kvm time registers (#524229)
* Mon Oct 19 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-7
- Fix potential segfault from too small MSR_COUNT (#528901)
* Fri Oct 9 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-6
- Fix fs errors with virtio and qcow2 backing file (#524734)
- Fix ksm initscript errors on kernel missing ksm (#527653)
- Add missing Requires(post): getent, useradd, groupadd (#527087)
* Tue Oct 6 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-5
- Add 'retune' verb to ksmtuned init script
* Mon Oct 5 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-4
- Use rtl8029 PXE rom for ne2k_pci, not ne (#526777)
- Also, replace the gpxe-roms-qemu pkg requires with file-based requires
* Thu Oct 1 2009 Justin M. Forbes <jmforbes@redhat.com> - 2:0.11.0-3
- Improve error reporting on file access (#524695)
* Mon Sep 28 2009 Mark McLoughlin <markmc@redhat.com> - 2:0.11.0-2
- Fix pci hotplug to not exit if supplied an invalid NIC model (#524022)

View File

@ -1 +1 @@
440837a062967102a68e634d57eaf719 qemu-kvm-0.11.0.tar.gz
ab484975004f66fb48cb5589bd9b9dcb qemu-kvm-0.12.3.tar.gz