* [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches
@ 2015-11-06 0:24 Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 01/18] makefiles: use bash Andrew Jones
` (19 more replies)
0 siblings, 20 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Many of these patches were posted once. Some weren't, but anyway
almost everything is pretty trivial. I'd like to get these in, or
at least get definitive nacks on them (and then drop them) in order
to clean my queue before more patches (coming from Alex Bennée and
Chistopher are reposted).
All patches also available here
https://github.com/rhdrjones/kvm-unit-tests/commits/queue
Thanks,
drew
Alex Bennée (4):
README: add some CONTRIBUTING notes
configure: emit HOST=$host to config.mak
lib/printf: support the %u unsigned fmt field
lib/arm: add flush_tlb_page mmu function
Andrew Jones (13):
makefiles: use bash
trivial: lib: fail hard on failed mallocs
trivial: alloc: don't use 'top' outside spinlock
trivial: lib: missing extern in string.h
README: add pointer to new wiki page
run_tests: pass test name to run script
arm/run: use ACCEL to choose between kvm and tcg
run_tests: probe for max-smp
arm/arm64: allow building a single test
arm/arm64: generate map files
lib: link in linux kernel headers (uapi)
Revert "arm/arm64: import include/uapi/linux/psci.h"
arm/arm64: uart0_init: check /chosen/stdout-path
Christopher Covington (1):
arm: Fail on unknown subtest
.gitignore | 2 ++
Makefile | 6 ++--
README | 32 +++++++++++++++++++
arm/run | 43 ++++++++++++++++++++++----
arm/selftest.c | 3 ++
arm/unittests.cfg | 7 +++--
config/config-arm-common.mak | 9 +++++-
configure | 11 +++++++
lib/alloc.c | 8 +++--
lib/arm/asm/mmu.h | 11 +++++++
lib/arm/asm/page.h | 2 +-
lib/arm/asm/psci.h | 2 +-
lib/arm/asm/uapi-psci.h | 73 --------------------------------------------
lib/arm/io.c | 36 ++++++++++++++++------
lib/arm64/asm/mmu.h | 8 +++++
lib/arm64/asm/page.h | 2 +-
lib/arm64/asm/psci.h | 2 +-
lib/arm64/asm/uapi-psci.h | 1 -
lib/asm-generic/page.h | 2 +-
lib/const.h | 11 -------
lib/printf.c | 13 ++++++++
lib/string.h | 2 +-
lib/virtio-mmio.c | 7 ++---
run_tests.sh | 12 +++++++-
scripts/functions.bash | 8 +++--
scripts/mkstandalone.sh | 22 ++++++++++---
x86/unittests.cfg | 1 +
27 files changed, 210 insertions(+), 126 deletions(-)
delete mode 100644 lib/arm/asm/uapi-psci.h
delete mode 100644 lib/arm64/asm/uapi-psci.h
delete mode 100644 lib/const.h
--
2.4.3
^ permalink raw reply [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 01/18] makefiles: use bash
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:22 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs Andrew Jones
` (18 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Use bash in the makefiles, like we do in the scripts. Without
this some platforms using dash fail to execute make targets
that use bash-isms.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Makefile b/Makefile
index 0d5933474cd8c..3e60b4f8e4a57 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,6 @@
+SHELL := /bin/bash
+
ifeq ($(wildcard config.mak),)
$(error run ./configure first. See ./configure -h)
endif
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 01/18] makefiles: use bash Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-06 14:05 ` Thomas Huth
2015-11-09 20:53 ` [kvm-unit-tests PATCH v2 02/19] " Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock Andrew Jones
` (17 subsequent siblings)
19 siblings, 2 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
It's pretty safe to not even bother checking for NULL when
using malloc and friends, but if we do check, then fail
hard.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/virtio-mmio.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
index 043832299174e..1b6f0cc378b79 100644
--- a/lib/virtio-mmio.c
+++ b/lib/virtio-mmio.c
@@ -54,8 +54,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev,
vq = calloc(1, sizeof(*vq));
queue = memalign(PAGE_SIZE, VIRTIO_MMIO_QUEUE_SIZE_MIN);
- if (!vq || !queue)
- return NULL;
+ assert(vq && queue);
writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
@@ -161,9 +160,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
if (node == -FDT_ERR_NOTFOUND)
return NULL;
- vm_dev = calloc(1, sizeof(*vm_dev));
- if (!vm_dev)
- return NULL;
+ assert((vm_dev = calloc(1, sizeof(*vm_dev))) != NULL);
vm_dev->base = info.base;
vm_device_init(vm_dev);
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 01/18] makefiles: use bash Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:24 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h Andrew Jones
` (16 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
This is a fix just due to being too much of a type-A person.
I noticed the issue while reading over the function, and
decided to fix it, even though it's unlikely to be a problem
ever because top is read-mostly (like written once, then only
read, type of mostly).
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/alloc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/alloc.c b/lib/alloc.c
index ad6761430c965..34f71a337d868 100644
--- a/lib/alloc.c
+++ b/lib/alloc.c
@@ -61,15 +61,17 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
{
static bool warned = false;
phys_addr_t addr, size_orig = size;
- u64 top_safe = top;
+ u64 top_safe;
+
+ spin_lock(&lock);
+
+ top_safe = top;
if (safe && sizeof(long) == 4)
top_safe = MIN(top, 1ULL << 32);
align = MAX(align, align_min);
- spin_lock(&lock);
-
addr = ALIGN(base, align);
size += addr - base;
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (2 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:24 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page Andrew Jones
` (15 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/string.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/string.h b/lib/string.h
index 7820db86ee4e0..4e24f54d9e231 100644
--- a/lib/string.h
+++ b/lib/string.h
@@ -6,7 +6,7 @@ extern char *strcat(char *dest, const char *src);
extern char *strcpy(char *dest, const char *src);
extern int strcmp(const char *a, const char *b);
extern char *strchr(const char *s, int c);
-char *strstr(const char *haystack, const char *needle);
+extern char *strstr(const char *haystack, const char *needle);
extern void *memset(void *s, int c, size_t n);
extern void *memcpy(void *dest, const void *src, size_t n);
extern int memcmp(const void *s1, const void *s2, size_t n);
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (3 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:25 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes Andrew Jones
` (14 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
README | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README b/README
index eab5ea28f7fab..45587f2a97ec6 100644
--- a/README
+++ b/README
@@ -1,3 +1,9 @@
+Welcome to kvm-unit-tests
+
+See http://www.linux-kvm.org/page/KVM-unit-tests for a high-level
+description of this project, as well as running tests and adding
+tests HOWTOs.
+
This directory contains sources for a kvm test suite.
To create the test images do
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (4 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:25 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak Andrew Jones
` (13 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
From: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
README | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/README b/README
index 45587f2a97ec6..457bd797362cf 100644
--- a/README
+++ b/README
@@ -41,3 +41,29 @@ Directory structure:
./<ARCH>: the sources of the tests and the created objects/images
See <ARCH>/README for architecture specific documentation.
+
+CONTRIBUTING:
+=============
+
+Style
+-----
+
+Currently there is a mix of indentation styles so any changes to
+existing files should be consistent with the existing style. For new
+files:
+
+ - C: please use standard linux-with-tabs
+ - Shell: use TABs for indentation
+
+Patches
+-------
+
+Patches are welcome at the KVM mailing list <kvm@vger.kernel.org>.
+
+Please prefix messages with: [kvm-unit-tests PATCH]
+
+You can add the following to .git/config to do this automatically for you:
+
+[format]
+ subjectprefix = kvm-unit-tests PATCH
+
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (5 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:26 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script Andrew Jones
` (12 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
From: Alex Bennée <alex.bennee@linaro.org>
This is useful information for the run scripts to know, especially if
they want to drop to using TCG.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
configure | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure b/configure
index b2ad32a3e3a52..078b70ce096a6 100755
--- a/configure
+++ b/configure
@@ -7,6 +7,7 @@ ld=ld
objcopy=objcopy
ar=ar
arch=`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'`
+host=$arch
cross_prefix=
usage() {
@@ -122,6 +123,7 @@ ln -s $asm lib/asm
cat <<EOF > config.mak
PREFIX=$prefix
KERNELDIR=$(readlink -f $kerneldir)
+HOST=$host
ARCH=$arch
ARCH_NAME=$arch_name
PROCESSOR=$processor
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (6 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:34 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg Andrew Jones
` (11 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
With this $TEST_DIR/run can output test specific error messages.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
run_tests.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/run_tests.sh b/run_tests.sh
index ebb7e9fe6fdfc..80b87823c3358 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -46,7 +46,7 @@ function run()
fi
done
- cmdline="./$TEST_DIR-run $kernel -smp $smp $opts"
+ cmdline="TESTNAME=$testname ./$TEST_DIR-run $kernel -smp $smp $opts"
if [ $verbose != 0 ]; then
echo $cmdline
fi
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (7 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:30 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp Andrew Jones
` (10 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Inspired by a patch by Alex Bennée. This version uses a new
unittests.cfg variable and includes support for DRYRUN.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
arm/run | 43 +++++++++++++++++++++++++++++++++++++------
arm/unittests.cfg | 4 +++-
run_tests.sh | 3 ++-
scripts/functions.bash | 8 ++++++--
scripts/mkstandalone.sh | 15 +++++++++++----
5 files changed, 59 insertions(+), 14 deletions(-)
diff --git a/arm/run b/arm/run
index 8cc2fa2571967..4a648697d7fb5 100755
--- a/arm/run
+++ b/arm/run
@@ -7,6 +7,42 @@ fi
source config.mak
processor="$PROCESSOR"
+if [ -c /dev/kvm ]; then
+ if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
+ kvm_available=yes
+ elif [ "$HOST" = "aarch64" ]; then
+ kvm_available=yes
+ fi
+fi
+
+if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ] &&
+ [ "$DRYRUN" != "yes" ]; then
+ printf "skip $TESTNAME (kvm only)\n\n"
+ exit 2
+fi
+
+if [ -z "$ACCEL" ]; then
+ if [ "$DRYRUN" = "yes" ]; then
+ # Output kvm with tcg fallback for dryrun (when both are
+ # allowed), since the command line we output may get used
+ # elsewhere.
+ ACCEL="kvm:tcg"
+ elif [ "$kvm_available" = "yes" ]; then
+ ACCEL="kvm"
+ else
+ ACCEL="tcg"
+ fi
+fi
+
+if [ "$ARCH" = "arm64" ]; then
+ if [[ $ACCEL =~ kvm ]]; then
+ # arm64 must use '-cpu host' with kvm, and we can't use
+ # '-cpu host' with tcg, so we force kvm-only (no fallback)
+ ACCEL="kvm"
+ processor="host"
+ fi
+fi
+
qemu="${QEMU:-qemu-system-$ARCH_NAME}"
qpath=$(which $qemu 2>/dev/null)
@@ -33,15 +69,10 @@ if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
exit 2
fi
-M='-machine virt,accel=kvm:tcg'
chr_testdev='-device virtio-serial-device'
chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
-# arm64 must use '-cpu host' with kvm
-if [ "$(arch)" = "aarch64" ] && [ "$ARCH" = "arm64" ] && [ -c /dev/kvm ]; then
- processor="host"
-fi
-
+M+=",accel=$ACCEL"
command="$qemu $M -cpu $processor $chr_testdev"
command+=" -display none -serial stdio -kernel"
echo $command "$@"
diff --git a/arm/unittests.cfg b/arm/unittests.cfg
index e068a0cdd9c1f..243c13301811b 100644
--- a/arm/unittests.cfg
+++ b/arm/unittests.cfg
@@ -3,8 +3,10 @@
# file = foo.flat # Name of the flat file to be used
# smp = 2 # Number of processors the VM will use during this test
# extra_params = -append <params...> # Additional parameters used
-# arch = arm/arm64 # Only if test case is specific to one
+# arch = arm|arm64 # Only if test case is specific to one
# groups = group1 group2 # Used to identify test cases with run_tests -g ...
+# accel = kvm|tcg # Optionally specify if test must run with kvm or tcg.
+# # If not specified, then kvm will be used when available.
#
# Test that the configured number of processors (smp = <num>), and
diff --git a/run_tests.sh b/run_tests.sh
index 80b87823c3358..b1b4c541ecaea 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -20,6 +20,7 @@ function run()
local opts="$5"
local arch="$6"
local check="$7"
+ local accel="$8"
if [ -z "$testname" ]; then
return
@@ -46,7 +47,7 @@ function run()
fi
done
- cmdline="TESTNAME=$testname ./$TEST_DIR-run $kernel -smp $smp $opts"
+ cmdline="TESTNAME=$testname ACCEL=$accel ./$TEST_DIR-run $kernel -smp $smp $opts"
if [ $verbose != 0 ]; then
echo $cmdline
fi
diff --git a/scripts/functions.bash b/scripts/functions.bash
index 7ed5a517250bc..f13fe6f88f23d 100644
--- a/scripts/functions.bash
+++ b/scripts/functions.bash
@@ -10,12 +10,13 @@ function for_each_unittest()
local groups
local arch
local check
+ local accel
exec {fd}<"$unittests"
while read -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel"
testname=${BASH_REMATCH[1]}
smp=1
kernel=""
@@ -23,6 +24,7 @@ function for_each_unittest()
groups=""
arch=""
check=""
+ accel=""
elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then
kernel=$TEST_DIR/${BASH_REMATCH[1]}
elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then
@@ -35,8 +37,10 @@ function for_each_unittest()
arch=${BASH_REMATCH[1]}
elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then
check=${BASH_REMATCH[1]}
+ elif [[ $line =~ ^accel\ *=\ *(.*)$ ]]; then
+ accel=${BASH_REMATCH[1]}
fi
done
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
+ "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel"
exec {fd}<&-
}
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 4cf346ab87d24..0c39451e538c9 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -29,6 +29,7 @@ function mkstandalone()
local opts="$5"
local arch="$6"
local check="$7"
+ local accel="$8"
if [ -z "$testname" ]; then
return 1
@@ -39,7 +40,7 @@ function mkstandalone()
fi
standalone=tests/$testname
- cmdline=$(DRYRUN=yes ./$TEST_DIR-run $kernel)
+ cmdline=$(DRYRUN=yes ACCEL=$accel ./$TEST_DIR-run $kernel)
if [ $? -ne 0 ]; then
echo $cmdline
exit 1
@@ -94,10 +95,16 @@ qemu="$qemu"
if [ "\$QEMU" ]; then
qemu="\$QEMU"
fi
-cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
echo \$qemu $cmdline -smp $smp $opts
-\$qemu \$cmdline -smp $smp $opts
-ret=\$?
+
+cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
+if \$qemu \$cmdline 2>&1 | grep 'No accelerator found'; then
+ ret=2
+else
+ cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
+ \$qemu \$cmdline -smp $smp $opts
+ ret=\$?
+fi
echo Return value from qemu: \$ret
if [ \$ret -le 1 ]; then
echo PASS $testname 1>&2
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (8 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:31 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field Andrew Jones
` (9 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
KVM can be configured to only support a few vcpus. ARM and AArch64
currently have a default config of only 4. While it's nice to be
able to write tests that use the maximum recommended, nr-host-cpus,
we can't assume that nr-host-cpus == kvm-max-vcpus. This patch allows
one to put $MAX_SMP in the smp = <num> line of a unittests.cfg file.
That variable will then expand to the number of host cpus, or to the
maximum vcpus allowed by KVM.
[Inspired by a patch from Alex Bennée solving the same issue.]
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
arm/unittests.cfg | 3 ++-
run_tests.sh | 9 +++++++++
scripts/mkstandalone.sh | 9 ++++++++-
x86/unittests.cfg | 1 +
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/arm/unittests.cfg b/arm/unittests.cfg
index 243c13301811b..5e26da1a8c1bc 100644
--- a/arm/unittests.cfg
+++ b/arm/unittests.cfg
@@ -2,6 +2,7 @@
# [unittest_name]
# file = foo.flat # Name of the flat file to be used
# smp = 2 # Number of processors the VM will use during this test
+# # Use $MAX_SMP to use the maximum the host supports.
# extra_params = -append <params...> # Additional parameters used
# arch = arm|arm64 # Only if test case is specific to one
# groups = group1 group2 # Used to identify test cases with run_tests -g ...
@@ -34,6 +35,6 @@ groups = selftest
# Test SMP support
[selftest-smp]
file = selftest.flat
-smp = `getconf _NPROCESSORS_CONF`
+smp = $MAX_SMP
extra_params = -append 'smp'
groups = selftest
diff --git a/run_tests.sh b/run_tests.sh
index b1b4c541ecaea..fad22a935b007 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -98,4 +98,13 @@ while getopts "g:hv" opt; do
esac
done
+#
+# Probe for MAX_SMP
+#
+MAX_SMP=$(getconf _NPROCESSORS_CONF)
+while ./$TEST_DIR-run _NO_FILE_4Uhere_ -smp $MAX_SMP \
+ |& grep -q 'exceeds max cpus'; do
+ ((--MAX_SMP))
+done
+
for_each_unittest $config run
diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
index 0c39451e538c9..3ce244aff67b9 100755
--- a/scripts/mkstandalone.sh
+++ b/scripts/mkstandalone.sh
@@ -95,12 +95,19 @@ qemu="$qemu"
if [ "\$QEMU" ]; then
qemu="\$QEMU"
fi
+
+MAX_SMP="MAX_SMP"
echo \$qemu $cmdline -smp $smp $opts
cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
if \$qemu \$cmdline 2>&1 | grep 'No accelerator found'; then
- ret=2
+ ret=2
else
+ MAX_SMP=\`getconf _NPROCESSORS_CONF\`
+ while \$qemu \$cmdline -smp \$MAX_SMP 2>&1 | grep 'exceeds max cpus' > /dev/null; do
+ MAX_SMP=\`expr \$MAX_SMP - 1\`
+ done
+
cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
\$qemu \$cmdline -smp $smp $opts
ret=\$?
diff --git a/x86/unittests.cfg b/x86/unittests.cfg
index a38544f77c056..337cc19d3d19d 100644
--- a/x86/unittests.cfg
+++ b/x86/unittests.cfg
@@ -2,6 +2,7 @@
# [unittest_name]
# file = foo.flat # Name of the flat file to be used
# smp = 2 # Number of processors the VM will use during this test
+# # Use $MAX_SMP to use the maximum the host supports.
# extra_params = -cpu qemu64,+x2apic # Additional parameters used
# arch = i386/x86_64 # Only if the test case works only on one of them
# groups = group1 group2 # Used to identify test cases with run_tests -g ...
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (9 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:33 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function Andrew Jones
` (8 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
From: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
lib/printf.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/printf.c b/lib/printf.c
index 89308fb26b7d2..5d83605afe829 100644
--- a/lib/printf.c
+++ b/lib/printf.c
@@ -180,6 +180,19 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
break;
}
break;
+ case 'u':
+ switch (nlong) {
+ case 0:
+ print_unsigned(&s, va_arg(va, unsigned), 10, props);
+ break;
+ case 1:
+ print_unsigned(&s, va_arg(va, unsigned long), 10, props);
+ break;
+ default:
+ print_unsigned(&s, va_arg(va, unsigned long long), 10, props);
+ break;
+ }
+ break;
case 'x':
switch (nlong) {
case 0:
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (10 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:33 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest Andrew Jones
` (7 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
From: Alex Bennée <alex.bennee@linaro.org>
This introduces a new flush_tlb_page function which does exactly what
you expect. It's going to be useful for the future TLB torture test.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
lib/arm/asm/mmu.h | 11 +++++++++++
lib/arm64/asm/mmu.h | 8 ++++++++
2 files changed, 19 insertions(+)
diff --git a/lib/arm/asm/mmu.h b/lib/arm/asm/mmu.h
index c1bd01c9ee1b9..2bb0cde820f8a 100644
--- a/lib/arm/asm/mmu.h
+++ b/lib/arm/asm/mmu.h
@@ -14,8 +14,11 @@
#define PTE_AF PTE_EXT_AF
#define PTE_WBWA L_PTE_MT_WRITEALLOC
+/* See B3.18.7 TLB maintenance operations */
+
static inline void local_flush_tlb_all(void)
{
+ /* TLBIALL */
asm volatile("mcr p15, 0, %0, c8, c7, 0" :: "r" (0));
dsb();
isb();
@@ -27,6 +30,14 @@ static inline void flush_tlb_all(void)
local_flush_tlb_all();
}
+static inline void flush_tlb_page(unsigned long vaddr)
+{
+ /* TLBIMVAA */
+ asm volatile("mcr p15, 0, %0, c8, c7, 3" :: "r" (vaddr));
+ dsb();
+ isb();
+}
+
#include <asm/mmu-api.h>
#endif /* __ASMARM_MMU_H_ */
diff --git a/lib/arm64/asm/mmu.h b/lib/arm64/asm/mmu.h
index 18b4d6be18fae..3bc31c91c36f8 100644
--- a/lib/arm64/asm/mmu.h
+++ b/lib/arm64/asm/mmu.h
@@ -19,6 +19,14 @@ static inline void flush_tlb_all(void)
isb();
}
+static inline void flush_tlb_page(unsigned long vaddr)
+{
+ unsigned long page = vaddr >> 12;
+ dsb(ishst);
+ asm("tlbi vaae1is, %0" :: "r" (page));
+ dsb(ish);
+}
+
#include <asm/mmu-api.h>
#endif /* __ASMARM64_MMU_H_ */
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (11 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:34 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 14/18] arm/arm64: allow building a single test Andrew Jones
` (6 subsequent siblings)
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
From: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Andrew Jones <drjones@redhat.com>
---
arm/selftest.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arm/selftest.c b/arm/selftest.c
index fc9ec609d875e..f4a503079e464 100644
--- a/arm/selftest.c
+++ b/arm/selftest.c
@@ -376,6 +376,9 @@ int main(int argc, char **argv)
cpumask_set_cpu(0, &smp_reported);
while (!cpumask_full(&smp_reported))
cpu_relax();
+ } else {
+ printf("Unknown subtest\n");
+ abort();
}
return report_summary();
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 14/18] arm/arm64: allow building a single test
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (12 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 15/18] arm/arm64: generate map files Andrew Jones
` (5 subsequent siblings)
19 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
This is mostly useful for building new tests that don't yet (and
may never) have entries in the makefiles (config-arm*.mak). Of course
it can be used to build tests that do have entries as well, in order
to avoid building all tests, if the plan is to run just the one.
Just do 'make TEST=some-test' to use it, where "some-test" matches
the name of the source file, i.e. arm/some-test.c
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
config/config-arm-common.mak | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/config/config-arm-common.mak b/config/config-arm-common.mak
index 698555d6a676f..937d408574751 100644
--- a/config/config-arm-common.mak
+++ b/config/config-arm-common.mak
@@ -13,6 +13,11 @@ tests-common = \
$(TEST_DIR)/selftest.flat \
$(TEST_DIR)/spinlock-test.flat
+ifneq ($(TEST),)
+ tests = $(TEST_DIR)/$(TEST).flat
+ tests-common =
+endif
+
all: test_cases
##################################################################
@@ -68,5 +73,6 @@ generated_files = $(asm-offsets)
test_cases: $(generated_files) $(tests-common) $(tests)
+$(TEST_DIR)/$(TEST).elf: $(cstart.o) $(TEST_DIR)/$(TEST).o
$(TEST_DIR)/selftest.elf: $(cstart.o) $(TEST_DIR)/selftest.o
$(TEST_DIR)/spinlock-test.elf: $(cstart.o) $(TEST_DIR)/spinlock-test.o
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 15/18] arm/arm64: generate map files
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (13 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 14/18] arm/arm64: allow building a single test Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 16/18] lib: link in linux kernel headers (uapi) Andrew Jones
` (4 subsequent siblings)
19 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
.gitignore | 1 +
config/config-arm-common.mak | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 242fae475094c..acbb9055212aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*.o
*.flat
*.elf
+*.map
.pc
patches
.stgit-*
diff --git a/config/config-arm-common.mak b/config/config-arm-common.mak
index 937d408574751..54cca5663d275 100644
--- a/config/config-arm-common.mak
+++ b/config/config-arm-common.mak
@@ -55,6 +55,7 @@ FLATLIBS = $(libcflat) $(LIBFDT_archive) $(libgcc) $(libeabi)
%.elf: %.o $(FLATLIBS) arm/flat.lds
$(CC) $(LDFLAGS) -o $@ \
-Wl,-T,arm/flat.lds,--build-id=none,-Ttext=$(start_addr) \
+ -Wl,-Map,$(basename $@).map \
$(filter %.o, $^) $(FLATLIBS)
%.flat: %.elf
@@ -64,7 +65,7 @@ $(libeabi): $(eabiobjs)
$(AR) rcs $@ $^
arm_clean: libfdt_clean asm_offsets_clean
- $(RM) $(TEST_DIR)/*.{o,flat,elf} $(libeabi) $(eabiobjs) \
+ $(RM) $(TEST_DIR)/*.{o,flat,elf,map} $(libeabi) $(eabiobjs) \
$(TEST_DIR)/.*.d lib/arm/.*.d
##################################################################
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 16/18] lib: link in linux kernel headers (uapi)
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (14 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 15/18] arm/arm64: generate map files Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 17/18] Revert "arm/arm64: import include/uapi/linux/psci.h" Andrew Jones
` (3 subsequent siblings)
19 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Rather than import uapi headers, e.g. lib/arm/asm/uapi-psci.h, just
include them. For cross compilation we'll need the headers explicitly
added to the include path, but doing -I /usr/include won't work, as
some of our local header names will collide with /usr/include names.
Even just doing -I /usr/include/linux would leave too many potential
name collisions. So we create a lib/linux link, and do *not*
add -I lib/linux. Doing it this way requires code to include the uapi
headers with <linux/header.h>, putting them in their own "linux"
namespace.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
.gitignore | 1 +
Makefile | 4 ++--
configure | 9 +++++++++
lib/arm/asm/page.h | 2 +-
lib/arm/asm/psci.h | 2 +-
lib/arm64/asm/page.h | 2 +-
lib/arm64/asm/psci.h | 2 +-
lib/asm-generic/page.h | 2 +-
lib/const.h | 11 -----------
9 files changed, 17 insertions(+), 18 deletions(-)
delete mode 100644 lib/const.h
diff --git a/.gitignore b/.gitignore
index acbb9055212aa..b193802488003 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ patches
cscope.*
*.swp
/lib/asm
+/lib/linux
/config.mak
/*-run
/test.log
diff --git a/Makefile b/Makefile
index 3e60b4f8e4a57..2e76c90bdcea5 100644
--- a/Makefile
+++ b/Makefile
@@ -82,10 +82,10 @@ libfdt_clean:
$(LIBFDT_objdir)/.*.d
distclean: clean libfdt_clean
- $(RM) lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.*
+ $(RM) lib/linux lib/asm config.mak $(TEST_DIR)-run test.log msr.out cscope.*
$(RM) -r tests
-cscope: common_dirs = lib lib/libfdt lib/asm lib/asm-generic
+cscope: common_dirs = lib lib/libfdt lib/linux lib/asm lib/asm-generic
cscope:
$(RM) ./cscope.*
find -L $(TEST_DIR) lib/$(TEST_DIR) lib/$(ARCH) $(common_dirs) -maxdepth 1 \
diff --git a/configure b/configure
index 078b70ce096a6..667cc1b30e119 100755
--- a/configure
+++ b/configure
@@ -91,6 +91,15 @@ if [ -f $testdir/run ]; then
ln -fs $testdir/run $testdir-run
fi
+# link uapi/linux
+rm -f lib/linux
+if [ ! -d /usr/include/linux ]; then
+ echo kernel-headers not installed, aborting...
+ exit 1
+else
+ ln -s /usr/include/linux lib/linux
+fi
+
# check for dependent 32 bit libraries
if [ "$arch" != "arm" ]; then
cat << EOF > lib_test.c
diff --git a/lib/arm/asm/page.h b/lib/arm/asm/page.h
index 039e2ddfb8e0f..df76969964ed3 100644
--- a/lib/arm/asm/page.h
+++ b/lib/arm/asm/page.h
@@ -6,7 +6,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#include <const.h>
+#include <linux/const.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h
index c5fe78184b5ac..11ac45028d787 100644
--- a/lib/arm/asm/psci.h
+++ b/lib/arm/asm/psci.h
@@ -1,7 +1,7 @@
#ifndef _ASMARM_PSCI_H_
#define _ASMARM_PSCI_H_
#include <libcflat.h>
-#include <asm/uapi-psci.h>
+#include <linux/psci.h>
#define PSCI_INVOKE_ARG_TYPE u32
#define PSCI_FN_CPU_ON PSCI_0_2_FN_CPU_ON
diff --git a/lib/arm64/asm/page.h b/lib/arm64/asm/page.h
index 29ad1f1f720c4..3144e8efcc7ae 100644
--- a/lib/arm64/asm/page.h
+++ b/lib/arm64/asm/page.h
@@ -11,7 +11,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#include <const.h>
+#include <linux/const.h>
#define PGTABLE_LEVELS 2
#define VA_BITS 42
diff --git a/lib/arm64/asm/psci.h b/lib/arm64/asm/psci.h
index 940d61d34c05d..0a7d7c854e2b3 100644
--- a/lib/arm64/asm/psci.h
+++ b/lib/arm64/asm/psci.h
@@ -1,7 +1,7 @@
#ifndef _ASMARM64_PSCI_H_
#define _ASMARM64_PSCI_H_
#include <libcflat.h>
-#include <asm/uapi-psci.h>
+#include <linux/psci.h>
#define PSCI_INVOKE_ARG_TYPE u64
#define PSCI_FN_CPU_ON PSCI_0_2_FN64_CPU_ON
diff --git a/lib/asm-generic/page.h b/lib/asm-generic/page.h
index 66c72a62bb0f7..f872f6fa0dad2 100644
--- a/lib/asm-generic/page.h
+++ b/lib/asm-generic/page.h
@@ -9,7 +9,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.
*/
-#include "const.h"
+#include <linux/const.h>
#define PAGE_SHIFT 12
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
diff --git a/lib/const.h b/lib/const.h
deleted file mode 100644
index 5cd94d7067541..0000000000000
--- a/lib/const.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _CONST_H_
-#define _CONST_H_
-#ifdef __ASSEMBLY__
-#define _AC(X,Y) X
-#define _AT(T,X) X
-#else
-#define __AC(X,Y) (X##Y)
-#define _AC(X,Y) __AC(X,Y)
-#define _AT(T,X) ((T)(X))
-#endif
-#endif
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 17/18] Revert "arm/arm64: import include/uapi/linux/psci.h"
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (15 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 16/18] lib: link in linux kernel headers (uapi) Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path Andrew Jones
` (2 subsequent siblings)
19 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
The previous patch allows us to "unimport" this header now.
This reverts commit 7bc9f5e757bfa5c5a5202816404444fcf47a14b3.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/arm/asm/uapi-psci.h | 73 -----------------------------------------------
lib/arm64/asm/uapi-psci.h | 1 -
2 files changed, 74 deletions(-)
delete mode 100644 lib/arm/asm/uapi-psci.h
delete mode 100644 lib/arm64/asm/uapi-psci.h
diff --git a/lib/arm/asm/uapi-psci.h b/lib/arm/asm/uapi-psci.h
deleted file mode 100644
index 5c6fada2b5105..0000000000000
--- a/lib/arm/asm/uapi-psci.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef _ASMARM_UAPI_PSCI_H_
-#define _ASMARM_UAPI_PSCI_H_
-/*
- * From include/uapi/linux/psci.h
- */
-
-/* PSCI v0.2 interface */
-#define PSCI_0_2_FN_BASE 0x84000000
-#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n))
-#define PSCI_0_2_64BIT 0x40000000
-#define PSCI_0_2_FN64_BASE \
- (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT)
-#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n))
-
-#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0)
-#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1)
-#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2)
-#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3)
-#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4)
-#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5)
-#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6)
-#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7)
-#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8)
-#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9)
-
-#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1)
-#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3)
-#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4)
-#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5)
-#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7)
-
-/* PSCI v0.2 power state encoding for CPU_SUSPEND function */
-#define PSCI_0_2_POWER_STATE_ID_MASK 0xffff
-#define PSCI_0_2_POWER_STATE_ID_SHIFT 0
-#define PSCI_0_2_POWER_STATE_TYPE_SHIFT 16
-#define PSCI_0_2_POWER_STATE_TYPE_MASK \
- (0x1 << PSCI_0_2_POWER_STATE_TYPE_SHIFT)
-#define PSCI_0_2_POWER_STATE_AFFL_SHIFT 24
-#define PSCI_0_2_POWER_STATE_AFFL_MASK \
- (0x3 << PSCI_0_2_POWER_STATE_AFFL_SHIFT)
-
-/* PSCI v0.2 affinity level state returned by AFFINITY_INFO */
-#define PSCI_0_2_AFFINITY_LEVEL_ON 0
-#define PSCI_0_2_AFFINITY_LEVEL_OFF 1
-#define PSCI_0_2_AFFINITY_LEVEL_ON_PENDING 2
-
-/* PSCI v0.2 multicore support in Trusted OS returned by MIGRATE_INFO_TYPE */
-#define PSCI_0_2_TOS_UP_MIGRATE 0
-#define PSCI_0_2_TOS_UP_NO_MIGRATE 1
-#define PSCI_0_2_TOS_MP 2
-
-/* PSCI version decoding (independent of PSCI version) */
-#define PSCI_VERSION_MAJOR_SHIFT 16
-#define PSCI_VERSION_MINOR_MASK \
- ((1U << PSCI_VERSION_MAJOR_SHIFT) - 1)
-#define PSCI_VERSION_MAJOR_MASK ~PSCI_VERSION_MINOR_MASK
-#define PSCI_VERSION_MAJOR(ver) \
- (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT)
-#define PSCI_VERSION_MINOR(ver) \
- ((ver) & PSCI_VERSION_MINOR_MASK)
-
-/* PSCI return values (inclusive of all PSCI versions) */
-#define PSCI_RET_SUCCESS 0
-#define PSCI_RET_NOT_SUPPORTED -1
-#define PSCI_RET_INVALID_PARAMS -2
-#define PSCI_RET_DENIED -3
-#define PSCI_RET_ALREADY_ON -4
-#define PSCI_RET_ON_PENDING -5
-#define PSCI_RET_INTERNAL_FAILURE -6
-#define PSCI_RET_NOT_PRESENT -7
-#define PSCI_RET_DISABLED -8
-
-#endif /* _ASMARM_UAPI_PSCI_H_ */
diff --git a/lib/arm64/asm/uapi-psci.h b/lib/arm64/asm/uapi-psci.h
deleted file mode 100644
index 83d018f954e4c..0000000000000
--- a/lib/arm64/asm/uapi-psci.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../arm/asm/uapi-psci.h"
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (16 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 17/18] Revert "arm/arm64: import include/uapi/linux/psci.h" Andrew Jones
@ 2015-11-06 0:24 ` Andrew Jones
2015-11-10 16:37 ` Paolo Bonzini
2015-11-09 20:57 ` [kvm-unit-tests PATCH 19/18] don't embed code inside asserts Andrew Jones
2015-11-10 16:38 ` [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Paolo Bonzini
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-06 0:24 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov
Arguably all of uart0_init() is unnecessary, as we're pretty sure
that the address we initialize uart0_base to is correct. We go
through the motions of finding the uart anyway though, because it's
easy. It's also easy to check chosen/stdout-path first, so let's do
that too. But, just to make all this stuff is a little less unnecessary,
let's add a warning when we do actually find an address that doesn't
match our initializer.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/arm/io.c | 36 +++++++++++++++++++++++++++---------
1 file changed, 27 insertions(+), 9 deletions(-)
diff --git a/lib/arm/io.c b/lib/arm/io.c
index 8b1501886736a..a08d394e4aa1c 100644
--- a/lib/arm/io.c
+++ b/lib/arm/io.c
@@ -19,12 +19,14 @@ extern void halt(int code);
/*
* Use this guess for the pl011 base in order to make an attempt at
* having earlier printf support. We'll overwrite it with the real
- * base address that we read from the device tree later.
+ * base address that we read from the device tree later. This is
+ * the address we expect QEMU's mach-virt machine type to put in
+ * its generated device tree.
*/
-#define QEMU_MACH_VIRT_PL011_BASE 0x09000000UL
+#define UART_EARLY_BASE 0x09000000UL
static struct spinlock uart_lock;
-static volatile u8 *uart0_base = (u8 *)QEMU_MACH_VIRT_PL011_BASE;
+static volatile u8 *uart0_base = (u8 *)UART_EARLY_BASE;
static void uart0_init(void)
{
@@ -32,16 +34,32 @@ static void uart0_init(void)
struct dt_pbus_reg base;
int ret;
- ret = dt_pbus_get_base_compatible(compatible, &base);
- assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
+ ret = dt_get_default_console_node();
+ assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND);
- if (ret) {
- printf("%s: %s not found in the device tree, aborting...\n",
- __func__, compatible);
- abort();
+ if (ret == -FDT_ERR_NOTFOUND) {
+
+ ret = dt_pbus_get_base_compatible(compatible, &base);
+ assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
+
+ if (ret) {
+ printf("%s: %s not found in the device tree, "
+ "aborting...\n",
+ __func__, compatible);
+ abort();
+ }
+
+ } else {
+ assert(dt_pbus_translate_node(ret, 0, &base) == 0);
}
uart0_base = ioremap(base.addr, base.size);
+
+ if (uart0_base != (u8 *)UART_EARLY_BASE) {
+ printf("WARNING: early print support may not work. "
+ "Found uart at %p, but early base is %p.\n",
+ uart0_base, (u8 *)UART_EARLY_BASE);
+ }
}
void io_init(void)
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs
2015-11-06 0:24 ` [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs Andrew Jones
@ 2015-11-06 14:05 ` Thomas Huth
2015-11-07 1:02 ` Andrew Jones
2015-11-09 20:53 ` [kvm-unit-tests PATCH v2 02/19] " Andrew Jones
1 sibling, 1 reply; 44+ messages in thread
From: Thomas Huth @ 2015-11-06 14:05 UTC (permalink / raw)
To: Andrew Jones, pbonzini, kvm; +Cc: alex.bennee, cov
On 06/11/15 01:24, Andrew Jones wrote:
> It's pretty safe to not even bother checking for NULL when
> using malloc and friends, but if we do check, then fail
> hard.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/virtio-mmio.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
> index 043832299174e..1b6f0cc378b79 100644
> --- a/lib/virtio-mmio.c
> +++ b/lib/virtio-mmio.c
...
> @@ -161,9 +160,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
> if (node == -FDT_ERR_NOTFOUND)
> return NULL;
>
> - vm_dev = calloc(1, sizeof(*vm_dev));
> - if (!vm_dev)
> - return NULL;
> + assert((vm_dev = calloc(1, sizeof(*vm_dev))) != NULL);
Could you maybe write that as two statements? assert() is classically a
macro which could also be disabled, so if somebody introduces a switch
to "#define assert(...) /*nothing*/" in the future, that calloc call
would be completely gone!
Thomas
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs
2015-11-06 14:05 ` Thomas Huth
@ 2015-11-07 1:02 ` Andrew Jones
0 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-07 1:02 UTC (permalink / raw)
To: Thomas Huth; +Cc: pbonzini, kvm, alex.bennee, cov
On Fri, Nov 06, 2015 at 03:05:41PM +0100, Thomas Huth wrote:
> On 06/11/15 01:24, Andrew Jones wrote:
> > It's pretty safe to not even bother checking for NULL when
> > using malloc and friends, but if we do check, then fail
> > hard.
> >
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> > lib/virtio-mmio.c | 7 ++-----
> > 1 file changed, 2 insertions(+), 5 deletions(-)
> >
> > diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
> > index 043832299174e..1b6f0cc378b79 100644
> > --- a/lib/virtio-mmio.c
> > +++ b/lib/virtio-mmio.c
> ...
> > @@ -161,9 +160,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
> > if (node == -FDT_ERR_NOTFOUND)
> > return NULL;
> >
> > - vm_dev = calloc(1, sizeof(*vm_dev));
> > - if (!vm_dev)
> > - return NULL;
> > + assert((vm_dev = calloc(1, sizeof(*vm_dev))) != NULL);
>
> Could you maybe write that as two statements? assert() is classically a
> macro which could also be disabled, so if somebody introduces a switch
> to "#define assert(...) /*nothing*/" in the future, that calloc call
> would be completely gone!
That's a good point, and I'm happy to change this one. Unfortunately
I've done things like this several times before, so if we decide to
allow assert to be a noop, then we'll need to change those other places
as well. I think it's pretty unlikely we ever will want to make it a
noop for kvm-unit-tests though.
Thanks,
drew
>
> Thomas
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH v2 02/19] trivial: lib: fail hard on failed mallocs
2015-11-06 0:24 ` [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs Andrew Jones
2015-11-06 14:05 ` Thomas Huth
@ 2015-11-09 20:53 ` Andrew Jones
2015-11-09 20:55 ` Thomas Huth
2015-11-10 16:23 ` Paolo Bonzini
1 sibling, 2 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-09 20:53 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov, thuth
It's pretty safe to not even bother checking for NULL when
using malloc and friends, but if we do check, then fail
hard.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
v2: no code in asserts [Thomas Huth]
lib/virtio-mmio.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
index 043832299174e..5ccbd193a264a 100644
--- a/lib/virtio-mmio.c
+++ b/lib/virtio-mmio.c
@@ -54,8 +54,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev,
vq = calloc(1, sizeof(*vq));
queue = memalign(PAGE_SIZE, VIRTIO_MMIO_QUEUE_SIZE_MIN);
- if (!vq || !queue)
- return NULL;
+ assert(vq && queue);
writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
@@ -162,8 +161,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
return NULL;
vm_dev = calloc(1, sizeof(*vm_dev));
- if (!vm_dev)
- return NULL;
+ assert(vm_dev != NULL);
vm_dev->base = info.base;
vm_device_init(vm_dev);
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH v2 02/19] trivial: lib: fail hard on failed mallocs
2015-11-09 20:53 ` [kvm-unit-tests PATCH v2 02/19] " Andrew Jones
@ 2015-11-09 20:55 ` Thomas Huth
2015-11-10 16:23 ` Paolo Bonzini
1 sibling, 0 replies; 44+ messages in thread
From: Thomas Huth @ 2015-11-09 20:55 UTC (permalink / raw)
To: Andrew Jones, pbonzini, kvm; +Cc: alex.bennee, cov
On 09/11/15 21:53, Andrew Jones wrote:
> It's pretty safe to not even bother checking for NULL when
> using malloc and friends, but if we do check, then fail
> hard.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> v2: no code in asserts [Thomas Huth]
>
> lib/virtio-mmio.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
> index 043832299174e..5ccbd193a264a 100644
> --- a/lib/virtio-mmio.c
> +++ b/lib/virtio-mmio.c
> @@ -54,8 +54,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev,
>
> vq = calloc(1, sizeof(*vq));
> queue = memalign(PAGE_SIZE, VIRTIO_MMIO_QUEUE_SIZE_MIN);
> - if (!vq || !queue)
> - return NULL;
> + assert(vq && queue);
>
> writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
>
> @@ -162,8 +161,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
> return NULL;
>
> vm_dev = calloc(1, sizeof(*vm_dev));
> - if (!vm_dev)
> - return NULL;
> + assert(vm_dev != NULL);
>
> vm_dev->base = info.base;
> vm_device_init(vm_dev);
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 44+ messages in thread
* [kvm-unit-tests PATCH 19/18] don't embed code inside asserts
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (17 preceding siblings ...)
2015-11-06 0:24 ` [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path Andrew Jones
@ 2015-11-09 20:57 ` Andrew Jones
2015-11-10 16:37 ` Paolo Bonzini
2015-11-10 16:38 ` [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Paolo Bonzini
19 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-09 20:57 UTC (permalink / raw)
To: pbonzini, kvm; +Cc: alex.bennee, cov, thuth
assert() is classically a macro which could also be disabled, so if
somebody introduces a switch to "#define assert(...) /*nothing*/" in
the future, we'd lose code.
Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/arm/setup.c | 19 ++++++++++++++-----
lib/arm/smp.c | 4 +++-
lib/virtio-mmio.c | 4 +++-
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/lib/arm/setup.c b/lib/arm/setup.c
index 02e81a689a8a6..da6edc1f9d8ff 100644
--- a/lib/arm/setup.c
+++ b/lib/arm/setup.c
@@ -39,8 +39,11 @@ static void cpu_set(int fdtnode __unused, u32 regval, void *info __unused)
static void cpu_init(void)
{
+ int ret;
+
nr_cpus = 0;
- assert(dt_for_each_cpu_node(cpu_set, NULL) == 0);
+ ret = dt_for_each_cpu_node(cpu_set, NULL);
+ assert(ret == 0);
set_cpu_online(0, true);
}
@@ -49,8 +52,10 @@ static void mem_init(phys_addr_t freemem_start)
/* we only expect one membank to be defined in the DT */
struct dt_pbus_reg regs[1];
phys_addr_t mem_start, mem_end;
+ int ret;
- assert(dt_get_memory_params(regs, 1));
+ ret = dt_get_memory_params(regs, 1);
+ assert(ret != 0);
mem_start = regs[0].addr;
mem_end = mem_start + regs[0].size;
@@ -71,14 +76,17 @@ void setup(const void *fdt)
{
const char *bootargs;
u32 fdt_size;
+ int ret;
/*
* Move the fdt to just above the stack. The free memory
* then starts just after the fdt.
*/
fdt_size = fdt_totalsize(fdt);
- assert(fdt_move(fdt, &stacktop, fdt_size) == 0);
- assert(dt_init(&stacktop) == 0);
+ ret = fdt_move(fdt, &stacktop, fdt_size);
+ assert(ret == 0);
+ ret = dt_init(&stacktop);
+ assert(ret == 0);
mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
io_init();
@@ -86,6 +94,7 @@ void setup(const void *fdt)
thread_info_init(current_thread_info(), 0);
- assert(dt_get_bootargs(&bootargs) == 0);
+ ret = dt_get_bootargs(&bootargs);
+ assert(ret == 0);
setup_args(bootargs);
}
diff --git a/lib/arm/smp.c b/lib/arm/smp.c
index 3cfc6d5ddedd0..390c53b5d84c3 100644
--- a/lib/arm/smp.c
+++ b/lib/arm/smp.c
@@ -44,11 +44,13 @@ secondary_entry_fn secondary_cinit(void)
void smp_boot_secondary(int cpu, secondary_entry_fn entry)
{
void *stack_base = memalign(THREAD_SIZE, THREAD_SIZE);
+ int ret;
secondary_data.stack = stack_base + THREAD_START_SP;
secondary_data.entry = entry;
mmu_mark_disabled(cpu);
- assert(cpu_psci_cpu_boot(cpu) == 0);
+ ret = cpu_psci_cpu_boot(cpu);
+ assert(ret == 0);
while (!cpu_online(cpu))
wfe();
diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
index 5ccbd193a264a..fa8dd5b8d484d 100644
--- a/lib/virtio-mmio.c
+++ b/lib/virtio-mmio.c
@@ -123,10 +123,12 @@ static int vm_dt_match(const struct dt_device *dev, int fdtnode)
struct vm_dt_info *info = (struct vm_dt_info *)dev->info;
struct dt_pbus_reg base;
u32 magic;
+ int ret;
dt_device_bind_node((struct dt_device *)dev, fdtnode);
- assert(dt_pbus_get_base(dev, &base) == 0);
+ ret = dt_pbus_get_base(dev, &base);
+ assert(ret == 0);
info->base = ioremap(base.addr, base.size);
magic = readl(info->base + VIRTIO_MMIO_MAGIC_VALUE);
--
2.4.3
^ permalink raw reply related [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 01/18] makefiles: use bash
2015-11-06 0:24 ` [kvm-unit-tests PATCH 01/18] makefiles: use bash Andrew Jones
@ 2015-11-10 16:22 ` Paolo Bonzini
2015-11-10 16:37 ` Andrew Jones
0 siblings, 1 reply; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:22 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Use bash in the makefiles, like we do in the scripts. Without
> this some platforms using dash fail to execute make targets
> that use bash-isms.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> Makefile | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 0d5933474cd8c..3e60b4f8e4a57 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,4 +1,6 @@
>
> +SHELL := /bin/bash
> +
> ifeq ($(wildcard config.mak),)
> $(error run ./configure first. See ./configure -h)
> endif
>
Which bash-isms are actually present?
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH v2 02/19] trivial: lib: fail hard on failed mallocs
2015-11-09 20:53 ` [kvm-unit-tests PATCH v2 02/19] " Andrew Jones
2015-11-09 20:55 ` Thomas Huth
@ 2015-11-10 16:23 ` Paolo Bonzini
1 sibling, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:23 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov, thuth
On 09/11/2015 21:53, Andrew Jones wrote:
> It's pretty safe to not even bother checking for NULL when
> using malloc and friends, but if we do check, then fail
> hard.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> v2: no code in asserts [Thomas Huth]
>
> lib/virtio-mmio.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
> index 043832299174e..5ccbd193a264a 100644
> --- a/lib/virtio-mmio.c
> +++ b/lib/virtio-mmio.c
> @@ -54,8 +54,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev,
>
> vq = calloc(1, sizeof(*vq));
> queue = memalign(PAGE_SIZE, VIRTIO_MMIO_QUEUE_SIZE_MIN);
> - if (!vq || !queue)
> - return NULL;
> + assert(vq && queue);
>
> writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL);
>
> @@ -162,8 +161,7 @@ static struct virtio_device *virtio_mmio_dt_bind(u32 devid)
> return NULL;
>
> vm_dev = calloc(1, sizeof(*vm_dev));
> - if (!vm_dev)
> - return NULL;
> + assert(vm_dev != NULL);
>
> vm_dev->base = info.base;
> vm_device_init(vm_dev);
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock
2015-11-06 0:24 ` [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock Andrew Jones
@ 2015-11-10 16:24 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:24 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> This is a fix just due to being too much of a type-A person.
> I noticed the issue while reading over the function, and
> decided to fix it, even though it's unlikely to be a problem
> ever because top is read-mostly (like written once, then only
> read, type of mostly).
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/alloc.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/lib/alloc.c b/lib/alloc.c
> index ad6761430c965..34f71a337d868 100644
> --- a/lib/alloc.c
> +++ b/lib/alloc.c
> @@ -61,15 +61,17 @@ static phys_addr_t phys_alloc_aligned_safe(phys_addr_t size,
> {
> static bool warned = false;
> phys_addr_t addr, size_orig = size;
> - u64 top_safe = top;
> + u64 top_safe;
> +
> + spin_lock(&lock);
> +
> + top_safe = top;
>
> if (safe && sizeof(long) == 4)
> top_safe = MIN(top, 1ULL << 32);
>
> align = MAX(align, align_min);
>
> - spin_lock(&lock);
> -
> addr = ALIGN(base, align);
> size += addr - base;
>
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h
2015-11-06 0:24 ` [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h Andrew Jones
@ 2015-11-10 16:24 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:24 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/string.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/string.h b/lib/string.h
> index 7820db86ee4e0..4e24f54d9e231 100644
> --- a/lib/string.h
> +++ b/lib/string.h
> @@ -6,7 +6,7 @@ extern char *strcat(char *dest, const char *src);
> extern char *strcpy(char *dest, const char *src);
> extern int strcmp(const char *a, const char *b);
> extern char *strchr(const char *s, int c);
> -char *strstr(const char *haystack, const char *needle);
> +extern char *strstr(const char *haystack, const char *needle);
> extern void *memset(void *s, int c, size_t n);
> extern void *memcpy(void *dest, const void *src, size_t n);
> extern int memcmp(const void *s1, const void *s2, size_t n);
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page
2015-11-06 0:24 ` [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page Andrew Jones
@ 2015-11-10 16:25 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:25 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> README | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/README b/README
> index eab5ea28f7fab..45587f2a97ec6 100644
> --- a/README
> +++ b/README
> @@ -1,3 +1,9 @@
> +Welcome to kvm-unit-tests
> +
> +See http://www.linux-kvm.org/page/KVM-unit-tests for a high-level
> +description of this project, as well as running tests and adding
> +tests HOWTOs.
> +
> This directory contains sources for a kvm test suite.
>
> To create the test images do
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes
2015-11-06 0:24 ` [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes Andrew Jones
@ 2015-11-10 16:25 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:25 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
> README | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/README b/README
> index 45587f2a97ec6..457bd797362cf 100644
> --- a/README
> +++ b/README
> @@ -41,3 +41,29 @@ Directory structure:
> ./<ARCH>: the sources of the tests and the created objects/images
>
> See <ARCH>/README for architecture specific documentation.
> +
> +CONTRIBUTING:
> +=============
> +
> +Style
> +-----
> +
> +Currently there is a mix of indentation styles so any changes to
> +existing files should be consistent with the existing style. For new
> +files:
> +
> + - C: please use standard linux-with-tabs
> + - Shell: use TABs for indentation
Which should be changed :)
> +Patches
> +-------
> +
> +Patches are welcome at the KVM mailing list <kvm@vger.kernel.org>.
> +
> +Please prefix messages with: [kvm-unit-tests PATCH]
> +
> +You can add the following to .git/config to do this automatically for you:
> +
> +[format]
> + subjectprefix = kvm-unit-tests PATCH
> +
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak
2015-11-06 0:24 ` [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak Andrew Jones
@ 2015-11-10 16:26 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:26 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
>
> This is useful information for the run scripts to know, especially if
> they want to drop to using TCG.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
> configure | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/configure b/configure
> index b2ad32a3e3a52..078b70ce096a6 100755
> --- a/configure
> +++ b/configure
> @@ -7,6 +7,7 @@ ld=ld
> objcopy=objcopy
> ar=ar
> arch=`uname -m | sed -e s/i.86/i386/ | sed -e 's/arm.*/arm/'`
> +host=$arch
> cross_prefix=
>
> usage() {
> @@ -122,6 +123,7 @@ ln -s $asm lib/asm
> cat <<EOF > config.mak
> PREFIX=$prefix
> KERNELDIR=$(readlink -f $kerneldir)
> +HOST=$host
> ARCH=$arch
> ARCH_NAME=$arch_name
> PROCESSOR=$processor
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg
2015-11-06 0:24 ` [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg Andrew Jones
@ 2015-11-10 16:30 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:30 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Inspired by a patch by Alex Bennée. This version uses a new
> unittests.cfg variable and includes support for DRYRUN.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> arm/run | 43 +++++++++++++++++++++++++++++++++++++------
> arm/unittests.cfg | 4 +++-
> run_tests.sh | 3 ++-
> scripts/functions.bash | 8 ++++++--
> scripts/mkstandalone.sh | 15 +++++++++++----
> 5 files changed, 59 insertions(+), 14 deletions(-)
>
> diff --git a/arm/run b/arm/run
> index 8cc2fa2571967..4a648697d7fb5 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -7,6 +7,42 @@ fi
> source config.mak
> processor="$PROCESSOR"
>
> +if [ -c /dev/kvm ]; then
> + if [ "$HOST" = "arm" ] && [ "$ARCH" = "arm" ]; then
> + kvm_available=yes
> + elif [ "$HOST" = "aarch64" ]; then
> + kvm_available=yes
> + fi
> +fi
> +
> +if [ "$ACCEL" = "kvm" ] && [ "$kvm_available" != "yes" ] &&
> + [ "$DRYRUN" != "yes" ]; then
> + printf "skip $TESTNAME (kvm only)\n\n"
> + exit 2
> +fi
> +
> +if [ -z "$ACCEL" ]; then
> + if [ "$DRYRUN" = "yes" ]; then
> + # Output kvm with tcg fallback for dryrun (when both are
> + # allowed), since the command line we output may get used
> + # elsewhere.
> + ACCEL="kvm:tcg"
> + elif [ "$kvm_available" = "yes" ]; then
> + ACCEL="kvm"
> + else
> + ACCEL="tcg"
> + fi
> +fi
> +
> +if [ "$ARCH" = "arm64" ]; then
> + if [[ $ACCEL =~ kvm ]]; then
> + # arm64 must use '-cpu host' with kvm, and we can't use
> + # '-cpu host' with tcg, so we force kvm-only (no fallback)
> + ACCEL="kvm"
> + processor="host"
> + fi
> +fi
> +
> qemu="${QEMU:-qemu-system-$ARCH_NAME}"
> qpath=$(which $qemu 2>/dev/null)
>
> @@ -33,15 +69,10 @@ if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
> exit 2
> fi
>
> -M='-machine virt,accel=kvm:tcg'
> chr_testdev='-device virtio-serial-device'
> chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
>
> -# arm64 must use '-cpu host' with kvm
> -if [ "$(arch)" = "aarch64" ] && [ "$ARCH" = "arm64" ] && [ -c /dev/kvm ]; then
> - processor="host"
> -fi
> -
> +M+=",accel=$ACCEL"
> command="$qemu $M -cpu $processor $chr_testdev"
> command+=" -display none -serial stdio -kernel"
> echo $command "$@"
> diff --git a/arm/unittests.cfg b/arm/unittests.cfg
> index e068a0cdd9c1f..243c13301811b 100644
> --- a/arm/unittests.cfg
> +++ b/arm/unittests.cfg
> @@ -3,8 +3,10 @@
> # file = foo.flat # Name of the flat file to be used
> # smp = 2 # Number of processors the VM will use during this test
> # extra_params = -append <params...> # Additional parameters used
> -# arch = arm/arm64 # Only if test case is specific to one
> +# arch = arm|arm64 # Only if test case is specific to one
> # groups = group1 group2 # Used to identify test cases with run_tests -g ...
> +# accel = kvm|tcg # Optionally specify if test must run with kvm or tcg.
> +# # If not specified, then kvm will be used when available.
>
> #
> # Test that the configured number of processors (smp = <num>), and
> diff --git a/run_tests.sh b/run_tests.sh
> index 80b87823c3358..b1b4c541ecaea 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -20,6 +20,7 @@ function run()
> local opts="$5"
> local arch="$6"
> local check="$7"
> + local accel="$8"
>
> if [ -z "$testname" ]; then
> return
> @@ -46,7 +47,7 @@ function run()
> fi
> done
>
> - cmdline="TESTNAME=$testname ./$TEST_DIR-run $kernel -smp $smp $opts"
> + cmdline="TESTNAME=$testname ACCEL=$accel ./$TEST_DIR-run $kernel -smp $smp $opts"
> if [ $verbose != 0 ]; then
> echo $cmdline
> fi
> diff --git a/scripts/functions.bash b/scripts/functions.bash
> index 7ed5a517250bc..f13fe6f88f23d 100644
> --- a/scripts/functions.bash
> +++ b/scripts/functions.bash
> @@ -10,12 +10,13 @@ function for_each_unittest()
> local groups
> local arch
> local check
> + local accel
>
> exec {fd}<"$unittests"
>
> while read -u $fd line; do
> if [[ "$line" =~ ^\[(.*)\]$ ]]; then
> - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
> + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel"
> testname=${BASH_REMATCH[1]}
> smp=1
> kernel=""
> @@ -23,6 +24,7 @@ function for_each_unittest()
> groups=""
> arch=""
> check=""
> + accel=""
> elif [[ $line =~ ^file\ *=\ *(.*)$ ]]; then
> kernel=$TEST_DIR/${BASH_REMATCH[1]}
> elif [[ $line =~ ^smp\ *=\ *(.*)$ ]]; then
> @@ -35,8 +37,10 @@ function for_each_unittest()
> arch=${BASH_REMATCH[1]}
> elif [[ $line =~ ^check\ *=\ *(.*)$ ]]; then
> check=${BASH_REMATCH[1]}
> + elif [[ $line =~ ^accel\ *=\ *(.*)$ ]]; then
> + accel=${BASH_REMATCH[1]}
> fi
> done
> - "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check"
> + "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel"
> exec {fd}<&-
> }
> diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
> index 4cf346ab87d24..0c39451e538c9 100755
> --- a/scripts/mkstandalone.sh
> +++ b/scripts/mkstandalone.sh
> @@ -29,6 +29,7 @@ function mkstandalone()
> local opts="$5"
> local arch="$6"
> local check="$7"
> + local accel="$8"
>
> if [ -z "$testname" ]; then
> return 1
> @@ -39,7 +40,7 @@ function mkstandalone()
> fi
>
> standalone=tests/$testname
> - cmdline=$(DRYRUN=yes ./$TEST_DIR-run $kernel)
> + cmdline=$(DRYRUN=yes ACCEL=$accel ./$TEST_DIR-run $kernel)
> if [ $? -ne 0 ]; then
> echo $cmdline
> exit 1
> @@ -94,10 +95,16 @@ qemu="$qemu"
> if [ "\$QEMU" ]; then
> qemu="\$QEMU"
> fi
> -cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
> echo \$qemu $cmdline -smp $smp $opts
> -\$qemu \$cmdline -smp $smp $opts
> -ret=\$?
> +
> +cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
> +if \$qemu \$cmdline 2>&1 | grep 'No accelerator found'; then
> + ret=2
> +else
> + cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
> + \$qemu \$cmdline -smp $smp $opts
> + ret=\$?
> +fi
> echo Return value from qemu: \$ret
> if [ \$ret -le 1 ]; then
> echo PASS $testname 1>&2
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp
2015-11-06 0:24 ` [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp Andrew Jones
@ 2015-11-10 16:31 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:31 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> KVM can be configured to only support a few vcpus. ARM and AArch64
> currently have a default config of only 4. While it's nice to be
> able to write tests that use the maximum recommended, nr-host-cpus,
> we can't assume that nr-host-cpus == kvm-max-vcpus. This patch allows
> one to put $MAX_SMP in the smp = <num> line of a unittests.cfg file.
> That variable will then expand to the number of host cpus, or to the
> maximum vcpus allowed by KVM.
>
> [Inspired by a patch from Alex Bennée solving the same issue.]
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> arm/unittests.cfg | 3 ++-
> run_tests.sh | 9 +++++++++
> scripts/mkstandalone.sh | 9 ++++++++-
> x86/unittests.cfg | 1 +
> 4 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/arm/unittests.cfg b/arm/unittests.cfg
> index 243c13301811b..5e26da1a8c1bc 100644
> --- a/arm/unittests.cfg
> +++ b/arm/unittests.cfg
> @@ -2,6 +2,7 @@
> # [unittest_name]
> # file = foo.flat # Name of the flat file to be used
> # smp = 2 # Number of processors the VM will use during this test
> +# # Use $MAX_SMP to use the maximum the host supports.
> # extra_params = -append <params...> # Additional parameters used
> # arch = arm|arm64 # Only if test case is specific to one
> # groups = group1 group2 # Used to identify test cases with run_tests -g ...
> @@ -34,6 +35,6 @@ groups = selftest
> # Test SMP support
> [selftest-smp]
> file = selftest.flat
> -smp = `getconf _NPROCESSORS_CONF`
> +smp = $MAX_SMP
> extra_params = -append 'smp'
> groups = selftest
> diff --git a/run_tests.sh b/run_tests.sh
> index b1b4c541ecaea..fad22a935b007 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -98,4 +98,13 @@ while getopts "g:hv" opt; do
> esac
> done
>
> +#
> +# Probe for MAX_SMP
> +#
> +MAX_SMP=$(getconf _NPROCESSORS_CONF)
> +while ./$TEST_DIR-run _NO_FILE_4Uhere_ -smp $MAX_SMP \
> + |& grep -q 'exceeds max cpus'; do
> + ((--MAX_SMP))
> +done
> +
> for_each_unittest $config run
> diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh
> index 0c39451e538c9..3ce244aff67b9 100755
> --- a/scripts/mkstandalone.sh
> +++ b/scripts/mkstandalone.sh
> @@ -95,12 +95,19 @@ qemu="$qemu"
> if [ "\$QEMU" ]; then
> qemu="\$QEMU"
> fi
> +
> +MAX_SMP="MAX_SMP"
> echo \$qemu $cmdline -smp $smp $opts
>
> cmdline="\`echo '$cmdline' | sed s%$kernel%_NO_FILE_4Uhere_%\`"
> if \$qemu \$cmdline 2>&1 | grep 'No accelerator found'; then
> - ret=2
> + ret=2
> else
> + MAX_SMP=\`getconf _NPROCESSORS_CONF\`
> + while \$qemu \$cmdline -smp \$MAX_SMP 2>&1 | grep 'exceeds max cpus' > /dev/null; do
> + MAX_SMP=\`expr \$MAX_SMP - 1\`
> + done
> +
> cmdline="\`echo '$cmdline' | sed s%$kernel%\$bin%\`"
> \$qemu \$cmdline -smp $smp $opts
> ret=\$?
> diff --git a/x86/unittests.cfg b/x86/unittests.cfg
> index a38544f77c056..337cc19d3d19d 100644
> --- a/x86/unittests.cfg
> +++ b/x86/unittests.cfg
> @@ -2,6 +2,7 @@
> # [unittest_name]
> # file = foo.flat # Name of the flat file to be used
> # smp = 2 # Number of processors the VM will use during this test
> +# # Use $MAX_SMP to use the maximum the host supports.
> # extra_params = -cpu qemu64,+x2apic # Additional parameters used
> # arch = i386/x86_64 # Only if the test case works only on one of them
> # groups = group1 group2 # Used to identify test cases with run_tests -g ...
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field
2015-11-06 0:24 ` [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field Andrew Jones
@ 2015-11-10 16:33 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:33 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/printf.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/lib/printf.c b/lib/printf.c
> index 89308fb26b7d2..5d83605afe829 100644
> --- a/lib/printf.c
> +++ b/lib/printf.c
> @@ -180,6 +180,19 @@ int vsnprintf(char *buf, int size, const char *fmt, va_list va)
> break;
> }
> break;
> + case 'u':
> + switch (nlong) {
> + case 0:
> + print_unsigned(&s, va_arg(va, unsigned), 10, props);
> + break;
> + case 1:
> + print_unsigned(&s, va_arg(va, unsigned long), 10, props);
> + break;
> + default:
> + print_unsigned(&s, va_arg(va, unsigned long long), 10, props);
> + break;
> + }
> + break;
> case 'x':
> switch (nlong) {
> case 0:
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function
2015-11-06 0:24 ` [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function Andrew Jones
@ 2015-11-10 16:33 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:33 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> From: Alex Bennée <alex.bennee@linaro.org>
>
> This introduces a new flush_tlb_page function which does exactly what
> you expect. It's going to be useful for the future TLB torture test.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/arm/asm/mmu.h | 11 +++++++++++
> lib/arm64/asm/mmu.h | 8 ++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/lib/arm/asm/mmu.h b/lib/arm/asm/mmu.h
> index c1bd01c9ee1b9..2bb0cde820f8a 100644
> --- a/lib/arm/asm/mmu.h
> +++ b/lib/arm/asm/mmu.h
> @@ -14,8 +14,11 @@
> #define PTE_AF PTE_EXT_AF
> #define PTE_WBWA L_PTE_MT_WRITEALLOC
>
> +/* See B3.18.7 TLB maintenance operations */
> +
> static inline void local_flush_tlb_all(void)
> {
> + /* TLBIALL */
> asm volatile("mcr p15, 0, %0, c8, c7, 0" :: "r" (0));
> dsb();
> isb();
> @@ -27,6 +30,14 @@ static inline void flush_tlb_all(void)
> local_flush_tlb_all();
> }
>
> +static inline void flush_tlb_page(unsigned long vaddr)
> +{
> + /* TLBIMVAA */
> + asm volatile("mcr p15, 0, %0, c8, c7, 3" :: "r" (vaddr));
> + dsb();
> + isb();
> +}
> +
> #include <asm/mmu-api.h>
>
> #endif /* __ASMARM_MMU_H_ */
> diff --git a/lib/arm64/asm/mmu.h b/lib/arm64/asm/mmu.h
> index 18b4d6be18fae..3bc31c91c36f8 100644
> --- a/lib/arm64/asm/mmu.h
> +++ b/lib/arm64/asm/mmu.h
> @@ -19,6 +19,14 @@ static inline void flush_tlb_all(void)
> isb();
> }
>
> +static inline void flush_tlb_page(unsigned long vaddr)
> +{
> + unsigned long page = vaddr >> 12;
> + dsb(ishst);
> + asm("tlbi vaae1is, %0" :: "r" (page));
> + dsb(ish);
> +}
> +
> #include <asm/mmu-api.h>
>
> #endif /* __ASMARM64_MMU_H_ */
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest
2015-11-06 0:24 ` [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest Andrew Jones
@ 2015-11-10 16:34 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:34 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> From: Christopher Covington <cov@codeaurora.org>
>
> Signed-off-by: Christopher Covington <cov@codeaurora.org>
> Reviewed-by: Andrew Jones <drjones@redhat.com>
> ---
> arm/selftest.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arm/selftest.c b/arm/selftest.c
> index fc9ec609d875e..f4a503079e464 100644
> --- a/arm/selftest.c
> +++ b/arm/selftest.c
> @@ -376,6 +376,9 @@ int main(int argc, char **argv)
> cpumask_set_cpu(0, &smp_reported);
> while (!cpumask_full(&smp_reported))
> cpu_relax();
> + } else {
> + printf("Unknown subtest\n");
> + abort();
> }
>
> return report_summary();
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script
2015-11-06 0:24 ` [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script Andrew Jones
@ 2015-11-10 16:34 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:34 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> With this $TEST_DIR/run can output test specific error messages.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> run_tests.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/run_tests.sh b/run_tests.sh
> index ebb7e9fe6fdfc..80b87823c3358 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -46,7 +46,7 @@ function run()
> fi
> done
>
> - cmdline="./$TEST_DIR-run $kernel -smp $smp $opts"
> + cmdline="TESTNAME=$testname ./$TEST_DIR-run $kernel -smp $smp $opts"
> if [ $verbose != 0 ]; then
> echo $cmdline
> fi
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path
2015-11-06 0:24 ` [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path Andrew Jones
@ 2015-11-10 16:37 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:37 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Arguably all of uart0_init() is unnecessary, as we're pretty sure
> that the address we initialize uart0_base to is correct. We go
> through the motions of finding the uart anyway though, because it's
> easy. It's also easy to check chosen/stdout-path first, so let's do
> that too. But, just to make all this stuff is a little less unnecessary,
> let's add a warning when we do actually find an address that doesn't
> match our initializer.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/arm/io.c | 36 +++++++++++++++++++++++++++---------
> 1 file changed, 27 insertions(+), 9 deletions(-)
>
> diff --git a/lib/arm/io.c b/lib/arm/io.c
> index 8b1501886736a..a08d394e4aa1c 100644
> --- a/lib/arm/io.c
> +++ b/lib/arm/io.c
> @@ -19,12 +19,14 @@ extern void halt(int code);
> /*
> * Use this guess for the pl011 base in order to make an attempt at
> * having earlier printf support. We'll overwrite it with the real
> - * base address that we read from the device tree later.
> + * base address that we read from the device tree later. This is
> + * the address we expect QEMU's mach-virt machine type to put in
> + * its generated device tree.
> */
> -#define QEMU_MACH_VIRT_PL011_BASE 0x09000000UL
> +#define UART_EARLY_BASE 0x09000000UL
>
> static struct spinlock uart_lock;
> -static volatile u8 *uart0_base = (u8 *)QEMU_MACH_VIRT_PL011_BASE;
> +static volatile u8 *uart0_base = (u8 *)UART_EARLY_BASE;
>
> static void uart0_init(void)
> {
> @@ -32,16 +34,32 @@ static void uart0_init(void)
> struct dt_pbus_reg base;
> int ret;
>
> - ret = dt_pbus_get_base_compatible(compatible, &base);
> - assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
> + ret = dt_get_default_console_node();
> + assert(ret >= 0 || ret == -FDT_ERR_NOTFOUND);
>
> - if (ret) {
> - printf("%s: %s not found in the device tree, aborting...\n",
> - __func__, compatible);
> - abort();
> + if (ret == -FDT_ERR_NOTFOUND) {
> +
> + ret = dt_pbus_get_base_compatible(compatible, &base);
> + assert(ret == 0 || ret == -FDT_ERR_NOTFOUND);
> +
> + if (ret) {
> + printf("%s: %s not found in the device tree, "
> + "aborting...\n",
> + __func__, compatible);
> + abort();
> + }
> +
> + } else {
> + assert(dt_pbus_translate_node(ret, 0, &base) == 0);
> }
>
> uart0_base = ioremap(base.addr, base.size);
> +
> + if (uart0_base != (u8 *)UART_EARLY_BASE) {
> + printf("WARNING: early print support may not work. "
> + "Found uart at %p, but early base is %p.\n",
> + uart0_base, (u8 *)UART_EARLY_BASE);
> + }
> }
>
> void io_init(void)
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 01/18] makefiles: use bash
2015-11-10 16:22 ` Paolo Bonzini
@ 2015-11-10 16:37 ` Andrew Jones
2015-11-10 16:48 ` Paolo Bonzini
0 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-10 16:37 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, alex.bennee, cov
On Tue, Nov 10, 2015 at 05:22:41PM +0100, Paolo Bonzini wrote:
>
>
> On 06/11/2015 01:24, Andrew Jones wrote:
> > Use bash in the makefiles, like we do in the scripts. Without
> > this some platforms using dash fail to execute make targets
> > that use bash-isms.
> >
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> > Makefile | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 0d5933474cd8c..3e60b4f8e4a57 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -1,4 +1,6 @@
> >
> > +SHELL := /bin/bash
> > +
> > ifeq ($(wildcard config.mak),)
> > $(error run ./configure first. See ./configure -h)
> > endif
> >
>
> Which bash-isms are actually present?
config/config-arm-common.mak has $(RM) $(TEST_DIR)/*.{o,flat,elf,map} ...
I could certainly change that one, and that may be the only one... But,
we require bash for other scripts anyway, so I think requiring make to
use it is reasonable.
Thanks,
drew
>
> Paolo
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 19/18] don't embed code inside asserts
2015-11-09 20:57 ` [kvm-unit-tests PATCH 19/18] don't embed code inside asserts Andrew Jones
@ 2015-11-10 16:37 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:37 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov, thuth
On 09/11/2015 21:57, Andrew Jones wrote:
> assert() is classically a macro which could also be disabled, so if
> somebody introduces a switch to "#define assert(...) /*nothing*/" in
> the future, we'd lose code.
>
> Suggested-by: Thomas Huth <thuth@redhat.com>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> lib/arm/setup.c | 19 ++++++++++++++-----
> lib/arm/smp.c | 4 +++-
> lib/virtio-mmio.c | 4 +++-
> 3 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/lib/arm/setup.c b/lib/arm/setup.c
> index 02e81a689a8a6..da6edc1f9d8ff 100644
> --- a/lib/arm/setup.c
> +++ b/lib/arm/setup.c
> @@ -39,8 +39,11 @@ static void cpu_set(int fdtnode __unused, u32 regval, void *info __unused)
>
> static void cpu_init(void)
> {
> + int ret;
> +
> nr_cpus = 0;
> - assert(dt_for_each_cpu_node(cpu_set, NULL) == 0);
> + ret = dt_for_each_cpu_node(cpu_set, NULL);
> + assert(ret == 0);
> set_cpu_online(0, true);
> }
>
> @@ -49,8 +52,10 @@ static void mem_init(phys_addr_t freemem_start)
> /* we only expect one membank to be defined in the DT */
> struct dt_pbus_reg regs[1];
> phys_addr_t mem_start, mem_end;
> + int ret;
>
> - assert(dt_get_memory_params(regs, 1));
> + ret = dt_get_memory_params(regs, 1);
> + assert(ret != 0);
>
> mem_start = regs[0].addr;
> mem_end = mem_start + regs[0].size;
> @@ -71,14 +76,17 @@ void setup(const void *fdt)
> {
> const char *bootargs;
> u32 fdt_size;
> + int ret;
>
> /*
> * Move the fdt to just above the stack. The free memory
> * then starts just after the fdt.
> */
> fdt_size = fdt_totalsize(fdt);
> - assert(fdt_move(fdt, &stacktop, fdt_size) == 0);
> - assert(dt_init(&stacktop) == 0);
> + ret = fdt_move(fdt, &stacktop, fdt_size);
> + assert(ret == 0);
> + ret = dt_init(&stacktop);
> + assert(ret == 0);
>
> mem_init(PAGE_ALIGN((unsigned long)&stacktop + fdt_size));
> io_init();
> @@ -86,6 +94,7 @@ void setup(const void *fdt)
>
> thread_info_init(current_thread_info(), 0);
>
> - assert(dt_get_bootargs(&bootargs) == 0);
> + ret = dt_get_bootargs(&bootargs);
> + assert(ret == 0);
> setup_args(bootargs);
> }
> diff --git a/lib/arm/smp.c b/lib/arm/smp.c
> index 3cfc6d5ddedd0..390c53b5d84c3 100644
> --- a/lib/arm/smp.c
> +++ b/lib/arm/smp.c
> @@ -44,11 +44,13 @@ secondary_entry_fn secondary_cinit(void)
> void smp_boot_secondary(int cpu, secondary_entry_fn entry)
> {
> void *stack_base = memalign(THREAD_SIZE, THREAD_SIZE);
> + int ret;
>
> secondary_data.stack = stack_base + THREAD_START_SP;
> secondary_data.entry = entry;
> mmu_mark_disabled(cpu);
> - assert(cpu_psci_cpu_boot(cpu) == 0);
> + ret = cpu_psci_cpu_boot(cpu);
> + assert(ret == 0);
>
> while (!cpu_online(cpu))
> wfe();
> diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c
> index 5ccbd193a264a..fa8dd5b8d484d 100644
> --- a/lib/virtio-mmio.c
> +++ b/lib/virtio-mmio.c
> @@ -123,10 +123,12 @@ static int vm_dt_match(const struct dt_device *dev, int fdtnode)
> struct vm_dt_info *info = (struct vm_dt_info *)dev->info;
> struct dt_pbus_reg base;
> u32 magic;
> + int ret;
>
> dt_device_bind_node((struct dt_device *)dev, fdtnode);
>
> - assert(dt_pbus_get_base(dev, &base) == 0);
> + ret = dt_pbus_get_base(dev, &base);
> + assert(ret == 0);
> info->base = ioremap(base.addr, base.size);
>
> magic = readl(info->base + VIRTIO_MMIO_MAGIC_VALUE);
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
` (18 preceding siblings ...)
2015-11-09 20:57 ` [kvm-unit-tests PATCH 19/18] don't embed code inside asserts Andrew Jones
@ 2015-11-10 16:38 ` Paolo Bonzini
2015-11-10 16:54 ` Andrew Jones
19 siblings, 1 reply; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:38 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: alex.bennee, cov
On 06/11/2015 01:24, Andrew Jones wrote:
> Many of these patches were posted once. Some weren't, but anyway
> almost everything is pretty trivial. I'd like to get these in, or
> at least get definitive nacks on them (and then drop them) in order
> to clean my queue before more patches (coming from Alex Bennée and
> Chistopher are reposted).
>
> All patches also available here
> https://github.com/rhdrjones/kvm-unit-tests/commits/queue
I applied all of these except 1 (question asked) and 14/15/16/17 (not
sure I like the idea).
Paolo
> Thanks,
> drew
>
>
> Alex Bennée (4):
> README: add some CONTRIBUTING notes
> configure: emit HOST=$host to config.mak
> lib/printf: support the %u unsigned fmt field
> lib/arm: add flush_tlb_page mmu function
>
> Andrew Jones (13):
> makefiles: use bash
> trivial: lib: fail hard on failed mallocs
> trivial: alloc: don't use 'top' outside spinlock
> trivial: lib: missing extern in string.h
> README: add pointer to new wiki page
> run_tests: pass test name to run script
> arm/run: use ACCEL to choose between kvm and tcg
> run_tests: probe for max-smp
> arm/arm64: allow building a single test
> arm/arm64: generate map files
> lib: link in linux kernel headers (uapi)
> Revert "arm/arm64: import include/uapi/linux/psci.h"
> arm/arm64: uart0_init: check /chosen/stdout-path
>
> Christopher Covington (1):
> arm: Fail on unknown subtest
>
> .gitignore | 2 ++
> Makefile | 6 ++--
> README | 32 +++++++++++++++++++
> arm/run | 43 ++++++++++++++++++++++----
> arm/selftest.c | 3 ++
> arm/unittests.cfg | 7 +++--
> config/config-arm-common.mak | 9 +++++-
> configure | 11 +++++++
> lib/alloc.c | 8 +++--
> lib/arm/asm/mmu.h | 11 +++++++
> lib/arm/asm/page.h | 2 +-
> lib/arm/asm/psci.h | 2 +-
> lib/arm/asm/uapi-psci.h | 73 --------------------------------------------
> lib/arm/io.c | 36 ++++++++++++++++------
> lib/arm64/asm/mmu.h | 8 +++++
> lib/arm64/asm/page.h | 2 +-
> lib/arm64/asm/psci.h | 2 +-
> lib/arm64/asm/uapi-psci.h | 1 -
> lib/asm-generic/page.h | 2 +-
> lib/const.h | 11 -------
> lib/printf.c | 13 ++++++++
> lib/string.h | 2 +-
> lib/virtio-mmio.c | 7 ++---
> run_tests.sh | 12 +++++++-
> scripts/functions.bash | 8 +++--
> scripts/mkstandalone.sh | 22 ++++++++++---
> x86/unittests.cfg | 1 +
> 27 files changed, 210 insertions(+), 126 deletions(-)
> delete mode 100644 lib/arm/asm/uapi-psci.h
> delete mode 100644 lib/arm64/asm/uapi-psci.h
> delete mode 100644 lib/const.h
>
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 01/18] makefiles: use bash
2015-11-10 16:37 ` Andrew Jones
@ 2015-11-10 16:48 ` Paolo Bonzini
0 siblings, 0 replies; 44+ messages in thread
From: Paolo Bonzini @ 2015-11-10 16:48 UTC (permalink / raw)
To: Andrew Jones; +Cc: kvm, alex.bennee, cov
On 10/11/2015 17:37, Andrew Jones wrote:
> On Tue, Nov 10, 2015 at 05:22:41PM +0100, Paolo Bonzini wrote:
>>
>>
>> On 06/11/2015 01:24, Andrew Jones wrote:
>>> Use bash in the makefiles, like we do in the scripts. Without
>>> this some platforms using dash fail to execute make targets
>>> that use bash-isms.
>>>
>>> Signed-off-by: Andrew Jones <drjones@redhat.com>
>>> ---
>>> Makefile | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 0d5933474cd8c..3e60b4f8e4a57 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -1,4 +1,6 @@
>>>
>>> +SHELL := /bin/bash
>>> +
>>> ifeq ($(wildcard config.mak),)
>>> $(error run ./configure first. See ./configure -h)
>>> endif
>>>
>>
>> Which bash-isms are actually present?
>
> config/config-arm-common.mak has $(RM) $(TEST_DIR)/*.{o,flat,elf,map} ...
>
> I could certainly change that one, and that may be the only one... But,
> we require bash for other scripts anyway, so I think requiring make to
> use it is reasonable.
One is enough to apply the patch. :)
Thanks,
Paolo
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches
2015-11-10 16:38 ` [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Paolo Bonzini
@ 2015-11-10 16:54 ` Andrew Jones
2015-11-20 18:01 ` Andrew Jones
0 siblings, 1 reply; 44+ messages in thread
From: Andrew Jones @ 2015-11-10 16:54 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, alex.bennee, cov
On Tue, Nov 10, 2015 at 05:38:38PM +0100, Paolo Bonzini wrote:
>
>
> On 06/11/2015 01:24, Andrew Jones wrote:
> > Many of these patches were posted once. Some weren't, but anyway
> > almost everything is pretty trivial. I'd like to get these in, or
> > at least get definitive nacks on them (and then drop them) in order
> > to clean my queue before more patches (coming from Alex Bennée and
> > Chistopher are reposted).
> >
> > All patches also available here
> > https://github.com/rhdrjones/kvm-unit-tests/commits/queue
>
> I applied all of these
Thanks!
> except 1 (question asked) and 14/15/16/17 (not sure I like the idea).
At one point I recall that you liked the uapi patches, although I'm
not 100% married to it myself, as it does add a new dependency. I'm
open to suggestions.
I'm not sure what you're opposed to wrt to map files (patch 15). They
aren't 100% necessary, but don't really hurt either to generate either.
I won't fight for them though.
The TEST= patch is quite useful. I find it annoying to always have
to modify a makefile whenever I throw together a few line test. It
may not be for everyone, but then it doesn't do anything when it's
not used, so it shouldn't hurt that it exists. I would agree that
maybe the patch should also document it though, if you argued that.
Or, that fact that it's undocumented, and does nothing when not used,
could be an argument to just commit it :-)
Thanks,
drew
>
> Paolo
>
> > Thanks,
> > drew
> >
> >
> > Alex Bennée (4):
> > README: add some CONTRIBUTING notes
> > configure: emit HOST=$host to config.mak
> > lib/printf: support the %u unsigned fmt field
> > lib/arm: add flush_tlb_page mmu function
> >
> > Andrew Jones (13):
> > makefiles: use bash
> > trivial: lib: fail hard on failed mallocs
> > trivial: alloc: don't use 'top' outside spinlock
> > trivial: lib: missing extern in string.h
> > README: add pointer to new wiki page
> > run_tests: pass test name to run script
> > arm/run: use ACCEL to choose between kvm and tcg
> > run_tests: probe for max-smp
> > arm/arm64: allow building a single test
> > arm/arm64: generate map files
> > lib: link in linux kernel headers (uapi)
> > Revert "arm/arm64: import include/uapi/linux/psci.h"
> > arm/arm64: uart0_init: check /chosen/stdout-path
> >
> > Christopher Covington (1):
> > arm: Fail on unknown subtest
> >
> > .gitignore | 2 ++
> > Makefile | 6 ++--
> > README | 32 +++++++++++++++++++
> > arm/run | 43 ++++++++++++++++++++++----
> > arm/selftest.c | 3 ++
> > arm/unittests.cfg | 7 +++--
> > config/config-arm-common.mak | 9 +++++-
> > configure | 11 +++++++
> > lib/alloc.c | 8 +++--
> > lib/arm/asm/mmu.h | 11 +++++++
> > lib/arm/asm/page.h | 2 +-
> > lib/arm/asm/psci.h | 2 +-
> > lib/arm/asm/uapi-psci.h | 73 --------------------------------------------
> > lib/arm/io.c | 36 ++++++++++++++++------
> > lib/arm64/asm/mmu.h | 8 +++++
> > lib/arm64/asm/page.h | 2 +-
> > lib/arm64/asm/psci.h | 2 +-
> > lib/arm64/asm/uapi-psci.h | 1 -
> > lib/asm-generic/page.h | 2 +-
> > lib/const.h | 11 -------
> > lib/printf.c | 13 ++++++++
> > lib/string.h | 2 +-
> > lib/virtio-mmio.c | 7 ++---
> > run_tests.sh | 12 +++++++-
> > scripts/functions.bash | 8 +++--
> > scripts/mkstandalone.sh | 22 ++++++++++---
> > x86/unittests.cfg | 1 +
> > 27 files changed, 210 insertions(+), 126 deletions(-)
> > delete mode 100644 lib/arm/asm/uapi-psci.h
> > delete mode 100644 lib/arm64/asm/uapi-psci.h
> > delete mode 100644 lib/const.h
> >
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 44+ messages in thread
* Re: [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches
2015-11-10 16:54 ` Andrew Jones
@ 2015-11-20 18:01 ` Andrew Jones
0 siblings, 0 replies; 44+ messages in thread
From: Andrew Jones @ 2015-11-20 18:01 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kvm, alex.bennee, cov
On Tue, Nov 10, 2015 at 11:54:22AM -0500, Andrew Jones wrote:
> On Tue, Nov 10, 2015 at 05:38:38PM +0100, Paolo Bonzini wrote:
> >
> >
> > On 06/11/2015 01:24, Andrew Jones wrote:
> > > Many of these patches were posted once. Some weren't, but anyway
> > > almost everything is pretty trivial. I'd like to get these in, or
> > > at least get definitive nacks on them (and then drop them) in order
> > > to clean my queue before more patches (coming from Alex Bennée and
> > > Chistopher are reposted).
> > >
> > > All patches also available here
> > > https://github.com/rhdrjones/kvm-unit-tests/commits/queue
> >
> > I applied all of these
>
> Thanks!
>
> > except 1 (question asked) and 14/15/16/17 (not sure I like the idea).
Hi Paolo,
Any more thoughts on these? I parsed "not sure I like" as "still
thinking". Or should I parse it as a "no" and drop them from my
queue?
>
> At one point I recall that you liked the uapi patches, although I'm
> not 100% married to it myself, as it does add a new dependency. I'm
> open to suggestions.
Another argument for the uapi patches is that we're working on adding
support for the mach-virt pcie host bridge in order to use pci-testdev
in arm unit tests. We'll need to either use this series or import
pci[_regs].h for that.
>
> I'm not sure what you're opposed to wrt to map files (patch 15). They
> aren't 100% necessary, but don't really hurt either to generate either.
> I won't fight for them though.
I'm OK with dropping this one. The map files were useful to me once,
but as rare as they would be, I agree cluttering things with them
isn't a great idea.
>
> The TEST= patch is quite useful. I find it annoying to always have
> to modify a makefile whenever I throw together a few line test. It
> may not be for everyone, but then it doesn't do anything when it's
> not used, so it shouldn't hurt that it exists. I would agree that
> maybe the patch should also document it though, if you argued that.
> Or, that fact that it's undocumented, and does nothing when not used,
> could be an argument to just commit it :-)
I still like this one. I'll buy you a beer for it :-)
Thanks,
drew
^ permalink raw reply [flat|nested] 44+ messages in thread
end of thread, other threads:[~2015-11-20 18:01 UTC | newest]
Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-06 0:24 [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 01/18] makefiles: use bash Andrew Jones
2015-11-10 16:22 ` Paolo Bonzini
2015-11-10 16:37 ` Andrew Jones
2015-11-10 16:48 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 02/18] trivial: lib: fail hard on failed mallocs Andrew Jones
2015-11-06 14:05 ` Thomas Huth
2015-11-07 1:02 ` Andrew Jones
2015-11-09 20:53 ` [kvm-unit-tests PATCH v2 02/19] " Andrew Jones
2015-11-09 20:55 ` Thomas Huth
2015-11-10 16:23 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 03/18] trivial: alloc: don't use 'top' outside spinlock Andrew Jones
2015-11-10 16:24 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 04/18] trivial: lib: missing extern in string.h Andrew Jones
2015-11-10 16:24 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 05/18] README: add pointer to new wiki page Andrew Jones
2015-11-10 16:25 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 06/18] README: add some CONTRIBUTING notes Andrew Jones
2015-11-10 16:25 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 07/18] configure: emit HOST=$host to config.mak Andrew Jones
2015-11-10 16:26 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 08/18] run_tests: pass test name to run script Andrew Jones
2015-11-10 16:34 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 09/18] arm/run: use ACCEL to choose between kvm and tcg Andrew Jones
2015-11-10 16:30 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 10/18] run_tests: probe for max-smp Andrew Jones
2015-11-10 16:31 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 11/18] lib/printf: support the %u unsigned fmt field Andrew Jones
2015-11-10 16:33 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 12/18] lib/arm: add flush_tlb_page mmu function Andrew Jones
2015-11-10 16:33 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 13/18] arm: Fail on unknown subtest Andrew Jones
2015-11-10 16:34 ` Paolo Bonzini
2015-11-06 0:24 ` [kvm-unit-tests PATCH 14/18] arm/arm64: allow building a single test Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 15/18] arm/arm64: generate map files Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 16/18] lib: link in linux kernel headers (uapi) Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 17/18] Revert "arm/arm64: import include/uapi/linux/psci.h" Andrew Jones
2015-11-06 0:24 ` [kvm-unit-tests PATCH 18/18] arm/arm64: uart0_init: check /chosen/stdout-path Andrew Jones
2015-11-10 16:37 ` Paolo Bonzini
2015-11-09 20:57 ` [kvm-unit-tests PATCH 19/18] don't embed code inside asserts Andrew Jones
2015-11-10 16:37 ` Paolo Bonzini
2015-11-10 16:38 ` [kvm-unit-tests PATCH 00/18] bunch of mostly trivial patches Paolo Bonzini
2015-11-10 16:54 ` Andrew Jones
2015-11-20 18:01 ` Andrew Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).