SHA256
1
0
forked from pool/qemu

Accepting request 292383 from home:a_faerber:branches:Virtualization

Build and test fixes

OBS-URL: https://build.opensuse.org/request/show/292383
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=239
This commit is contained in:
Andreas Färber 2015-03-23 02:43:53 +00:00 committed by Git OBS Bridge
parent e53bce3ca8
commit 8937e90638
10 changed files with 395 additions and 0 deletions

View File

@ -0,0 +1,58 @@
From ca317e5e62dfbc0948775e8b92bf5e620d2c8ab1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Thu, 19 Mar 2015 18:47:52 +0100
Subject: [PATCH] fw_cfg-test: Fix test path to include architecture
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use qtest_add_func() instead of g_test_add_func() to reflect
the architecture tested, changing GTester paths as follows:
/fw_cfg/foo -> /x86_64/fw_cfg/foo etc.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
tests/fw_cfg-test.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c
index 5c8f8d6..9be78e9 100644
--- a/tests/fw_cfg-test.c
+++ b/tests/fw_cfg-test.c
@@ -109,21 +109,21 @@ int main(int argc, char **argv)
fw_cfg = pc_fw_cfg_init();
- g_test_add_func("/fw_cfg/signature", test_fw_cfg_signature);
- g_test_add_func("/fw_cfg/id", test_fw_cfg_id);
- g_test_add_func("/fw_cfg/uuid", test_fw_cfg_uuid);
- g_test_add_func("/fw_cfg/ram_size", test_fw_cfg_ram_size);
- g_test_add_func("/fw_cfg/nographic", test_fw_cfg_nographic);
- g_test_add_func("/fw_cfg/nb_cpus", test_fw_cfg_nb_cpus);
+ qtest_add_func("fw_cfg/signature", test_fw_cfg_signature);
+ qtest_add_func("fw_cfg/id", test_fw_cfg_id);
+ qtest_add_func("fw_cfg/uuid", test_fw_cfg_uuid);
+ qtest_add_func("fw_cfg/ram_size", test_fw_cfg_ram_size);
+ qtest_add_func("fw_cfg/nographic", test_fw_cfg_nographic);
+ qtest_add_func("fw_cfg/nb_cpus", test_fw_cfg_nb_cpus);
#if 0
- g_test_add_func("/fw_cfg/machine_id", test_fw_cfg_machine_id);
- g_test_add_func("/fw_cfg/kernel", test_fw_cfg_kernel);
- g_test_add_func("/fw_cfg/initrd", test_fw_cfg_initrd);
- g_test_add_func("/fw_cfg/boot_device", test_fw_cfg_boot_device);
+ qtest_add_func("fw_cfg/machine_id", test_fw_cfg_machine_id);
+ qtest_add_func("fw_cfg/kernel", test_fw_cfg_kernel);
+ qtest_add_func("fw_cfg/initrd", test_fw_cfg_initrd);
+ qtest_add_func("fw_cfg/boot_device", test_fw_cfg_boot_device);
#endif
- g_test_add_func("/fw_cfg/max_cpus", test_fw_cfg_max_cpus);
- g_test_add_func("/fw_cfg/numa", test_fw_cfg_numa);
- g_test_add_func("/fw_cfg/boot_menu", test_fw_cfg_boot_menu);
+ qtest_add_func("fw_cfg/max_cpus", test_fw_cfg_max_cpus);
+ qtest_add_func("fw_cfg/numa", test_fw_cfg_numa);
+ qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu);
cmdline = g_strdup_printf("-uuid 4600cb32-38ec-4b2f-8acb-81c6ea54f2d8 ");
s = qtest_start(cmdline);

View File

@ -0,0 +1,238 @@
From b83fde56586a140b501127a18b978eb152688fbe Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Sun, 22 Mar 2015 09:26:50 +0100
Subject: [PATCH] rcu tests: fix compilation on 32-bit ppc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
32-bit PPC cannot do atomic operations on long long. Inside the loops,
we are already using local counters that are summed at the end of
the run---with some exceptions (rcu_stress_count for rcutorture,
n_nodes for test-rcu-list): fix them to use the same technique.
For test-rcu-list, remove the mostly unused member "val" from the
list. Then, use a mutex to protect the global counts.
Performance does not matter there because every thread will only enter
the critical section once.
Remaining uses of atomic instructions are for ints or pointers.
Reported-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
tests/rcutorture.c | 20 ++++++++++++++++----
tests/test-rcu-list.c | 50 ++++++++++++++++++++++++++++----------------------
2 files changed, 44 insertions(+), 26 deletions(-)
diff --git a/tests/rcutorture.c b/tests/rcutorture.c
index 60a2ccf..d6b304d 100644
--- a/tests/rcutorture.c
+++ b/tests/rcutorture.c
@@ -82,6 +82,7 @@ static volatile int goflag = GOFLAG_INIT;
#define RCU_READ_RUN 1000
#define NR_THREADS 100
+static QemuMutex counts_mutex;
static QemuThread threads[NR_THREADS];
static struct rcu_reader_data *data[NR_THREADS];
static int n_threads;
@@ -130,7 +131,9 @@ static void *rcu_read_perf_test(void *arg)
}
n_reads_local += RCU_READ_RUN;
}
- atomic_add(&n_reads, n_reads_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_reads += n_reads_local;
+ qemu_mutex_unlock(&counts_mutex);
rcu_unregister_thread();
return NULL;
@@ -151,7 +154,9 @@ static void *rcu_update_perf_test(void *arg)
synchronize_rcu();
n_updates_local++;
}
- atomic_add(&n_updates, n_updates_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_updates += n_updates_local;
+ qemu_mutex_unlock(&counts_mutex);
rcu_unregister_thread();
return NULL;
@@ -241,6 +246,7 @@ static void *rcu_read_stress_test(void *arg)
struct rcu_stress *p;
int pc;
long long n_reads_local = 0;
+ long long rcu_stress_local[RCU_STRESS_PIPE_LEN + 1] = { 0 };
volatile int garbage = 0;
rcu_register_thread();
@@ -265,13 +271,18 @@ static void *rcu_read_stress_test(void *arg)
if ((pc > RCU_STRESS_PIPE_LEN) || (pc < 0)) {
pc = RCU_STRESS_PIPE_LEN;
}
- atomic_inc(&rcu_stress_count[pc]);
+ rcu_stress_local[pc]++;
n_reads_local++;
if ((++itercnt % 0x1000) == 0) {
synchronize_rcu();
}
}
- atomic_add(&n_reads, n_reads_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_reads += n_reads_local;
+ for (i = 0; i <= RCU_STRESS_PIPE_LEN; i++) {
+ rcu_stress_count[i] += rcu_stress_local[i];
+ }
+ qemu_mutex_unlock(&counts_mutex);
rcu_unregister_thread();
return NULL;
@@ -419,6 +430,7 @@ int main(int argc, char *argv[])
int nreaders = 1;
int duration = 1;
+ qemu_mutex_init(&counts_mutex);
if (argc >= 2 && argv[1][0] == '-') {
g_test_init(&argc, &argv, NULL);
if (g_test_quick()) {
diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c
index 46b5e26..4c5f62e 100644
--- a/tests/test-rcu-list.c
+++ b/tests/test-rcu-list.c
@@ -35,16 +35,15 @@
* Test variables.
*/
-long long n_reads = 0LL;
-long long n_updates = 0LL;
-long long n_reclaims = 0LL;
-long long n_nodes_removed = 0LL;
-long long n_nodes = 0LL;
-int g_test_in_charge = 0;
+static QemuMutex counts_mutex;
+static long long n_reads = 0LL;
+static long long n_updates = 0LL;
+static long long n_reclaims = 0LL;
+static long long n_nodes_removed = 0LL;
+static long long n_nodes = 0LL;
+static int g_test_in_charge = 0;
-int nthreadsrunning;
-
-char argsbuf[64];
+static int nthreadsrunning;
#define GOFLAG_INIT 0
#define GOFLAG_RUN 1
@@ -92,21 +91,21 @@ static void wait_all_threads(void)
struct list_element {
QLIST_ENTRY(list_element) entry;
struct rcu_head rcu;
- long long val;
};
static void reclaim_list_el(struct rcu_head *prcu)
{
struct list_element *el = container_of(prcu, struct list_element, rcu);
g_free(el);
- atomic_add(&n_reclaims, 1);
+ /* Accessed only from call_rcu thread. */
+ n_reclaims++;
}
static QLIST_HEAD(q_list_head, list_element) Q_list_head;
static void *rcu_q_reader(void *arg)
{
- long long j, n_reads_local = 0;
+ long long n_reads_local = 0;
struct list_element *el;
*(struct rcu_reader_data **)arg = &rcu_reader;
@@ -118,8 +117,6 @@ static void *rcu_q_reader(void *arg)
while (goflag == GOFLAG_RUN) {
rcu_read_lock();
QLIST_FOREACH_RCU(el, &Q_list_head, entry) {
- j = atomic_read(&el->val);
- (void)j;
n_reads_local++;
if (goflag == GOFLAG_STOP) {
break;
@@ -129,7 +126,9 @@ static void *rcu_q_reader(void *arg)
g_usleep(100);
}
- atomic_add(&n_reads, n_reads_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_reads += n_reads_local;
+ qemu_mutex_unlock(&counts_mutex);
return NULL;
}
@@ -137,6 +136,7 @@ static void *rcu_q_reader(void *arg)
static void *rcu_q_updater(void *arg)
{
int j, target_el;
+ long long n_nodes_local = 0;
long long n_updates_local = 0;
long long n_removed_local = 0;
struct list_element *el, *prev_el;
@@ -170,8 +170,7 @@ static void *rcu_q_updater(void *arg)
j++;
if (target_el == j) {
prev_el = g_new(struct list_element, 1);
- atomic_add(&n_nodes, 1);
- prev_el->val = atomic_read(&n_nodes);
+ n_nodes += n_nodes_local;
QLIST_INSERT_BEFORE_RCU(el, prev_el, entry);
break;
}
@@ -181,8 +180,11 @@ static void *rcu_q_updater(void *arg)
synchronize_rcu();
}
synchronize_rcu();
- atomic_add(&n_updates, n_updates_local);
- atomic_add(&n_nodes_removed, n_removed_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_nodes += n_nodes_local;
+ n_updates += n_updates_local;
+ n_nodes_removed += n_removed_local;
+ qemu_mutex_unlock(&counts_mutex);
return NULL;
}
@@ -194,10 +196,11 @@ static void rcu_qtest_init(void)
srand(time(0));
for (i = 0; i < RCU_Q_LEN; i++) {
new_el = g_new(struct list_element, 1);
- new_el->val = i;
QLIST_INSERT_HEAD_RCU(&Q_list_head, new_el, entry);
}
- atomic_add(&n_nodes, RCU_Q_LEN);
+ qemu_mutex_lock(&counts_mutex);
+ n_nodes += RCU_Q_LEN;
+ qemu_mutex_unlock(&counts_mutex);
}
static void rcu_qtest_run(int duration, int nreaders)
@@ -233,7 +236,9 @@ static void rcu_qtest(const char *test, int duration, int nreaders)
call_rcu1(&prev_el->rcu, reclaim_list_el);
n_removed_local++;
}
- atomic_add(&n_nodes_removed, n_removed_local);
+ qemu_mutex_lock(&counts_mutex);
+ n_nodes_removed += n_removed_local;
+ qemu_mutex_unlock(&counts_mutex);
synchronize_rcu();
while (n_nodes_removed > n_reclaims) {
g_usleep(100);
@@ -277,6 +282,7 @@ int main(int argc, char *argv[])
{
int duration = 0, readers = 0;
+ qemu_mutex_init(&counts_mutex);
if (argc >= 2) {
if (argv[1][0] == '-') {
g_test_init(&argc, &argv, NULL);

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Sat Mar 21 18:32:17 UTC 2015 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.3
* Patches dropped:
0044-rcutorture-fix-compilation-on-32-bi.patch
* Patches added:
0044-rcu-tests-fix-compilation-on-32-bit.patch
-------------------------------------------------------------------
Sat Mar 21 16:07:36 UTC 2015 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.3
* Patches added:
0043-fw_cfg-test-Fix-test-path-to-includ.patch
0044-rcutorture-fix-compilation-on-32-bi.patch
-------------------------------------------------------------------
Fri Mar 20 15:03:16 UTC 2015 - afaerber@suse.de

View File

@ -67,6 +67,8 @@ Patch0039: 0039-ide-fix-cmd_write_pio-when-nsectors.patch
Patch0040: 0040-ide-fix-cmd_read_pio-when-nsectors-.patch
Patch0041: 0041-ahci-Fix-sglist-offset-manipulation.patch
Patch0042: 0042-ahci-test-improve-rw-buffer-pattern.patch
Patch0043: 0043-fw_cfg-test-Fix-test-path-to-includ.patch
Patch0044: 0044-rcu-tests-fix-compilation-on-32-bit.patch
# Please do not add patches manually here, run update_git.sh.
# this is to make lint happy
Source300: qemu-rpmlintrc
@ -168,6 +170,8 @@ This sub-package contains development files for the Smartcard library.
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%build
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Sat Mar 21 18:32:13 UTC 2015 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.3
* Patches dropped:
0044-rcutorture-fix-compilation-on-32-bi.patch
* Patches added:
0044-rcu-tests-fix-compilation-on-32-bit.patch
-------------------------------------------------------------------
Sat Mar 21 16:07:32 UTC 2015 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.3
* Patches added:
0043-fw_cfg-test-Fix-test-path-to-includ.patch
0044-rcutorture-fix-compilation-on-32-bi.patch
-------------------------------------------------------------------
Fri Mar 20 15:03:16 UTC 2015 - afaerber@suse.de

View File

@ -67,6 +67,8 @@ Patch0039: 0039-ide-fix-cmd_write_pio-when-nsectors.patch
Patch0040: 0040-ide-fix-cmd_read_pio-when-nsectors-.patch
Patch0041: 0041-ahci-Fix-sglist-offset-manipulation.patch
Patch0042: 0042-ahci-test-improve-rw-buffer-pattern.patch
Patch0043: 0043-fw_cfg-test-Fix-test-path-to-includ.patch
Patch0044: 0044-rcu-tests-fix-compilation-on-32-bit.patch
# Please do not add patches manually here, run update_git.sh.
# this is to make lint happy
Source300: qemu-rpmlintrc
@ -162,6 +164,8 @@ run cross-architecture builds.
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%build
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Sat Mar 21 16:07:28 UTC 2015 - afaerber@suse.de
- Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.3
* Make test path for fw_cfg-test unique (including architecture)
0043-fw_cfg-test-Fix-test-path-to-includ.patch
* Fix rcu tests build on ppc (undefined reference to `__sync_fetch_and_add_8')
0044-rcu-tests-fix-compilation-on-32-bit.patch
- Fix typo in SeaBIOS size check
seabios_checkrom_typo.patch
-------------------------------------------------------------------
Fri Mar 20 15:03:16 UTC 2015 - afaerber@suse.de

View File

@ -54,6 +54,7 @@ Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules
Source6: ksm.service
Source7: 60-kvm.x86.rules
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch
Patch0002: 0002-XXX-work-around-SA_RESTART-race-wit.patch
@ -97,12 +98,17 @@ Patch0039: 0039-ide-fix-cmd_write_pio-when-nsectors.patch
Patch0040: 0040-ide-fix-cmd_read_pio-when-nsectors-.patch
Patch0041: 0041-ahci-Fix-sglist-offset-manipulation.patch
Patch0042: 0042-ahci-test-improve-rw-buffer-pattern.patch
Patch0043: 0043-fw_cfg-test-Fix-test-path-to-includ.patch
Patch0044: 0044-rcu-tests-fix-compilation-on-32-bit.patch
# Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue.
# SeaBIOS
%if %{build_x86_fw_from_source}
# PATCH-FIX-OPENSUSE seabios_128kb.patch brogers@suse.com -- make it fit
Patch1000: seabios_128kb.patch
# PATCH-FIX-UPSTREAM seabios_checkrom_typo.patch afaerber@suse.de -- tidy error message
Patch1001: seabios_checkrom_typo.patch
%endif
# this is to make lint happy
@ -515,10 +521,13 @@ This package provides a service file for starting and stopping KSM.
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%if %{build_x86_fw_from_source}
pushd roms/seabios
%patch1000 -p1
%patch1001 -p1
popd
# as a safeguard, delete the firmware files that we intend to build

View File

@ -54,6 +54,7 @@ Source4: qemu-kvm.1.gz
Source5: 60-kvm.rules
Source6: ksm.service
Source7: 60-kvm.x86.rules
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES
# Please do not add QEMU patches manually here.
@ -61,7 +62,10 @@ PATCH_FILES
# SeaBIOS
%if %{build_x86_fw_from_source}
# PATCH-FIX-OPENSUSE seabios_128kb.patch brogers@suse.com -- make it fit
Patch1000: seabios_128kb.patch
# PATCH-FIX-UPSTREAM seabios_checkrom_typo.patch afaerber@suse.de -- tidy error message
Patch1001: seabios_checkrom_typo.patch
%endif
# this is to make lint happy
@ -437,6 +441,7 @@ PATCH_EXEC
%if %{build_x86_fw_from_source}
pushd roms/seabios
%patch1000 -p1
%patch1001 -p1
popd
# as a safeguard, delete the firmware files that we intend to build

View File

@ -0,0 +1,32 @@
From 6b0e2bd9d914f6421c015ec28d96cf069fb8015f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20F=C3=A4rber?= <afaerber@suse.de>
Date: Thu, 19 Mar 2015 17:13:00 +0100
Subject: [PATCH] checkrom: Fix typo in error message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
increate -> increase
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
scripts/checkrom.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkrom.py b/scripts/checkrom.py
index 377277d..aced5e2 100755
--- a/scripts/checkrom.py
+++ b/scripts/checkrom.py
@@ -39,7 +39,7 @@ def main():
finalsize = 256*1024
if datasize > finalsize:
print("Error! ROM doesn't fit (%d > %d)" % (datasize, finalsize))
- print(" You have to either increate the size (CONFIG_ROM_SIZE)")
+ print(" You have to either increase the size (CONFIG_ROM_SIZE)")
print(" or turn off some features (such as hardware support not")
print(" needed) to make it fit. Trying a more recent gcc version")
print(" might work too.")
--
2.1.4