Re: [PATCH 0/9] kvm-unit-tests/arm: initial drop

2014-01-02 Thread Andrew Jones
On Sun, Dec 29, 2013 at 01:24:11AM -0800, Christoffer Dall wrote:
 On Mon, Oct 14, 2013 at 06:23:26PM +0200, Andrew Jones wrote:
 
 Hi Drew,
 
  This series introduces arm to kvm-unit-tests. First, it does some
  tidying up of the repo. Then, it adds support for virtio-testdev,
  which was just posted to qemu-devel[1]. Next, it adds the basic
  infrastructure for booting a test case (guest). Finally, it adds
  support for vectors. This is just an initial drop, I'm starting
  work on smp support now, and then will bring in support for
  arm64. At that point we should be able to start actually adding
  tests. To use this you need an arm platform or simulator capable
  of running kvmarm and a qemu with the mach-virt patches[2], as
  well as the previously mentioned virtio-testdev.
  
  [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html
  [2] http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg02142.html
  
  This patches are also available from a git repo here
  https://github.com/rhdrjones/kvm-unit-tests/tree/arm-branch/master
  
 
 I'm playing around with this, thanks again for working on it.  It's long
 overdue that we're getting something real done in this area.
 
 I have run into some problems trying to run this thing on real hardware.
 The biggest problem is the known cache coherency issue where we need to
 flush the data cache to make things coherent when the guest runs with
 the MMU disabled.  It shows up quite frequently if you just try to run
 the small flat binaries with KVM, and I suspec the only reason we are
 not seeing this with real kernels is that they are large enough that we
 end up writing the necessary data all the way to main memory.
 
 I'm working on a vmexit test to measure stuff, and I noticed that we:
  - really need to find a way to let a guest read the cycle counter
  - need a way to let a call a dummy HVC to KVM to measure round-trip
times
  - ...
 
 This is probably something we should try to discuss on one of the next
 kvm/arm sync-up calls.  I remember something about you not being able to
 make those, but we can arrange a different time for one of them some
 time.
 
 For now, I can work around the cache issue by enabling the DC bits and
 by adding a terrible hack for the cycle counter and dummy HVC.  You can
 follow my hackings here:
 
 Kernel:
 https://git.linaro.org/people/christoffer.dall/linux-kvm-arm.git/shortlog/refs/heads/kvm-arm-next-measure
 
 unit-tests:
 https://github.com/columbia/kvm-unit-tests/tree/arm-support
 
 -Christoffer

Thanks Christoffer! I'll look at these branches tomorrow. I'm glad we're
getting some momentum on kvm-unit-tests/arm!

drew
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9] kvm-unit-tests/arm: initial drop

2013-12-29 Thread Christoffer Dall
On Mon, Oct 14, 2013 at 06:23:26PM +0200, Andrew Jones wrote:

Hi Drew,

 This series introduces arm to kvm-unit-tests. First, it does some
 tidying up of the repo. Then, it adds support for virtio-testdev,
 which was just posted to qemu-devel[1]. Next, it adds the basic
 infrastructure for booting a test case (guest). Finally, it adds
 support for vectors. This is just an initial drop, I'm starting
 work on smp support now, and then will bring in support for
 arm64. At that point we should be able to start actually adding
 tests. To use this you need an arm platform or simulator capable
 of running kvmarm and a qemu with the mach-virt patches[2], as
 well as the previously mentioned virtio-testdev.
 
 [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html
 [2] http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg02142.html
 
 This patches are also available from a git repo here
 https://github.com/rhdrjones/kvm-unit-tests/tree/arm-branch/master
 

I'm playing around with this, thanks again for working on it.  It's long
overdue that we're getting something real done in this area.

I have run into some problems trying to run this thing on real hardware.
The biggest problem is the known cache coherency issue where we need to
flush the data cache to make things coherent when the guest runs with
the MMU disabled.  It shows up quite frequently if you just try to run
the small flat binaries with KVM, and I suspec the only reason we are
not seeing this with real kernels is that they are large enough that we
end up writing the necessary data all the way to main memory.

I'm working on a vmexit test to measure stuff, and I noticed that we:
 - really need to find a way to let a guest read the cycle counter
 - need a way to let a call a dummy HVC to KVM to measure round-trip
   times
 - ...

This is probably something we should try to discuss on one of the next
kvm/arm sync-up calls.  I remember something about you not being able to
make those, but we can arrange a different time for one of them some
time.

For now, I can work around the cache issue by enabling the DC bits and
by adding a terrible hack for the cycle counter and dummy HVC.  You can
follow my hackings here:

Kernel:
https://git.linaro.org/people/christoffer.dall/linux-kvm-arm.git/shortlog/refs/heads/kvm-arm-next-measure

unit-tests:
https://github.com/columbia/kvm-unit-tests/tree/arm-support

-Christoffer
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9] kvm-unit-tests/arm: initial drop

2013-11-26 Thread Andrew Jones

Sorry, just noticed this - you dropped me and the kvmarm list
from your reply.

On Wed, Nov 20, 2013 at 11:06:11PM +, María Soler Heredia wrote:
 Andrew Jones drjones at redhat.com writes:
 
  
  This series introduces arm to kvm-unit-tests.
 
  To use this you need an arm platform or simulator capable
  of running kvmarm and a qemu with the mach-virt patches[2], as
  well as the previously mentioned virtio-testdev.
 
 Hello,
 
 I have been playing with your tests for a while and I cannot seem to get
 them to work all right. When I run them disabling kvm on the arm-run script,
 they do work, but when I run them with kvm enabled they fail.
 
 This is my output:
 
 ./arm-run arm/boot.flat -smp 1 -m 256 -append 'info 0x1000 0x1000'
 qemu-system-arm -device virtio-testdev -display none -serial stdio -M virt
 -cpu cortex-a15 -enable-kvm -kernel arm/boot.flat -smp 1 -m 256 -append info
 0x1000 0x1000
 kvm [1252]: load/store instruction decoding not implemented
 error: kvm run failed Function not implemented

The above errors come from the kernel and qemu. It's easy to see under
what condition you would hit them, but it's not clear to me why that
condition is present for you.

 ./arm-run: line 16:  1251 Aborted $command $@
 Return value from qemu: 134
 FAIL boot_info
 ./arm-run arm/boot.flat -smp 1 -append 'vectors'
 qemu-system-arm -device virtio-testdev -display none -serial stdio -M virt
 -cpu cortex-a15 -enable-kvm -kernel arm/boot.flat -smp 1 -append vectors
 kvm [1257]: load/store instruction decoding not implemented
 error: kvm run failed Function not implemented
 ./arm-run: line 16:  1256 Aborted $command $@
 Return value from qemu: 134
 FAIL boot_vectors
 
 I am using FastModels Model Debugger version 8.2.028, with a model of this
 characteristics:
 
 Model:
 --
 Model name: ARM_Cortex-A15
 Instance: cluster.cpu0
 Using CADI 2.0 interface revision 0.
 Version: 8.2.72
 Generated by Core Generator: No
 Needs SimGen License: No

So far I've only tested on real hardware. So this could be the difference.

 
 running the latest stable linux release and qemu-devel's latest qemu with
 the patches indicated here
 https://lists.gnu.org/archive/html/qemu-devel/2013-10/msg02428.html plus
  [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html
 
 I tested the instalation by running a linux with the same setup using this 
 call:
 qemu-system-arm \
 -display none \
 -enable-kvm \
 -kernel zImage\
 -m 128 -M virt -cpu cortex-a15 \
 -drive if=none,file=linux.img,id=fs \
 -device virtio-blk-device,drive=fs
 
 As I said, the tests pass if the kvm is not enabled and fail otherwise. I
 have added a few printfs for debugging and I can tell that the code in
 boot.c runs ok, but then when virtio_testdev is called (from
 virtio_testdev_exit) the execution throws an exception (more specifically
 the line  *tdp++ = cpu_to_le32(va_arg(va, unsigned)); inside the first while.

Hmm, even more confusing, as this isn't the first mmio access.

 
 I am not used to sending emails to this kind of list, so I don't know if I
 am being too specific, too little or maybe not even giving the right
 information. Please tell me what else you need and if you can help me solve
 this problem. 

Your details are good, but instead of just stating 'latest' for your
kernel and qemu versions, please give the exact version numbers.

I've been busy with other things lately, but I'm due to post a v2 of
this series. I should be able to finish that off this week. When I do,
I'll see if I can test it over FastModel as well this time.

Thanks for starting to poke at this!

drew
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/9] kvm-unit-tests/arm: initial drop

2013-11-20 Thread María Soler Heredia
Andrew Jones drjones at redhat.com writes:

 
 This series introduces arm to kvm-unit-tests.

 To use this you need an arm platform or simulator capable
 of running kvmarm and a qemu with the mach-virt patches[2], as
 well as the previously mentioned virtio-testdev.

Hello,

I have been playing with your tests for a while and I cannot seem to get
them to work all right. When I run them disabling kvm on the arm-run script,
they do work, but when I run them with kvm enabled they fail.

This is my output:

./arm-run arm/boot.flat -smp 1 -m 256 -append 'info 0x1000 0x1000'
qemu-system-arm -device virtio-testdev -display none -serial stdio -M virt
-cpu cortex-a15 -enable-kvm -kernel arm/boot.flat -smp 1 -m 256 -append info
0x1000 0x1000
kvm [1252]: load/store instruction decoding not implemented
error: kvm run failed Function not implemented
./arm-run: line 16:  1251 Aborted $command $@
Return value from qemu: 134
FAIL boot_info
./arm-run arm/boot.flat -smp 1 -append 'vectors'
qemu-system-arm -device virtio-testdev -display none -serial stdio -M virt
-cpu cortex-a15 -enable-kvm -kernel arm/boot.flat -smp 1 -append vectors
kvm [1257]: load/store instruction decoding not implemented
error: kvm run failed Function not implemented
./arm-run: line 16:  1256 Aborted $command $@
Return value from qemu: 134
FAIL boot_vectors

I am using FastModels Model Debugger version 8.2.028, with a model of this
characteristics:

Model:
--
Model name: ARM_Cortex-A15
Instance: cluster.cpu0
Using CADI 2.0 interface revision 0.
Version: 8.2.72
Generated by Core Generator: No
Needs SimGen License: No

running the latest stable linux release and qemu-devel's latest qemu with
the patches indicated here
https://lists.gnu.org/archive/html/qemu-devel/2013-10/msg02428.html plus
 [1] http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html

I tested the instalation by running a linux with the same setup using this call:
qemu-system-arm \
-display none \
-enable-kvm \
-kernel zImage\
-m 128 -M virt -cpu cortex-a15 \
-drive if=none,file=linux.img,id=fs \
-device virtio-blk-device,drive=fs

As I said, the tests pass if the kvm is not enabled and fail otherwise. I
have added a few printfs for debugging and I can tell that the code in
boot.c runs ok, but then when virtio_testdev is called (from
virtio_testdev_exit) the execution throws an exception (more specifically
the line  *tdp++ = cpu_to_le32(va_arg(va, unsigned)); inside the first while.

I am not used to sending emails to this kind of list, so I don't know if I
am being too specific, too little or maybe not even giving the right
information. Please tell me what else you need and if you can help me solve
this problem. 

Thank you very much,
María.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/9] kvm-unit-tests/arm: initial drop

2013-10-14 Thread Andrew Jones
This series introduces arm to kvm-unit-tests. First, it does some
tidying up of the repo. Then, it adds support for virtio-testdev,
which was just posted to qemu-devel[1]. Next, it adds the basic
infrastructure for booting a test case (guest). Finally, it adds
support for vectors. This is just an initial drop, I'm starting
work on smp support now, and then will bring in support for
arm64. At that point we should be able to start actually adding
tests. To use this you need an arm platform or simulator capable
of running kvmarm and a qemu with the mach-virt patches[2], as
well as the previously mentioned virtio-testdev.

[1] http://lists.nongnu.org/archive/html/qemu-devel/2013-10/msg01815.html
[2] http://lists.nongnu.org/archive/html/qemu-devel/2013-09/msg02142.html

This patches are also available from a git repo here
https://github.com/rhdrjones/kvm-unit-tests/tree/arm-branch/master

Andrew Jones (9):
  remove unused files
  makefile and run_tests tweaks
  clean root dir of all x86-ness
  Introduce a simple iomap structure
  Add halt() and some error codes
  Introduce virtio-testdev
  arm: replace arbitrary divisions
  arm: initial drop
  arm: add vectors support

 Makefile  |  19 +-
 README|  56 ++--
 arm/boot.c|  46 +++
 arm/cstart.S  |  93 ++
 arm/flat.lds  |  18 ++
 arm/run   |  19 ++
 arm/unittests.cfg |  17 +
 config-i386.mak   |  13 -
 config-ia64.mak   |   7 -
 config-powerpc-440.mak|  15 -
 config-powerpc.mak|  39 ---
 config-x86-common.mak | 122 
 config-x86_64.mak |  14 -
 config/config-arm.mak |  63 
 config/config-i386.mak|  12 +
 config/config-x86-common.mak  | 120 +++
 config/config-x86_64.mak  |  13 +
 configure |  27 +-
 docs/testdev.txt  |  11 +
 flat.lds  |  21 --
 formats   |  31 --
 iotable.c |  53 
 iotable.h |  40 ---
 kvmtrace.c| 706 --
 kvmtrace_format   | 532 ---
 lib/arm/bootinfo.c|  68 
 lib/arm/bootinfo.h|  19 ++
 lib/arm/bswap.h   |  30 ++
 lib/arm/io.c  |  26 ++
 lib/arm/processor.h   |  45 +++
 lib/arm/vectors.c |  65 
 lib/arm/vectors.h |  37 +++
 lib/bswap.h   |  11 +
 lib/divmod.h  |  20 ++
 lib/errno.h   |  15 +
 lib/fwcfg.c   |  58 
 lib/iomaps.c  |  12 +
 lib/iomaps.h  |  12 +
 lib/libcflat.h|  16 +-
 lib/panic.c   |  13 -
 lib/powerpc/44x/map.c |  51 ---
 lib/powerpc/44x/timebase.S|  28 --
 lib/powerpc/44x/timebase.h|  25 --
 lib/powerpc/44x/tlbwe.S   |  29 --
 lib/powerpc/io.c  |  35 ---
 lib/printf.c  |  27 +-
 lib/virtio-testdev.c  | 126 
 lib/virtio-testdev.h  |   9 +
 lib/x86/io.c  |   6 +
 main-ppc.c| 383 ---
 powerpc/44x/tlbsx.S   |  33 --
 powerpc/44x/tlbwe.S   |  27 --
 powerpc/44x/tlbwe_16KB.S  |  35 ---
 powerpc/44x/tlbwe_hole.S  |  27 --
 powerpc/cstart.S  |  38 ---
 powerpc/exit.c|  23 --
 powerpc/helloworld.c  |  27 --
 powerpc/io.S  |  32 --
 powerpc/spin.S|   4 -
 powerpc/sprg.S|   7 -
 run_tests.sh  |  19 +-
 scripts/gen-devtree-iomaps.pl |  81 +
 testdev.txt   |  14 -
 x86-run   |  41 ---
 x86/README|  60 +++-
 x86/flat.lds  |  21 ++
 x86/print.h   |  19 --
 x86/run   |  41 +++
 x86/run-kvm-unit-tests|   6 -
 69 files changed, 1195 insertions(+), 2633 deletions(-)
 create mode 100644 arm/boot.c
 create mode 100644 arm/cstart.S
 create mode 100644 arm/flat.lds
 create mode 100755 arm/run
 create mode 100644 arm/unittests.cfg
 delete mode 100644 config-i386.mak
 delete mode 100644 config-ia64.mak
 delete mode 100644 config-powerpc-440.mak
 delete mode 100644 config-powerpc.mak
 delete mode 100644 config-x86-common.mak
 delete mode 100644 config-x86_64.mak
 create mode 100644 config/config-arm.mak
 create mode 100644 config/config-i386.mak
 create mode 100644 config/config-x86-common.mak
 create mode 100644 config/config-x86_64.mak
 create mode 100644 docs/testdev.txt
 delete mode 100644 flat.lds
 delete mode 100644 formats
 delete mode 100644 iotable.c
 delete mode 100644 iotable.h
 delete mode 100644 kvmtrace.c
 delete mode 100755 kvmtrace_format
 create mode 100644 lib/arm/bootinfo.c
 create mode 100644 lib/arm/bootinfo.h