[Qemu-devel] [Bug 599958] Re: Timedrift problems with Win7: hpet missing time drift fixups

2019-05-24 Thread Lucas Meneghel Rodrigues
Absolutely, please close it.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/599958

Title:
  Timedrift problems with Win7: hpet missing time drift fixups

Status in QEMU:
  Incomplete

Bug description:
  We've been finding timedrift issues witth Win7 under qemu-kvm on our
  daily testing

  kvm.qemu-kvm-git.smp2.Win7.64.timedrift.with_load FAIL1   Time 
drift too large after rest period: 38.63%
  kvm.qemu-kvm-git.smp2.Win7.64.timedrift.with_reboot   FAIL1   Time 
drift too large at iteration 1: 17.77 seconds
  kvm.qemu-kvm-git.smp2.Win7.64.timedrift.with_migrationFAIL1   
Time drift too large at iteration 2: 3.08 seconds

  Steps to reproduce:

  timedrift.with_load

  1) Log into a guest.
  2) Take a time reading from the guest and host.
  3) Run load on the guest and host.
  4) Take a second time reading.
  5) Stop the load and rest for a while.
  6) Take a third time reading.
  7) If the drift immediately after load is higher than a user-
  specified value (in %), fail.
  If the drift after the rest period is higher than a user-specified value,
  fail.

  timedrift.with_migration

  1) Log into a guest.
  2) Take a time reading from the guest and host.
  3) Migrate the guest.
  4) Take a second time reading.
  5) If the drift (in seconds) is higher than a user specified value, fail.

  timedrift.with_reboot

  1) Log into a guest.
  2) Take a time reading from the guest and host.
  3) Reboot the guest.
  4) Take a second time reading.
  5) If the drift (in seconds) is higher than a user specified value, fail.

  This bug is to register those issues and keep an eye on them.

  Attached, some logs from the autotest tests executed on the guest

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/599958/+subscriptions



Re: [Qemu-devel] [PATCH v2 1/1] tests/docker: Add a Avocado Docker test

2018-05-23 Thread Lucas Meneghel Rodrigues
Me and Cleber were talking about running avocado in containers, and we
verified there are some things we need to fix in avocado to make it
work well under container environments. One of the main offenders is
our service manager library, that was created to deal with sysvinit
and systemd, but Docker containers usually don't have either. The test
runner does use the service library to infer a few things about the
system (even on simple tests), so fixing is needed.

So your docker proposal as of is now depends on us fixing those bugs
for it to be functional. Please bear with us meanwhile.

On Tue, May 22, 2018 at 10:14 PM, Lucas Meneghel Rodrigues
<look...@gmail.com> wrote:
> On Tue, May 22, 2018 at 9:50 PM, Cleber Rosa <cr...@redhat.com> wrote:
>>
>>
>> On 05/21/2018 07:32 PM, Philippe Mathieu-Daudé wrote:
>>> On 05/21/2018 07:33 PM, Alistair Francis wrote:
>>>> On Sun, May 20, 2018 at 8:16 PM, Fam Zheng <f...@redhat.com> wrote:
>>>>> On Fri, 05/18 11:34, Alistair Francis wrote:
>>>>>> Avocado is not trivial to setup on non-Fedora systems. To simplfying
>>>>>> future testing add a docker test image that runs Avocado tests.
>>>>>>
>>>>>> Signed-off-by: Alistair Francis <alistair.fran...@wdc.com>
>>>>>> ---
>>>>>> v2:
>>>>>>  - Add a seperate fedora-avocado Docker image
>>>>>>  - Move the avocado vt-bootstrap into the Docker file
>>>>>>
>>>>>>  tests/docker/Makefile.include |  1 +
>>>>>>  .../docker/dockerfiles/fedora-avocado.docker  | 25 +
>>>>>>  tests/docker/test-avocado | 28 +++
>>>>>>  3 files changed, 54 insertions(+)
>>>>>>  create mode 100644 tests/docker/dockerfiles/fedora-avocado.docker
>>>>>>  create mode 100755 tests/docker/test-avocado
>>>>>>
>>>>>> diff --git a/tests/docker/Makefile.include 
>>>>>> b/tests/docker/Makefile.include
>>>>>> index ef1a3e62eb..0e3d108dde 100644
>>>>>> --- a/tests/docker/Makefile.include
>>>>>> +++ b/tests/docker/Makefile.include
>>>>>> @@ -60,6 +60,7 @@ docker-image-debian-ppc64el-cross: docker-image-debian9
>>>>>>  docker-image-debian-s390x-cross: docker-image-debian9
>>>>>>  docker-image-debian-win32-cross: docker-image-debian8-mxe
>>>>>>  docker-image-debian-win64-cross: docker-image-debian8-mxe
>>>>>> +docker-image-fedora-avocado: docker-image-fedora
>>>>>>  docker-image-travis: NOUSER=1
>>>>>>
>>>>>>  # Expand all the pre-requistes for each docker image and test 
>>>>>> combination
>>>>>> diff --git a/tests/docker/dockerfiles/fedora-avocado.docker 
>>>>>> b/tests/docker/dockerfiles/fedora-avocado.docker
>>>>>> new file mode 100644
>>>>>> index 00..55b19eebbf
>>>>>> --- /dev/null
>>>>>> +++ b/tests/docker/dockerfiles/fedora-avocado.docker
>>>>>> @@ -0,0 +1,25 @@
>>>>>> +FROM qemu:fedora
>>>>>> +
>>>>>> +ENV PACKAGES \
>>>>>> +libvirt-devel \
>>>>>> +nc \
>>>>>> +python-avocado \
>>
>> python-avocado is a "Provides" of python2-avocado, but that may may go
>> away soon (as soon as Fedora 29).  I'd recommend using python2-avocado,
>> which is the proper package name available on Fedora.
>>
>>>>>> +python2-devel python3-devel \
>>>>>> +qemu-kvm \
>>>>>> +tcpdump \
>>>>>> +xz
>>>>>> +ENV PIP_PACKAGES \
>>>>>> +avocado-qemu \
>>
>> +CC: Amador Pahim
>>
>> This pip package was created by Amador Pahim, but was intended for demo
>> purposes only.  Upon finding about this, he (cc'ed here) said that the
>> package is going to be removed to avoid further confusion.
>>
>> BTW, the intention is to have this supporting code for QEMU tests in the
>> QEMU tree itself.  Myself and Eduardo are working on a new version of
>> that supporting code.  Also, based on what I see on the test-avocado
>> file, this code is not needed at this point.
>>
>>>>>> +avocado-framework-plugin-runner-remote \
>>>>>> +avocado-framework-plugin-runner-vm \
>>
>> These two plugins are onl

Re: [Qemu-devel] [PATCH v2 1/1] tests/docker: Add a Avocado Docker test

2018-05-22 Thread Lucas Meneghel Rodrigues
On Tue, May 22, 2018 at 9:50 PM, Cleber Rosa  wrote:
>
>
> On 05/21/2018 07:32 PM, Philippe Mathieu-Daudé wrote:
>> On 05/21/2018 07:33 PM, Alistair Francis wrote:
>>> On Sun, May 20, 2018 at 8:16 PM, Fam Zheng  wrote:
 On Fri, 05/18 11:34, Alistair Francis wrote:
> Avocado is not trivial to setup on non-Fedora systems. To simplfying
> future testing add a docker test image that runs Avocado tests.
>
> Signed-off-by: Alistair Francis 
> ---
> v2:
>  - Add a seperate fedora-avocado Docker image
>  - Move the avocado vt-bootstrap into the Docker file
>
>  tests/docker/Makefile.include |  1 +
>  .../docker/dockerfiles/fedora-avocado.docker  | 25 +
>  tests/docker/test-avocado | 28 +++
>  3 files changed, 54 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/fedora-avocado.docker
>  create mode 100755 tests/docker/test-avocado
>
> diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
> index ef1a3e62eb..0e3d108dde 100644
> --- a/tests/docker/Makefile.include
> +++ b/tests/docker/Makefile.include
> @@ -60,6 +60,7 @@ docker-image-debian-ppc64el-cross: docker-image-debian9
>  docker-image-debian-s390x-cross: docker-image-debian9
>  docker-image-debian-win32-cross: docker-image-debian8-mxe
>  docker-image-debian-win64-cross: docker-image-debian8-mxe
> +docker-image-fedora-avocado: docker-image-fedora
>  docker-image-travis: NOUSER=1
>
>  # Expand all the pre-requistes for each docker image and test combination
> diff --git a/tests/docker/dockerfiles/fedora-avocado.docker 
> b/tests/docker/dockerfiles/fedora-avocado.docker
> new file mode 100644
> index 00..55b19eebbf
> --- /dev/null
> +++ b/tests/docker/dockerfiles/fedora-avocado.docker
> @@ -0,0 +1,25 @@
> +FROM qemu:fedora
> +
> +ENV PACKAGES \
> +libvirt-devel \
> +nc \
> +python-avocado \
>
> python-avocado is a "Provides" of python2-avocado, but that may may go
> away soon (as soon as Fedora 29).  I'd recommend using python2-avocado,
> which is the proper package name available on Fedora.
>
> +python2-devel python3-devel \
> +qemu-kvm \
> +tcpdump \
> +xz
> +ENV PIP_PACKAGES \
> +avocado-qemu \
>
> +CC: Amador Pahim
>
> This pip package was created by Amador Pahim, but was intended for demo
> purposes only.  Upon finding about this, he (cc'ed here) said that the
> package is going to be removed to avoid further confusion.
>
> BTW, the intention is to have this supporting code for QEMU tests in the
> QEMU tree itself.  Myself and Eduardo are working on a new version of
> that supporting code.  Also, based on what I see on the test-avocado
> file, this code is not needed at this point.
>
> +avocado-framework-plugin-runner-remote \
> +avocado-framework-plugin-runner-vm \
>
> These two plugins are only needed if you intend to run tests on remote
> machines.  Given "test-avocado" is not making use of those features,
> there's no need to install them.
>
> As a side note, plugins are also available on Fedora as RPM packages, so
> if I failed to understand the requirements for these plugins here, they
> could still be installed as the python2-avocado-plugins-runner-remote
> and python2-avocado-plugins-runner-vm RPM packages.
>
> +avocado-framework-plugin-vt
> +
>
> +CC: Lucas Rodrigues
>
> This is a pip package created by Lucas Rodrigues, and this code is
> certainly used in the "test-avocado" file.  He told me he's using it to
> run Avocado-VT tests in a venv on Ubuntu, Amazon Linux, etc, and he's
> willing to maintain and update it.

I'd suggest to look into virtual environments to run avocado-vt.
virtual environments are more lightweight than using a docker
container to run things and achieve similar functionality. Since I
mostly never install python libraries and projects system wide these
days, I didn't test this install mode in a docker container. Here's
what I'd do on my Ubuntu 16.04 development laptop:

$ virtualenv avocado_vt_demo
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/lmr/avocado_vt_demo/bin/python2
Also creating executable in /home/lmr/avocado_vt_demo/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

$ source avocado_vt_demo/bin/activate

(avocado_vt_demo) $ pip install avocado-framework-plugin-vt
... output trimmed ...
Successfully built avocado-framework-plugin-vt autotest aexpect simplejson
Installing collected packages: pbr, six, stevedore, avocado-framework,
autotest, aexpect, simplejson, netaddr, netifaces,
avocado-framework-plugin-vt
Successfully installed aexpect-1.4.0 autotest-0.16.4
avocado-framework-61.0 avocado-framework-plugin-vt-57.4 netaddr-0.7.19
netifaces-0.10.7 

[Qemu-devel] [Bug 1162644] Re: qemu-system-x86_64 crashed with SIGABRT in __assert_fail_base()

2018-01-11 Thread Lucas Meneghel Rodrigues
Sure, please close it.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1162644

Title:
  qemu-system-x86_64 crashed with SIGABRT in __assert_fail_base()

Status in QEMU:
  Incomplete
Status in qemu package in Ubuntu:
  Confirmed

Bug description:
  Description:
  When QEMU tries to boot with a usb 3.0 tablet (xhci) on a Raring ringtail box 
(QEMU package1.4.0+dfsg-1expubuntu4)  it will crash soon afterwards:

  qemu-system-x86_64: /build/buildd/qemu-1.4.0+dfsg/hw/usb/core.c:552:
  usb_packet_setup: Assertion `p->iov.iov != ((void *)0)' failed.

  Component:
  qemu-system -> 1.4.0+dfsg-1expubuntu4

  Ubuntu Version:

  Description:  Ubuntu Raring Ringtail (development branch)
  Release:  13.04

  Steps to reproduce it:

  I met this bug while running the virt-test suite

  https://github.com/autotest/virt-test

  Instructions to install and run it can be seen on the README file

  https://github.com/autotest/virt-test#readme

  After the suite is set, it can be reproduced on a raring (13.04)
  simply by running:

  ./run -t qemu --tests usb.usb_reboot.usb_tablet.xhci

  Command line:

  23:52:42 INFO | Running qemu command (reformatted):
  /usr/bin/kvm \
  -S \
  -name 'virt-tests-vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130331-233911-ndvUEvrV,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130331-233911-ndvUEvrV,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130331-233911-ndvUEvrV,path=/tmp/seabios-20130331-233911-ndvUEvrV,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130331-233911-ndvUEvrV,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -device nec-usb-xhci,id=usbtest \
  -drive 
file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=idumV1TE,mac='9a:c0:c1:c2:c3:c4',id='idmN7iHv' \
  -netdev user,id=idumV1TE,hostfwd=tcp::5000-:22 \
  -m 1024 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'SandyBridge' \
  -M pc \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -device usb-tablet,id=usb-testdev,bus=usbtest.0,port=1 \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=c,menu=off  \
  -enable-kvm

  ProblemType: Crash
  DistroRelease: Ubuntu 13.04
  Package: qemu-system-x86 1.4.0+dfsg-1expubuntu4
  ProcVersionSignature: Ubuntu 3.8.0-15.25-generic 3.8.4
  Uname: Linux 3.8.0-15-generic x86_64
  ApportVersion: 2.9.2-0ubuntu5
  Architecture: amd64
  Date: Sun Mar 31 23:52:46 2013
  EcryptfsInUse: Yes
  ExecutablePath: /usr/bin/qemu-system-x86_64
  InstallationDate: Installed on 2013-03-31 (0 days ago)
  InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
  MarkForUpload: True
  ProcEnviron:
   TERM=dumb
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  Signal: 6
  SourcePackage: qemu
  StacktraceTop:
   raise () from /lib/x86_64-linux-gnu/libc.so.6
   abort () from /lib/x86_64-linux-gnu/libc.so.6
   ?? () from /lib/x86_64-linux-gnu/libc.so.6
   __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
   ?? ()
  Title: qemu-system-x86_64 crashed with SIGABRT in raise()
  UpgradeStatus: Upgraded to raring on 2013-03-31 (0 days ago)
  UserGroups: adm cdrom dip libvirtd lpadmin plugdev sambashare sudo

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1162644/+subscriptions



[Qemu-devel] [Bug 1047576] Re: qemu unittest emulator failure on latest git master

2017-06-14 Thread Lucas Meneghel Rodrigues
This doesn't reproduce with the latest version of QEMU, you may close
it.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047576

Title:
  qemu unittest emulator failure on latest git master

Status in QEMU:
  Incomplete

Bug description:
  Running the emulator unittest, using the cmdline:

  16:01:30 INFO | Running emulator
  16:01:30 INFO | Running qemu command (reformatted):
  16:01:30 INFO | 
/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 
  16:01:30 INFO | -S 
  16:01:30 INFO | -name 'unittest_vm' 
  16:01:30 INFO | -nodefaults 
  16:01:30 INFO | -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 
  16:01:30 INFO | -chardev 
socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 
  16:01:30 INFO | -chardev 
socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 
  16:01:30 INFO | -m 512 
  16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 
  16:01:30 INFO | -kernel 
'/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat'
 
  16:01:30 INFO | -vnc :0 
  16:01:30 INFO | -chardev 
file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 
  16:01:30 INFO | -device testdev,chardev=testlog 
  16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none  
  16:01:30 INFO | -boot order=cdn,once=c,menu=off   
  16:01:30 INFO | -S 
  16:01:30 INFO | -enable-kvm

  We get

  16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, 
output in /tmp/testlog-20120907-155940-WomlFZY3
  16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1
  16:01:32 INFO | [qemu output] emulation failure
  16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 
RCX=f000 RDX=0044d2b0
  16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 
RBP=eff8 RSP=0044d2b0
  16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 
R10= R11=
  16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 
R14=1fff5000 R15=
  16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] 
CPL=0 II=0 A20=1 SMM=0 HLT=0
  16:01:32 INFO | [qemu output] ES =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] CS =0008   00a09b00 
DPL=0 CS64 [-RA]
  16:01:32 INFO | [qemu output] SS =   
  16:01:32 INFO | [qemu output] DS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] FS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] GS =0010 0044c370  00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] LDT=   8200 
DPL=0 LDT
  16:01:32 INFO | [qemu output] TR =0048 0040a452  8b00 
DPL=0 TSS64-busy
  16:01:32 INFO | [qemu output] GDT= 0040a00a 0447
  16:01:32 INFO | [qemu output] IDT=  0fff
  16:01:32 INFO | [qemu output] CR0=80010011 CR2= 
CR3=1000 CR4=0020
  16:01:32 INFO | [qemu output] DR0= DR1= 
DR2= DR3=
  16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400
  16:01:32 INFO | [qemu output] EFER=0500
  16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 
48 89 e9 48 89 c5  48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 
40 0f 94 c6 40 0f b6 f6 21 c6

  More logs will be attached to this bug report.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047576/+subscriptions



Re: [Qemu-devel] [PATCH v2 0/3] migration: Fixups for VMDESC submission

2015-03-05 Thread Lucas Meneghel Rodrigues
Just for the record, I've tested it using the virt-test reproducer and 
indeed the problem is fixed with this patchset. I'm sorry for the delay!


Thanks :)

On Mon, Feb 23, 2015 at 9:56 AM, Alexander Graf ag...@suse.de wrote:
After the vmdesc self-describing JSON blob landed upstream, some 
people

noticed their self-written scripts around migration to fail.

This patch set aims at making the transition to the new VMDESC 
containing

migration format as smooth as possible for everyone involved.

Alexander Graf (3):
  migration: Read JSON VM description on incoming migration
  migration: Allow to suppress vmdesc submission
  pc: Disable vmdesc submission for old machines

 hw/core/machine.c   | 20 
 hw/i386/pc_piix.c   |  1 +
 hw/i386/pc_q35.c|  1 +
 include/hw/boards.h |  1 +
 qemu-options.hx |  3 ++-
 savevm.c| 36 
 6 files changed, 57 insertions(+), 5 deletions(-)

--
1.7.12.4






Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-13 Thread Lucas Meneghel Rodrigues

Alex, Dave:

Virt-Test fd migration starts by sending a fd to the source vm

22:20:40 DEBUG| Send file descriptor migfd_28_1423786840 to source VM.
22:20:40 DEBUG| (monitor hmp1) Sending command 'getfd 
migfd_28_1423786840'


later on...

22:20:42 INFO | Migrating to fd:migfd_28_1423786840
22:20:42 DEBUG| (monitor hmp1) Sending command 'migrate -d 
fd:migfd_28_1423786840'

22:20:42 DEBUG| Send command: migrate -d fd:migfd_28_1423786840

Attached to this message you can find a .tar.bz2 file (~36Kb) with 
virt-test results. It contains extra information, such as a a record of 
vm registers taken periodically during the testing process.


Cheers,

Lucas

On Thu, Feb 12, 2015 at 10:36 PM, Alexander Graf ag...@suse.de wrote:



On 13.02.15 01:29, Lucas Meneghel Rodrigues wrote:

 Copying Alex.

 OK, after bisecting, this is what I've got:

 8118f0950fc77cce7873002a5021172dd6e040b5 is the first bad commit
 commit 8118f0950fc77cce7873002a5021172dd6e040b5
 Author: Alexander Graf ag...@suse.de mailto:ag...@suse.de
 Date:   Thu Jan 22 15:01:39 2015 +0100

 migration: Append JSON description of migration stream

 One of the annoyances of the current migration format is the 
fact that
 it's not self-describing. In fact, it's not properly describing 
at all.
 Some code randomly scattered throughout QEMU elaborates roughly 
how to

 read and write a stream of bytes.

 We discussed an idea during KVM Forum 2013 to add a JSON 
description of
 the migration protocol itself to the migration stream. This 
patch
 adds a section after the VM_END migration end marker that 
contains

 description data on what the device sections of the stream are
 composed of.

 This approach is backwards compatible with any QEMU version 
reading the
 stream, because QEMU just stops reading after the VM_END marker 
and

 ignores
 any data following it.

 With an additional external program this allows us to decipher 
the
 contents of any migration stream and hopefully make migration 
bugs

 easier
 to track down.

 Signed-off-by: Alexander Graf ag...@suse.de 
mailto:ag...@suse.de

 Signed-off-by: Amit Shah amit.s...@redhat.com
 mailto:amit.s...@redhat.com
 Signed-off-by: Juan Quintela quint...@redhat.com
 mailto:quint...@redhat.com

 :04 04 e9aac242a61fbd05bbb0daa3e8877970e738
 61df81f831bc86b29f65883523ea95abb36f1ec5 Mhw
 :04 04 fe0659bed17d86c43657c26622d64fd44a1af037
 7092a6b6515a3d0077f68ff2d80dbd74597a244f Minclude
 :04 04 d90d6f1fe839abf21a45eaba5829d5a6a22abeb1
 c2b1dcda197d96657458d699c185e39ae45f3c6c Mmigration
 :100644 100644 98895fee81edfbc659fc42d467e930d06b1afa7d
 80407662ad3ed860d33a9d35f5c44b1d19c4612b Msavevm.c
 :04 04 cf218bc2b841cd51ebe3972635be2cfbb1de9dfa
 7aaf3d10ef7f73413b228e854fe6f04317151e46 Mtests

 So there you go. I'm going to sleep, if you need any extra help let 
me know.


So the major difference with this patch applied is that the sender 
could

send more data than the receive wants to read. I can't see the actual
migrate command you used down there.

I haven't seen this actually being a problem so far, as the receiver
just close()s its file descriptor once it hits VM_EOF. This should 
only

break senders if they expect they can send more. That said, I think I
only tested offline migration (via exec:), so maybe QEMU is behaving
badly and actually wants to send all data and just fails the migration
without?


Alex



run-2015-02-12-22.20.21.tar.bz2
Description: application/bzip-compressed-tar


Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-13 Thread Lucas Meneghel Rodrigues



On Fri, Feb 13, 2015 at 9:18 AM, Alexander Graf ag...@suse.de wrote:



On 13.02.15 10:04, Dr. David Alan Gilbert wrote:

 * Alexander Graf (ag...@suse.de) wrote:



 On 13.02.15 01:29, Lucas Meneghel Rodrigues wrote:

 Copying Alex.

 OK, after bisecting, this is what I've got:

 8118f0950fc77cce7873002a5021172dd6e040b5 is the first bad commit
 commit 8118f0950fc77cce7873002a5021172dd6e040b5
 Author: Alexander Graf ag...@suse.de mailto:ag...@suse.de
 Date:   Thu Jan 22 15:01:39 2015 +0100

 migration: Append JSON description of migration stream

 One of the annoyances of the current migration format is the 
fact that
 it's not self-describing. In fact, it's not properly 
describing at all.
 Some code randomly scattered throughout QEMU elaborates 
roughly how to

 read and write a stream of bytes.

 We discussed an idea during KVM Forum 2013 to add a JSON 
description of
 the migration protocol itself to the migration stream. This 
patch
 adds a section after the VM_END migration end marker that 
contains

 description data on what the device sections of the stream are
 composed of.

 This approach is backwards compatible with any QEMU version 
reading the
 stream, because QEMU just stops reading after the VM_END 
marker and

 ignores
 any data following it.

 With an additional external program this allows us to 
decipher the
 contents of any migration stream and hopefully make migration 
bugs

 easier
 to track down.

 Signed-off-by: Alexander Graf ag...@suse.de 
mailto:ag...@suse.de

 Signed-off-by: Amit Shah amit.s...@redhat.com
 mailto:amit.s...@redhat.com
 Signed-off-by: Juan Quintela quint...@redhat.com
 mailto:quint...@redhat.com

 :04 04 e9aac242a61fbd05bbb0daa3e8877970e738
 61df81f831bc86b29f65883523ea95abb36f1ec5 Mhw
 :04 04 fe0659bed17d86c43657c26622d64fd44a1af037
 7092a6b6515a3d0077f68ff2d80dbd74597a244f Minclude
 :04 04 d90d6f1fe839abf21a45eaba5829d5a6a22abeb1
 c2b1dcda197d96657458d699c185e39ae45f3c6c Mmigration
 :100644 100644 98895fee81edfbc659fc42d467e930d06b1afa7d
 80407662ad3ed860d33a9d35f5c44b1d19c4612b Msavevm.c
 :04 04 cf218bc2b841cd51ebe3972635be2cfbb1de9dfa
 7aaf3d10ef7f73413b228e854fe6f04317151e46 Mtests

 So there you go. I'm going to sleep, if you need any extra help 
let me know.


 So the major difference with this patch applied is that the sender 
could
 send more data than the receive wants to read. I can't see the 
actual

 migrate command you used down there.

 I haven't seen this actually being a problem so far, as the 
receiver
 just close()s its file descriptor once it hits VM_EOF. This should 
only
 break senders if they expect they can send more. That said, I 
think I
 only tested offline migration (via exec:), so maybe QEMU is 
behaving
 badly and actually wants to send all data and just fails the 
migration

 without?


 Hmm, for such an odd change to the migration stream it's a surprise 
you

 didn't test it live.


Well, let's say I don't remember explicitly testing it live - I 
probably

did at one point.

I just verified that migrating with tcp:... works fine in master.


It is working fine with tcp migration in master indeed. The thing is, 
virt-test tests a bunch of variants, among them fd. fd is the only one 
failing from the list of things we do test (which also happen to be the 
virt-test default test set).




Alex






Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-12 Thread Lucas Meneghel Rodrigues
OK, indeed I can reproduce the problem. It's specific to the filedescriptor
migration. An easy way to reproduce it is by doing:

git clone https://github.com/autotest/virt-test.git

cd virt-test
./run -t qemu --bootstrap
./run -t qemu
--tests type_specific.io-github-autotest-qemu.migrate.default.fd

That's it. I will see if I can bisect this quickly to pinpoint the QEMU
commit that brought the regression.

The qemu master commit I just tested is:

commit 449008f86418583a1f0fb946cf91ee7b4797317d
Merge: 5c697ae bc5baff
Author: Peter Maydell peter.mayd...@linaro.org
Date:   Wed Feb 11 05:14:41 2015 +

Merge remote-tracking branch
'remotes/awilliam/tags/vfio-update-20150210.0' into staging

RCU fixes and cleanup (Paolo Bonzini)
Switch to v2 IOMMU interface (Alex Williamson)
DEBUG build fix (Alexey Kardashevskiy)

# gpg: Signature made Tue 10 Feb 2015 17:37:06 GMT using RSA key ID
3BB08B22
# gpg: Good signature from Alex Williamson alex.william...@redhat.com

# gpg: aka Alex Williamson a...@shazbot.org
# gpg: aka Alex Williamson alwil...@redhat.com
# gpg: aka Alex Williamson alex.l.william...@gmail.com


* remotes/awilliam/tags/vfio-update-20150210.0:
  vfio: Fix debug message compile error
  vfio: Use vfio type1 v2 IOMMU interface
  vfio: unmap and free BAR data in instance_finalize
  vfio: free dynamically-allocated data in instance_finalize
  vfio: cleanup vfio_get_device error path, remove vfio_populate_device
callback
  memory: unregister AddressSpace MemoryListener within BQL

Signed-off-by: Peter Maydell peter.mayd...@linaro.org


On Thu, Feb 12, 2015 at 8:19 PM, Lucas Meneghel Rodrigues look...@gmail.com
 wrote:

 From what the log says, after a round of migrations 'info migrate' does
 not respond after 4 minutes, timing out. Virt Test then shuts down the VM.
 When it tries to check the qcow2 image, it is corrupted. I'm checking out
 the latest master to see how reproducible this problem is.

 On Thu, Feb 12, 2015 at 8:12 PM, Juan Quintela quint...@redhat.com
 wrote:


 Hi

 while testing my changes I noticed that virt-test was failing.  I
 check-out master, and failures are there.

 This is one extract of the log after the 1st failure.  Notice that it
 fails randomly, not every time.

 I have to go to bed right now, so if anybody beats me with a fix, I
 would be happy when I wakeup.

 Thanks, Juan.


 22:54:07 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:07 DEBUG| (monitor hmp1)capabilities: xbzrle: off rdma-pin-all:
 off auto-converge: off zero-blocks: off
 22:54:07 DEBUG| (monitor hmp1)Migration status: active
 22:54:07 DEBUG| (monitor hmp1)total time: 2003 milliseconds
 22:54:07 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:07 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:07 DEBUG| (monitor hmp1)transferred ram: 67619 kbytes
 22:54:07 DEBUG| (monitor hmp1)throughput: 268.61 mbps
 22:54:07 DEBUG| (monitor hmp1)remaining ram: 103056 kbytes
 22:54:07 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:07 DEBUG| (monitor hmp1)duplicate: 224304 pages
 22:54:07 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:07 DEBUG| (monitor hmp1)normal: 16380 pages
 22:54:07 DEBUG| (monitor hmp1)normal bytes: 65520 kbytes
 22:54:07 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:09 DEBUG| Waiting for migration to complete (4.006475 secs)
 22:54:09 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:09 DEBUG| Send command: info migrate
 22:54:09 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:09 DEBUG| (monitor hmp1)capabilities: xbzrle: off rdma-pin-all:
 off auto-converge: off zero-blocks: off
 22:54:09 DEBUG| (monitor hmp1)Migration status: active
 22:54:09 DEBUG| (monitor hmp1)total time: 4008 milliseconds
 22:54:09 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:09 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:09 DEBUG| (monitor hmp1)transferred ram: 131397 kbytes
 22:54:09 DEBUG| (monitor hmp1)throughput: 268.57 mbps
 22:54:09 DEBUG| (monitor hmp1)remaining ram: 31392 kbytes
 22:54:09 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:09 DEBUG| (monitor hmp1)duplicate: 226311 pages
 22:54:09 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:09 DEBUG| (monitor hmp1)normal: 32289 pages
 22:54:09 DEBUG| (monitor hmp1)normal bytes: 129156 kbytes
 22:54:09 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:11 DEBUG| Waiting for migration to complete (6.011556 secs)
 22:54:11 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:11 DEBUG| Send command: info migrate
 22:54:32 WARNI| virt-tests-vm1 is not alive. Can not query the register
 status
 22:58:11 DEBUG| Destroying VM virt-tests-vm1 (PID 10880)
 22:58:11 DEBUG| Ending VM virt-tests-vm1 process (monitor)
 22:58:11 INFO | [qemu output] (Process terminated with status 0

Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-12 Thread Lucas Meneghel Rodrigues
On Thu, Feb 12, 2015 at 8:56 PM, Lucas Meneghel Rodrigues look...@gmail.com
 wrote:

 OK, indeed I can reproduce the problem. It's specific to the
 filedescriptor migration. An easy way to reproduce it is by doing:

 git clone https://github.com/autotest/virt-test.git

 cd virt-test
 ./run -t qemu --bootstrap
 ./run -t qemu
 --tests type_specific.io-github-autotest-qemu.migrate.default.fd


A little correction here, it should've been:

./run -t qemu
--tests type_specific.io-github-autotest-qemu.migrate.default.fd --qemu-bin
/path/to/qemu-built-from-master



 That's it. I will see if I can bisect this quickly to pinpoint the QEMU
 commit that brought the regression.

 The qemu master commit I just tested is:

 commit 449008f86418583a1f0fb946cf91ee7b4797317d
 Merge: 5c697ae bc5baff
 Author: Peter Maydell peter.mayd...@linaro.org
 Date:   Wed Feb 11 05:14:41 2015 +

 Merge remote-tracking branch
 'remotes/awilliam/tags/vfio-update-20150210.0' into staging

 RCU fixes and cleanup (Paolo Bonzini)
 Switch to v2 IOMMU interface (Alex Williamson)
 DEBUG build fix (Alexey Kardashevskiy)

 # gpg: Signature made Tue 10 Feb 2015 17:37:06 GMT using RSA key ID
 3BB08B22
 # gpg: Good signature from Alex Williamson 
 alex.william...@redhat.com
 # gpg: aka Alex Williamson a...@shazbot.org
 # gpg: aka Alex Williamson alwil...@redhat.com
 # gpg: aka Alex Williamson 
 alex.l.william...@gmail.com

 * remotes/awilliam/tags/vfio-update-20150210.0:
   vfio: Fix debug message compile error
   vfio: Use vfio type1 v2 IOMMU interface
   vfio: unmap and free BAR data in instance_finalize
   vfio: free dynamically-allocated data in instance_finalize
   vfio: cleanup vfio_get_device error path, remove
 vfio_populate_device callback
   memory: unregister AddressSpace MemoryListener within BQL

 Signed-off-by: Peter Maydell peter.mayd...@linaro.org


 On Thu, Feb 12, 2015 at 8:19 PM, Lucas Meneghel Rodrigues 
 look...@gmail.com wrote:

 From what the log says, after a round of migrations 'info migrate' does
 not respond after 4 minutes, timing out. Virt Test then shuts down the VM.
 When it tries to check the qcow2 image, it is corrupted. I'm checking out
 the latest master to see how reproducible this problem is.

 On Thu, Feb 12, 2015 at 8:12 PM, Juan Quintela quint...@redhat.com
 wrote:


 Hi

 while testing my changes I noticed that virt-test was failing.  I
 check-out master, and failures are there.

 This is one extract of the log after the 1st failure.  Notice that it
 fails randomly, not every time.

 I have to go to bed right now, so if anybody beats me with a fix, I
 would be happy when I wakeup.

 Thanks, Juan.


 22:54:07 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:07 DEBUG| (monitor hmp1)capabilities: xbzrle: off
 rdma-pin-all: off auto-converge: off zero-blocks: off
 22:54:07 DEBUG| (monitor hmp1)Migration status: active
 22:54:07 DEBUG| (monitor hmp1)total time: 2003 milliseconds
 22:54:07 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:07 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:07 DEBUG| (monitor hmp1)transferred ram: 67619 kbytes
 22:54:07 DEBUG| (monitor hmp1)throughput: 268.61 mbps
 22:54:07 DEBUG| (monitor hmp1)remaining ram: 103056 kbytes
 22:54:07 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:07 DEBUG| (monitor hmp1)duplicate: 224304 pages
 22:54:07 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:07 DEBUG| (monitor hmp1)normal: 16380 pages
 22:54:07 DEBUG| (monitor hmp1)normal bytes: 65520 kbytes
 22:54:07 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:09 DEBUG| Waiting for migration to complete (4.006475 secs)
 22:54:09 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:09 DEBUG| Send command: info migrate
 22:54:09 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:09 DEBUG| (monitor hmp1)capabilities: xbzrle: off
 rdma-pin-all: off auto-converge: off zero-blocks: off
 22:54:09 DEBUG| (monitor hmp1)Migration status: active
 22:54:09 DEBUG| (monitor hmp1)total time: 4008 milliseconds
 22:54:09 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:09 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:09 DEBUG| (monitor hmp1)transferred ram: 131397 kbytes
 22:54:09 DEBUG| (monitor hmp1)throughput: 268.57 mbps
 22:54:09 DEBUG| (monitor hmp1)remaining ram: 31392 kbytes
 22:54:09 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:09 DEBUG| (monitor hmp1)duplicate: 226311 pages
 22:54:09 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:09 DEBUG| (monitor hmp1)normal: 32289 pages
 22:54:09 DEBUG| (monitor hmp1)normal bytes: 129156 kbytes
 22:54:09 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:11 DEBUG| Waiting for migration to complete (6.011556 secs)
 22:54:11 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:11

Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-12 Thread Lucas Meneghel Rodrigues
From what the log says, after a round of migrations 'info migrate' does not
respond after 4 minutes, timing out. Virt Test then shuts down the VM. When
it tries to check the qcow2 image, it is corrupted. I'm checking out the
latest master to see how reproducible this problem is.

On Thu, Feb 12, 2015 at 8:12 PM, Juan Quintela quint...@redhat.com wrote:


 Hi

 while testing my changes I noticed that virt-test was failing.  I
 check-out master, and failures are there.

 This is one extract of the log after the 1st failure.  Notice that it
 fails randomly, not every time.

 I have to go to bed right now, so if anybody beats me with a fix, I
 would be happy when I wakeup.

 Thanks, Juan.


 22:54:07 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:07 DEBUG| (monitor hmp1)capabilities: xbzrle: off rdma-pin-all:
 off auto-converge: off zero-blocks: off
 22:54:07 DEBUG| (monitor hmp1)Migration status: active
 22:54:07 DEBUG| (monitor hmp1)total time: 2003 milliseconds
 22:54:07 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:07 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:07 DEBUG| (monitor hmp1)transferred ram: 67619 kbytes
 22:54:07 DEBUG| (monitor hmp1)throughput: 268.61 mbps
 22:54:07 DEBUG| (monitor hmp1)remaining ram: 103056 kbytes
 22:54:07 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:07 DEBUG| (monitor hmp1)duplicate: 224304 pages
 22:54:07 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:07 DEBUG| (monitor hmp1)normal: 16380 pages
 22:54:07 DEBUG| (monitor hmp1)normal bytes: 65520 kbytes
 22:54:07 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:09 DEBUG| Waiting for migration to complete (4.006475 secs)
 22:54:09 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:09 DEBUG| Send command: info migrate
 22:54:09 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:09 DEBUG| (monitor hmp1)capabilities: xbzrle: off rdma-pin-all:
 off auto-converge: off zero-blocks: off
 22:54:09 DEBUG| (monitor hmp1)Migration status: active
 22:54:09 DEBUG| (monitor hmp1)total time: 4008 milliseconds
 22:54:09 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:09 DEBUG| (monitor hmp1)setup: 3 milliseconds
 22:54:09 DEBUG| (monitor hmp1)transferred ram: 131397 kbytes
 22:54:09 DEBUG| (monitor hmp1)throughput: 268.57 mbps
 22:54:09 DEBUG| (monitor hmp1)remaining ram: 31392 kbytes
 22:54:09 DEBUG| (monitor hmp1)total ram: 1065796 kbytes
 22:54:09 DEBUG| (monitor hmp1)duplicate: 226311 pages
 22:54:09 DEBUG| (monitor hmp1)skipped: 0 pages
 22:54:09 DEBUG| (monitor hmp1)normal: 32289 pages
 22:54:09 DEBUG| (monitor hmp1)normal bytes: 129156 kbytes
 22:54:09 DEBUG| (monitor hmp1)dirty sync count: 0
 22:54:11 DEBUG| Waiting for migration to complete (6.011556 secs)
 22:54:11 DEBUG| (monitor hmp1) Sending command 'info migrate'
 22:54:11 DEBUG| Send command: info migrate
 22:54:32 WARNI| virt-tests-vm1 is not alive. Can not query the register
 status
 22:58:11 DEBUG| Destroying VM virt-tests-vm1 (PID 10880)
 22:58:11 DEBUG| Ending VM virt-tests-vm1 process (monitor)
 22:58:11 INFO | [qemu output] (Process terminated with status 0)
 22:58:11 DEBUG| VM virt-tests-vm1 down (monitor)
 22:58:11 DEBUG| Host does not support OpenVSwitch: Missing command:
 ovs-vswitchd
 22:58:11 DEBUG| Destroying VM virt-tests-vm1 (PID 10763)
 22:58:11 DEBUG| Shutting down VM virt-tests-vm1 (shell)
 22:58:11 DEBUG| Login command: 'ssh -o UserKnownHostsFile=/dev/null -o
 StrictHostKeyChecking=no -o PreferredAuthentications=password -p 5000
 root@192.168.10.200'
 22:58:11 DEBUG| virt-tests-vm1 alive now. Used to failed to get register
 info from guest 9 times
 22:58:13 INFO | [qemu output] (Process terminated with status 0)
 22:58:13 DEBUG| VM virt-tests-vm1 down (shell)
 22:58:14 DEBUG| Host does not support OpenVSwitch: Missing command:
 ovs-vswitchd
 22:58:14 DEBUG| Checking image file
 /mnt/kvm/src/virt-test/shared/data/images/jeos-20-64.qcow2
 22:58:14 DEBUG| Running '/bin/qemu-img info
 /mnt/kvm/src/virt-test/shared/data/images/jeos-20-64.qcow2'
 22:58:14 DEBUG| Running '/bin/qemu-img check
 /mnt/kvm/src/virt-test/shared/data/images/jeos-20-64.qcow2'
 22:58:14 ERROR| [stdout]
 22:58:14 ERROR| [stdout] 1 errors were found on the image.
 22:58:14 ERROR| [stdout] Data may be corrupted, or further writes to the
 image may corrupt it.
 22:58:14 ERROR| [stdout] 13495/163840 = 8.24% allocated, 0.03% fragmented,
 0.00% compressed clusters
 22:58:14 ERROR| [stdout] Image end offset: 885129216
 22:58:14 ERROR| [stderr] ERROR cluster 13505 refcount=1 reference=2
 22:58:14 ERROR| Errors found on image:
 '/mnt/kvm/src/virt-test/shared/data/images/jeos-20-64.qcow2'
 22:58:14 WARNI| virt-tests-vm1 is not alive. Can not query the register
 status
 22:58:14 DEBUG| Thread quit. Used to failed to get register info from
 guest 20150212-225320-Mb1E4VV7 for 1 times.




-- 
Lucas


Re: [Qemu-devel] HEAD is failing virt-test on migration tests

2015-02-12 Thread Lucas Meneghel Rodrigues
Copying Alex.

OK, after bisecting, this is what I've got:

8118f0950fc77cce7873002a5021172dd6e040b5 is the first bad commit
commit 8118f0950fc77cce7873002a5021172dd6e040b5
Author: Alexander Graf ag...@suse.de
Date:   Thu Jan 22 15:01:39 2015 +0100

migration: Append JSON description of migration stream

One of the annoyances of the current migration format is the fact that
it's not self-describing. In fact, it's not properly describing at all.
Some code randomly scattered throughout QEMU elaborates roughly how to
read and write a stream of bytes.

We discussed an idea during KVM Forum 2013 to add a JSON description of
the migration protocol itself to the migration stream. This patch
adds a section after the VM_END migration end marker that contains
description data on what the device sections of the stream are composed
of.

This approach is backwards compatible with any QEMU version reading the
stream, because QEMU just stops reading after the VM_END marker and
ignores
any data following it.

With an additional external program this allows us to decipher the
contents of any migration stream and hopefully make migration bugs
easier
to track down.

Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Amit Shah amit.s...@redhat.com
Signed-off-by: Juan Quintela quint...@redhat.com

:04 04 e9aac242a61fbd05bbb0daa3e8877970e738
61df81f831bc86b29f65883523ea95abb36f1ec5 M hw
:04 04 fe0659bed17d86c43657c26622d64fd44a1af037
7092a6b6515a3d0077f68ff2d80dbd74597a244f M include
:04 04 d90d6f1fe839abf21a45eaba5829d5a6a22abeb1
c2b1dcda197d96657458d699c185e39ae45f3c6c M migration
:100644 100644 98895fee81edfbc659fc42d467e930d06b1afa7d
80407662ad3ed860d33a9d35f5c44b1d19c4612b M savevm.c
:04 04 cf218bc2b841cd51ebe3972635be2cfbb1de9dfa
7aaf3d10ef7f73413b228e854fe6f04317151e46 M tests

So there you go. I'm going to sleep, if you need any extra help let me know.

Cheers,

Lucas

On Thu, Feb 12, 2015 at 8:56 PM, Lucas Meneghel Rodrigues look...@gmail.com
 wrote:

 OK, indeed I can reproduce the problem. It's specific to the
 filedescriptor migration. An easy way to reproduce it is by doing:

 git clone https://github.com/autotest/virt-test.git

 cd virt-test
 ./run -t qemu --bootstrap
 ./run -t qemu
 --tests type_specific.io-github-autotest-qemu.migrate.default.fd

 That's it. I will see if I can bisect this quickly to pinpoint the QEMU
 commit that brought the regression.

 The qemu master commit I just tested is:

 commit 449008f86418583a1f0fb946cf91ee7b4797317d
 Merge: 5c697ae bc5baff
 Author: Peter Maydell peter.mayd...@linaro.org
 Date:   Wed Feb 11 05:14:41 2015 +

 Merge remote-tracking branch
 'remotes/awilliam/tags/vfio-update-20150210.0' into staging

 RCU fixes and cleanup (Paolo Bonzini)
 Switch to v2 IOMMU interface (Alex Williamson)
 DEBUG build fix (Alexey Kardashevskiy)

 # gpg: Signature made Tue 10 Feb 2015 17:37:06 GMT using RSA key ID
 3BB08B22
 # gpg: Good signature from Alex Williamson 
 alex.william...@redhat.com
 # gpg: aka Alex Williamson a...@shazbot.org
 # gpg: aka Alex Williamson alwil...@redhat.com
 # gpg: aka Alex Williamson 
 alex.l.william...@gmail.com

 * remotes/awilliam/tags/vfio-update-20150210.0:
   vfio: Fix debug message compile error
   vfio: Use vfio type1 v2 IOMMU interface
   vfio: unmap and free BAR data in instance_finalize
   vfio: free dynamically-allocated data in instance_finalize
   vfio: cleanup vfio_get_device error path, remove
 vfio_populate_device callback
   memory: unregister AddressSpace MemoryListener within BQL

 Signed-off-by: Peter Maydell peter.mayd...@linaro.org


 On Thu, Feb 12, 2015 at 8:19 PM, Lucas Meneghel Rodrigues 
 look...@gmail.com wrote:

 From what the log says, after a round of migrations 'info migrate' does
 not respond after 4 minutes, timing out. Virt Test then shuts down the VM.
 When it tries to check the qcow2 image, it is corrupted. I'm checking out
 the latest master to see how reproducible this problem is.

 On Thu, Feb 12, 2015 at 8:12 PM, Juan Quintela quint...@redhat.com
 wrote:


 Hi

 while testing my changes I noticed that virt-test was failing.  I
 check-out master, and failures are there.

 This is one extract of the log after the 1st failure.  Notice that it
 fails randomly, not every time.

 I have to go to bed right now, so if anybody beats me with a fix, I
 would be happy when I wakeup.

 Thanks, Juan.


 22:54:07 DEBUG| (monitor hmp1) Response to 'info migrate'
 22:54:07 DEBUG| (monitor hmp1)capabilities: xbzrle: off
 rdma-pin-all: off auto-converge: off zero-blocks: off
 22:54:07 DEBUG| (monitor hmp1)Migration status: active
 22:54:07 DEBUG| (monitor hmp1)total time: 2003 milliseconds
 22:54:07 DEBUG| (monitor hmp1)expected downtime: 300 milliseconds
 22:54:07 DEBUG| (monitor hmp1

Re: [Qemu-devel] [PATCH] seccomp: -sandbox on won't kill Qemu when option not built in

2013-12-10 Thread Lucas Meneghel Rodrigues

On 12/10/2013 01:20 AM, Corey Bryant wrote:

IMHO the test suite should probe to see if sandbox is working or not,
and
just not use the -sandbox on arg if the host doesn't support it.


But I think this could be done on virt-test as well :)



This would make sense.

Although it sounds like Lucas was looking for an error message when
seccomp kills qemu.  Maybe virt-test could grep the audit log for the
existence of a type=SECCOMP record within the test's time of
execution, and issue a message based on that.


It's a valid idea. The problem I see with it is that not every distro 
out there uses SELinux. Not getting into the merits of whether they 
should, ideally it'd be nice to have this working on distros that won't 
use SELinux.






Re: [Qemu-devel] [PATCH] seccomp: -sandbox on won't kill Qemu when option not built in

2013-12-10 Thread Lucas Meneghel Rodrigues

On 12/10/2013 05:31 PM, Paul Moore wrote:

On Tuesday, December 10, 2013 04:48:54 PM Lucas Meneghel Rodrigues wrote:

On 12/10/2013 01:20 AM, Corey Bryant wrote:

IMHO the test suite should probe to see if sandbox is working or not,
and
just not use the -sandbox on arg if the host doesn't support it.


But I think this could be done on virt-test as well :)


This would make sense.

Although it sounds like Lucas was looking for an error message when
seccomp kills qemu.  Maybe virt-test could grep the audit log for the
existence of a type=SECCOMP record within the test's time of
execution, and issue a message based on that.


It's a valid idea. The problem I see with it is that not every distro
out there uses SELinux. Not getting into the merits of whether they
should, ideally it'd be nice to have this working on distros that won't
use SELinux.


Minor point of clarification, but audit and SELinux and independent subsystems
in the kernel.

Also, and I don't have a non-audit kernel built at the moment to verify this,
but on non-audit kernels the audit messages should be sent to syslog so you
*should* still be able to search for SECCOMP records regardless.


Ok, my bad, thanks for the clarification! We'll look into checking the 
audit log.






Re: [Qemu-devel] [PATCH] seccomp: -sandbox on won't kill Qemu when option not built in

2013-12-09 Thread Lucas Meneghel Rodrigues

On 12/09/2013 03:20 PM, Eduardo Otubo wrote:

This option was requested by virt-test team so they can run tests with
Qemu and -sandbox on set without breaking whole test if host doesn't
have support for seccomp in kernel. It covers two possibilities:

  1) Host kernel support does not support seccomp, but user installed Qemu
 package with sandbox support: Libseccomp will fail - qemu will fail
 nicely and won't stop execution.

  2) Host kernel has support but Qemu package wasn't built with sandbox
 feature. Qemu will fail nicely and won't stop execution.


It seems there was a misunderstanding of what we wanted here. The 
problem we had there happened on a -sandbox bug on Fedora 19 that got 
one of our team members confused, since qemu did not give any sort of 
useful output that would allow him to identify the bug was related to 
-sandbox (qemu was accessing a syscall outside of the whitelist on 
Fedora 19).


He took a while until he figured out -sandbox was the problem, due to 
the lack of any clues of what was going on. I was not affected due to 
the fact I was already on Fedora 20 by that time.


I assume Eduardo thought that we somehow wanted qemu to just carry on 
when seccomp requirements could not be fulfilled, but that was not our 
point. What I thought I'd commented with hum was that some more useful 
message could be printed to stderr, and perhaps make the qemu process to 
exit with rc != 0 on such errors, instead of just going dead silently.


I still couldn't quite grasp why that could not be done, but if it 
can't, so be it. No big deal.


Lucas






[Qemu-devel] [Bug 1234179] Re: QEMU segfaults during Windows 7 unattended install

2013-10-07 Thread Lucas Meneghel Rodrigues
The problem showed up this morning again,  same top commit:

10/07 01:34:42 INFO |   git:0150| git commit ID is
a684f3cf9b9b9c3cb82be87aafc463de8974610c (tag v1.4.0-4237-ga684f3c)

This time around, debug symbols were enabled on the configure line:

10/07 01:35:31 DEBUG|build_help:0588| Enabling debug symbols with option: 
--disable-strip
10/07 01:35:31 INFO |build_help:0607| Running configure on build dir
10/07 01:35:31 DEBUG|base_utils:0099| Running 
'/usr/local/autotest/tmp/virt/src/qemu/configure --target-list=x86_64-softmmu 
--enable-debug --disable-strip 
--prefix=/usr/local/autotest/tests/virt/qemu/install_root'

But no additional info on bt full:

[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib64/libthread_db.so.1.
Core was generated by `/usr/local/autotest/tests/virt/qemu/qemu -S -name 
virt-tests-vm1 -M pc -nodefau'.
Program terminated with signal 11, Segmentation fault.
#0  0x7f11f0f2fcf0 in pixman_image_get_data () from /lib64/libpixman-1.so.0
#0  0x7f11f0f2fcf0 in pixman_image_get_data () from /lib64/libpixman-1.so.0
No symbol table info available.
#1  0x7f11f2ac1be0 in ?? ()
No symbol table info available.
#2  0x in ?? ()
No symbol table info available.

I guess I need the debugging symbols for all involved libraries...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1234179

Title:
  QEMU segfaults during Windows 7 unattended install

Status in QEMU:
  New

Bug description:
  During today's automated qemu.git testing, a segmentation fault while
  installing Windows 7 SP1 happened.

  qemu.git top commit: 
  10/02 01:30:24 INFO |   git:0150| git commit ID is 
a684f3cf9b9b9c3cb82be87aafc463de8974610c (tag v1.4.0-4237-ga684f3c)

  commit a684f3cf9b9b9c3cb82be87aafc463de8974610c
  Merge: 349cd52 1cf9412
  Author: Anthony Liguori anth...@codemonkey.ws
  Date:   Mon Sep 30 17:15:27 2013 -0500

  Merge remote-tracking branch 'kraxel/seabios-1.7.3.2' into staging
  
  # By Gerd Hoffmann
  # Via Gerd Hoffmann
  * kraxel/seabios-1.7.3.2:
update seabios from 1.7.2.2 to 1.7.3.2
  
  Message-id: 1380533055-24960-1-git-send-email-kra...@redhat.com

  We have the core file saved in our test servers, we can make
  arrangements to transfer it if there's someone interested in
  investigating further. The framework saved the 'bt full' of the core
  file, that was missing some debug info:

  [Thread debugging using libthread_db enabled]
  Using host libthread_db library /lib64/libthread_db.so.1.
  Core was generated by `/usr/local/autotest/tests/virt/qemu/qemu -S -name 
virt-tests-vm1 -M pc -nodefau'.
  Program terminated with signal 11, Segmentation fault.
  #0  0x7ffc8fb86cf0 in pixman_image_get_data () from 
/lib64/libpixman-1.so.0
  #0  0x7ffc8fb86cf0 in pixman_image_get_data () from 
/lib64/libpixman-1.so.0
  No symbol table info available.
  #1  0x7ffc9165b05c in ?? ()
  No symbol table info available.
  #2  0x7ffc9382b540 in ?? ()
  No symbol table info available.
  #3  0x7ffc8f359a8d in clock_gettime () from /lib64/libc.so.6
  No symbol table info available.
  #4  0x7ffc9382b5a8 in ?? ()
  No symbol table info available.
  #5  0x00019382b4c0 in ?? ()
  No symbol table info available.
  #6  0x in ?? ()
  No symbol table info available.

  Extra info:

  Commits for the submodules:

  10/02 01:30:29 DEBUG|base_utils:0134| [stdout] Submodule path 'dtc': checked 
out 'bc895d6d09695d05ceb8b52486ffe861d6cfbdde'
  10/02 01:30:51 DEBUG|base_utils:0134| [stdout] Submodule path 'pixman': 
checked out '97336fad32acf802003855cd8bd6477fa49a12e3'
  10/02 01:30:58 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/SLOF': 
checked out '8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812'
  10/02 01:31:16 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/ipxe': 
checked out '09c5109b8585178172c7608de8d52e9d9af0b680'
  10/02 01:31:20 DEBUG|base_utils:0134| [stdout] Submodule path 
'roms/openbios': checked out '0f3d51ef22ec9166beb3ed434d253029ed7cfe84'
  10/02 01:31:21 DEBUG|base_utils:0134| [stdout] Submodule path 
'roms/qemu-palcode': checked out 'c87a92639b28ac42bc8f6c67443543b405dc479b'
  10/02 01:31:27 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/seabios': 
checked out 'ece025f5980bae88fa677bc9c0d24d2e580e205d'
  10/02 01:31:28 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/sgabios': 
checked out '23d474943dcd55d0550a3d20b3d30e9040a4f15b'
  10/02 01:31:31 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/vgabios': 
checked out '19ea12c230ded95928ecaef0db47a82231c2e485'

  Configure options:

  10/02 01:31:32 DEBUG|base_utils:0099| Running 
'/usr/local/autotest/tmp/virt/src/qemu/configure --target-list=x86_64-softmmu 
--disable-strip --prefix=/usr/local/autotest/tests/virt/qemu/install_root'
  10/02 01:31:35 DEBUG|env_proces:0829| (address cache) DHCP lease OK: 

[Qemu-devel] [Bug 1234179] Re: QEMU segfaults during Windows 7 unattended install

2013-10-03 Thread Lucas Meneghel Rodrigues
Good point, I've just changed the configure line to include --enable-
debug.

About the relation of the crash with the top commit, We can't ensure it
was because of this top commit, could be other patches that were applied
from one day to another. We only test qemu.git once a day, we don't have
enough resources to test commit per commit.

Also, this crash apparently is not 100% reproducible. Today's jobs did
not have it, for instance. I guess we don't have enough information
about the crash, given that I did not enable debug symbols.

I'm fine with closing this issue, if I see it again, I can reopen it and
hopefully this time we'll have a more useful bt full report.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1234179

Title:
  QEMU segfaults during Windows 7 unattended install

Status in QEMU:
  New

Bug description:
  During today's automated qemu.git testing, a segmentation fault while
  installing Windows 7 SP1 happened.

  qemu.git top commit: 
  10/02 01:30:24 INFO |   git:0150| git commit ID is 
a684f3cf9b9b9c3cb82be87aafc463de8974610c (tag v1.4.0-4237-ga684f3c)

  commit a684f3cf9b9b9c3cb82be87aafc463de8974610c
  Merge: 349cd52 1cf9412
  Author: Anthony Liguori anth...@codemonkey.ws
  Date:   Mon Sep 30 17:15:27 2013 -0500

  Merge remote-tracking branch 'kraxel/seabios-1.7.3.2' into staging
  
  # By Gerd Hoffmann
  # Via Gerd Hoffmann
  * kraxel/seabios-1.7.3.2:
update seabios from 1.7.2.2 to 1.7.3.2
  
  Message-id: 1380533055-24960-1-git-send-email-kra...@redhat.com

  We have the core file saved in our test servers, we can make
  arrangements to transfer it if there's someone interested in
  investigating further. The framework saved the 'bt full' of the core
  file, that was missing some debug info:

  [Thread debugging using libthread_db enabled]
  Using host libthread_db library /lib64/libthread_db.so.1.
  Core was generated by `/usr/local/autotest/tests/virt/qemu/qemu -S -name 
virt-tests-vm1 -M pc -nodefau'.
  Program terminated with signal 11, Segmentation fault.
  #0  0x7ffc8fb86cf0 in pixman_image_get_data () from 
/lib64/libpixman-1.so.0
  #0  0x7ffc8fb86cf0 in pixman_image_get_data () from 
/lib64/libpixman-1.so.0
  No symbol table info available.
  #1  0x7ffc9165b05c in ?? ()
  No symbol table info available.
  #2  0x7ffc9382b540 in ?? ()
  No symbol table info available.
  #3  0x7ffc8f359a8d in clock_gettime () from /lib64/libc.so.6
  No symbol table info available.
  #4  0x7ffc9382b5a8 in ?? ()
  No symbol table info available.
  #5  0x00019382b4c0 in ?? ()
  No symbol table info available.
  #6  0x in ?? ()
  No symbol table info available.

  Extra info:

  Commits for the submodules:

  10/02 01:30:29 DEBUG|base_utils:0134| [stdout] Submodule path 'dtc': checked 
out 'bc895d6d09695d05ceb8b52486ffe861d6cfbdde'
  10/02 01:30:51 DEBUG|base_utils:0134| [stdout] Submodule path 'pixman': 
checked out '97336fad32acf802003855cd8bd6477fa49a12e3'
  10/02 01:30:58 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/SLOF': 
checked out '8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812'
  10/02 01:31:16 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/ipxe': 
checked out '09c5109b8585178172c7608de8d52e9d9af0b680'
  10/02 01:31:20 DEBUG|base_utils:0134| [stdout] Submodule path 
'roms/openbios': checked out '0f3d51ef22ec9166beb3ed434d253029ed7cfe84'
  10/02 01:31:21 DEBUG|base_utils:0134| [stdout] Submodule path 
'roms/qemu-palcode': checked out 'c87a92639b28ac42bc8f6c67443543b405dc479b'
  10/02 01:31:27 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/seabios': 
checked out 'ece025f5980bae88fa677bc9c0d24d2e580e205d'
  10/02 01:31:28 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/sgabios': 
checked out '23d474943dcd55d0550a3d20b3d30e9040a4f15b'
  10/02 01:31:31 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/vgabios': 
checked out '19ea12c230ded95928ecaef0db47a82231c2e485'

  Configure options:

  10/02 01:31:32 DEBUG|base_utils:0099| Running 
'/usr/local/autotest/tmp/virt/src/qemu/configure --target-list=x86_64-softmmu 
--disable-strip --prefix=/usr/local/autotest/tests/virt/qemu/install_root'
  10/02 01:31:35 DEBUG|env_proces:0829| (address cache) DHCP lease OK: 
00:30:48:c5:d6:e2 -- 10.16.72.38
  10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Install prefix
/usr/local/autotest/tests/virt/qemu/install_root
  10/02 01:31:40 DEBUG|base_utils:0134| [stdout] BIOS directory
/usr/local/autotest/tests/virt/qemu/install_root/share/qemu
  10/02 01:31:40 DEBUG|base_utils:0134| [stdout] binary directory  
/usr/local/autotest/tests/virt/qemu/install_root/bin
  10/02 01:31:40 DEBUG|base_utils:0134| [stdout] library directory 
/usr/local/autotest/tests/virt/qemu/install_root/lib
  10/02 01:31:40 DEBUG|base_utils:0134| [stdout] libexec directory 
/usr/local/autotest/tests/virt/qemu/install_root/libexec
  

[Qemu-devel] [Bug 1234179] [NEW] QEMU segfaults during Windows 7 unattended install

2013-10-02 Thread Lucas Meneghel Rodrigues
Public bug reported:

During today's automated qemu.git testing, a segmentation fault while
installing Windows 7 SP1 happened.

qemu.git top commit: 
10/02 01:30:24 INFO |   git:0150| git commit ID is 
a684f3cf9b9b9c3cb82be87aafc463de8974610c (tag v1.4.0-4237-ga684f3c)

commit a684f3cf9b9b9c3cb82be87aafc463de8974610c
Merge: 349cd52 1cf9412
Author: Anthony Liguori anth...@codemonkey.ws
Date:   Mon Sep 30 17:15:27 2013 -0500

Merge remote-tracking branch 'kraxel/seabios-1.7.3.2' into staging

# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/seabios-1.7.3.2:
  update seabios from 1.7.2.2 to 1.7.3.2

Message-id: 1380533055-24960-1-git-send-email-kra...@redhat.com

We have the core file saved in our test servers, we can make
arrangements to transfer it if there's someone interested in
investigating further. The framework saved the 'bt full' of the core
file, that was missing some debug info:

[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib64/libthread_db.so.1.
Core was generated by `/usr/local/autotest/tests/virt/qemu/qemu -S -name 
virt-tests-vm1 -M pc -nodefau'.
Program terminated with signal 11, Segmentation fault.
#0  0x7ffc8fb86cf0 in pixman_image_get_data () from /lib64/libpixman-1.so.0
#0  0x7ffc8fb86cf0 in pixman_image_get_data () from /lib64/libpixman-1.so.0
No symbol table info available.
#1  0x7ffc9165b05c in ?? ()
No symbol table info available.
#2  0x7ffc9382b540 in ?? ()
No symbol table info available.
#3  0x7ffc8f359a8d in clock_gettime () from /lib64/libc.so.6
No symbol table info available.
#4  0x7ffc9382b5a8 in ?? ()
No symbol table info available.
#5  0x00019382b4c0 in ?? ()
No symbol table info available.
#6  0x in ?? ()
No symbol table info available.

Extra info:

Commits for the submodules:

10/02 01:30:29 DEBUG|base_utils:0134| [stdout] Submodule path 'dtc': checked 
out 'bc895d6d09695d05ceb8b52486ffe861d6cfbdde'
10/02 01:30:51 DEBUG|base_utils:0134| [stdout] Submodule path 'pixman': checked 
out '97336fad32acf802003855cd8bd6477fa49a12e3'
10/02 01:30:58 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/SLOF': 
checked out '8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812'
10/02 01:31:16 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/ipxe': 
checked out '09c5109b8585178172c7608de8d52e9d9af0b680'
10/02 01:31:20 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/openbios': 
checked out '0f3d51ef22ec9166beb3ed434d253029ed7cfe84'
10/02 01:31:21 DEBUG|base_utils:0134| [stdout] Submodule path 
'roms/qemu-palcode': checked out 'c87a92639b28ac42bc8f6c67443543b405dc479b'
10/02 01:31:27 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/seabios': 
checked out 'ece025f5980bae88fa677bc9c0d24d2e580e205d'
10/02 01:31:28 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/sgabios': 
checked out '23d474943dcd55d0550a3d20b3d30e9040a4f15b'
10/02 01:31:31 DEBUG|base_utils:0134| [stdout] Submodule path 'roms/vgabios': 
checked out '19ea12c230ded95928ecaef0db47a82231c2e485'

Configure options:

10/02 01:31:32 DEBUG|base_utils:0099| Running 
'/usr/local/autotest/tmp/virt/src/qemu/configure --target-list=x86_64-softmmu 
--disable-strip --prefix=/usr/local/autotest/tests/virt/qemu/install_root'
10/02 01:31:35 DEBUG|env_proces:0829| (address cache) DHCP lease OK: 
00:30:48:c5:d6:e2 -- 10.16.72.38
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Install prefix
/usr/local/autotest/tests/virt/qemu/install_root
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] BIOS directory
/usr/local/autotest/tests/virt/qemu/install_root/share/qemu
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] binary directory  
/usr/local/autotest/tests/virt/qemu/install_root/bin
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] library directory 
/usr/local/autotest/tests/virt/qemu/install_root/lib
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] libexec directory 
/usr/local/autotest/tests/virt/qemu/install_root/libexec
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] include directory 
/usr/local/autotest/tests/virt/qemu/install_root/include
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] config directory  
/usr/local/autotest/tests/virt/qemu/install_root/etc
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] local state directory   
/usr/local/autotest/tests/virt/qemu/install_root/var
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Manual directory  
/usr/local/autotest/tests/virt/qemu/install_root/share/man
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] ELF interp prefix 
/usr/gnemul/qemu-%M
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Source path   
/usr/local/autotest/tmp/virt/src/qemu
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] C compilercc
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Host C compiler   cc
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] C++ compiler  c++
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] Objective-C compiler cc
10/02 01:31:40 DEBUG|base_utils:0134| [stdout] CFLAGS-O2 

[Qemu-devel] [PATCH] hmp: Print \n after [not inserted]

2013-10-02 Thread Lucas Meneghel Rodrigues
I've noticed this when virt-test QEMU monitor protocol
code was getting all confused with output like:

'Removable device: not locked, tray closed\n [not inserted](qemu) '

Since it was breaking some assumptions on that code. I've
fixed the prompt matching code to be more lenient, but here
the human monitor is supposed to print the newline anyway.

CC: Stefan Hajnoczi stefa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hmp.c| 2 +-
 roms/seabios | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hmp.c b/hmp.c
index 5891507..2d2e5f8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -367,7 +367,7 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
 info-value-inserted-iops_wr_max,
 info-value-inserted-iops_size);
 } else {
-monitor_printf(mon,  [not inserted]);
+monitor_printf(mon,  [not inserted]\n);
 }
 
 if (verbose) {
diff --git a/roms/seabios b/roms/seabios
index ece025f..7093aa5 16
--- a/roms/seabios
+++ b/roms/seabios
@@ -1 +1 @@
-Subproject commit ece025f5980bae88fa677bc9c0d24d2e580e205d
+Subproject commit 7093aa58046f8685025b0198708e7768733a017d
-- 
1.8.3.1




Re: [Qemu-devel] [PATCH] hmp: Print \n after [not inserted]

2013-10-02 Thread Lucas Meneghel Rodrigues

On 10/02/2013 10:08 PM, Lucas Meneghel Rodrigues wrote:

I've noticed this when virt-test QEMU monitor protocol
code was getting all confused with output like:

'Removable device: not locked, tray closed\n [not inserted](qemu)'

Since it was breaking some assumptions on that code. I've
fixed the prompt matching code to be more lenient, but here
the human monitor is supposed to print the newline anyway.


Oh well, it seems that we're not supposed to have the newline there by 
the look of the resulting output. Please ignore this patch.



CC: Stefan Hajnoczi stefa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
  hmp.c| 2 +-
  roms/seabios | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hmp.c b/hmp.c
index 5891507..2d2e5f8 100644
--- a/hmp.c
+++ b/hmp.c
@@ -367,7 +367,7 @@ void hmp_info_block(Monitor *mon, const QDict *qdict)
  info-value-inserted-iops_wr_max,
  info-value-inserted-iops_size);
  } else {
-monitor_printf(mon,  [not inserted]);
+monitor_printf(mon,  [not inserted]\n);
  }

  if (verbose) {
diff --git a/roms/seabios b/roms/seabios
index ece025f..7093aa5 16
--- a/roms/seabios
+++ b/roms/seabios
@@ -1 +1 @@
-Subproject commit ece025f5980bae88fa677bc9c0d24d2e580e205d
+Subproject commit 7093aa58046f8685025b0198708e7768733a017d






[Qemu-devel] [Build bug] Problem checking out submodules

2013-10-01 Thread Lucas Meneghel Rodrigues

Hello:

In the daily qemu.git autotest run, I started to see the following 
problem while checking out the qemu.git tree and checking out the 
submodules:



$ git submodule update
Submodule path 'dtc': checked out 'bc895d6d09695d05ceb8b52486ffe861d6cfbdde'
Submodule path 'pixman': checked out '97336fad32acf802003855cd8bd6477fa49a12e3'
Submodule path 'roms/SLOF': checked out 
'8cfdfc43f4c4c8c8dfa4b7cf16f7c19c84eee812'
Submodule path 'roms/ipxe': checked out 
'09c5109b8585178172c7608de8d52e9d9af0b680'
Submodule path 'roms/openbios': checked out 
'0f3d51ef22ec9166beb3ed434d253029ed7cfe84'
Submodule path 'roms/qemu-palcode': checked out 
'c87a92639b28ac42bc8f6c67443543b405dc479b'
Cloning into 'roms/seabios'...
remote: Counting objects: 9706, done.
remote: Compressing objects: 100% (2392/2392), done.
remote: Total 9706 (delta 7753), reused 9244 (delta 7308)
Receiving objects: 100% (9706/9706), 2.26 MiB | 220.00 KiB/s, done.
Resolving deltas: 100% (7753/7753), done.
fatal: reference is not a tree: ece025f5980bae88fa677bc9c0d24d2e580e205d
Cloning into 'roms/sgabios'...
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 24 (delta 8), reused 0 (delta 0)
Receiving objects: 100% (24/24), 44.33 KiB | 0 bytes/s, done.
Resolving deltas: 100% (8/8), done.
Submodule path 'roms/sgabios': checked out 
'23d474943dcd55d0550a3d20b3d30e9040a4f15b'
Cloning into 'roms/vgabios'...
remote: Counting objects: 1281, done.
remote: Compressing objects: 100% (381/381), done.
remote: Total 1281 (delta 898), reused 1281 (delta 898)
Receiving objects: 100% (1281/1281), 762.30 KiB | 172.00 KiB/s, done.
Resolving deltas: 100% (898/898), done.
Submodule path 'roms/vgabios': checked out 
'19ea12c230ded95928ecaef0db47a82231c2e485'
Unable to checkout 'ece025f5980bae88fa677bc9c0d24d2e580e205d' in submodule path 
'roms/seabios'


Top commit:


commit a684f3cf9b9b9c3cb82be87aafc463de8974610c
Merge: 349cd52 1cf9412
Author: Anthony Liguori anth...@codemonkey.ws
Date:   Mon Sep 30 17:15:27 2013 -0500

Merge remote-tracking branch 'kraxel/seabios-1.7.3.2' into staging

# By Gerd Hoffmann
# Via Gerd Hoffmann
* kraxel/seabios-1.7.3.2:
  update seabios from 1.7.2.2 to 1.7.3.2

Message-id: 1380533055-24960-1-git-send-email-kra...@redhat.com



Can someone please take a look at fixing this? Thanks!

Lucas



Re: [Qemu-devel] [Build bug] Problem checking out submodules

2013-10-01 Thread Lucas Meneghel Rodrigues

On 10/01/2013 04:37 PM, Alex Bennée wrote:


l...@redhat.com writes:


Hello:

In the daily qemu.git autotest run, I started to see the following
problem while checking out the qemu.git tree and checking out the
submodules:


$ git submodule update
snip
fatal: reference is not a tree: ece025f5980bae88fa677bc9c0d24d2e580e205d
snip
Unable to checkout 'ece025f5980bae88fa677bc9c0d24d2e580e205d' in submodule path 
'roms/seabios'


It looks like a recent commit to update the version of SeaBIOS used
broke the build as the qemu mirror hasn't been updated yet. You can work
around it for now by patching .gitmodules:


Ok, thanks for the explanation. Local patching is not really a scalable 
option when performing automated testing though. I'll keep the daily job 
running, and when the mirror is updated, the failures will stop.


Cheers,

Lucas




Re: [Qemu-devel] [Build bug] Problem checking out submodules

2013-10-01 Thread Lucas Meneghel Rodrigues

On 10/01/2013 04:52 PM, Alex Bennée wrote:


l...@redhat.com writes:


On 10/01/2013 04:37 PM, Alex Bennée wrote:


l...@redhat.com writes:


Hello:

In the daily qemu.git autotest run, I started to see the following
problem while checking out the qemu.git tree and checking out the
submodules:


Oh I just noticed that. Is this Stefan's buildbot stuff or an internal
auto-test set-up? I only ask because I noticed this while testing my
Travis patches. I'm trying to get a feel for what CI type tasks are
running in QEMU world, both public and internal to companies.


That's an internal autotest test grid. Once a day we check the latest 
qemu master and run sort of a smoke style test job, although it's not 
so, 'smoky', since it takes about a couple of hours to run. Tests covered:


1) Installing Fedora 19 on a host
2) git clone the latest master
3) Install a RHEL 6.4 guest from kickstart
4) Basic boot, reboot, single host migration using tcp, unix socket, fd 
and exec migration
5) Install a Windows 7 guest from an unattended XML, using the latest 
virtio drivers that our windows drivers team releases.

6) Perform the same tests outlined in 4)

I hope it gives you a better idea of what's going on.



Re: [Qemu-devel] [Build bug] Problem checking out submodules

2013-10-01 Thread Lucas Meneghel Rodrigues

On 10/01/2013 10:32 PM, Anthony Liguori wrote:

Should be better now.


Thanks, Anthony!




[Qemu-devel] [Bug 1062411] Re: QEMU fails during migration and reports qemu: VQ 0 size 0x80 Guest index 0x2d6 inconsistent with Host index 0x18: delta 0x2be

2013-09-25 Thread Lucas Meneghel Rodrigues
Yep, I did let this one slip...

In any case, I don't see this problem anymore, it was fixed a long while
ago. Are you trying QEMU from the latest master?

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1062411

Title:
  QEMU fails during migration and reports qemu: VQ 0 size 0x80 Guest
  index 0x2d6 inconsistent with Host index 0x18: delta 0x2be

Status in QEMU:
  New

Bug description:
  This issue is reproducing consistently on automated testing, verified
  on manual testing (although it may require many tries).

  Steps to reproduce:

  1) Start a linux guest. The command line used by automated testing
  was:

  10/05 06:48:27 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
  10/05 06:48:27 INFO |kvm_vm:1605| -S 
  10/05 06:48:27 INFO |kvm_vm:1605| -name 'vm1' 
  10/05 06:48:27 INFO |kvm_vm:1605| -nodefaults 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-062311-r6UwQhzg,path=/tmp/serial-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-062311-r6UwQhzg 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-062311-r6UwQhzg,path=/tmp/seabios-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-062311-r6UwQhzg,iobase=0x402 
  10/05 06:48:27 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
  10/05 06:48:27 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idbdMz8N,mac='9a:cf:d0:d1:d2:d3',id='ida0Kc7l' 
  10/05 06:48:27 INFO |kvm_vm:1605| -netdev tap,id=idbdMz8N,fd=21 
  10/05 06:48:27 INFO |kvm_vm:1605| -m 2048 
  10/05 06:48:27 INFO |kvm_vm:1605| -smp 2,cores=1,threads=1,sockets=2 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 
  10/05 06:48:27 INFO |kvm_vm:1605| -vnc :0 
  10/05 06:48:27 INFO |kvm_vm:1605| -vga std 
  10/05 06:48:27 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none  
  10/05 06:48:27 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off  
  10/05 06:48:27 INFO |kvm_vm:1605| -enable-kvm

  Start a new VM in incoming mode. The example on this bug is using TCP
  protocol:

  10/05 07:18:56 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
  10/05 07:18:56 INFO |kvm_vm:1605| -S 
  10/05 07:18:56 INFO |kvm_vm:1605| -name 'vm1' 
  10/05 07:18:56 INFO |kvm_vm:1605| -nodefaults 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-071855-5QYsCtRS,path=/tmp/serial-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-071855-5QYsCtRS 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-071855-5QYsCtRS,path=/tmp/seabios-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-071855-5QYsCtRS,iobase=0x402 
  10/05 07:18:56 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
  10/05 07:18:56 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idERNnUO,mac='9a:cf:d0:d1:d2:d3',id='ideI7zfw' 
  10/05 07:18:56 INFO |kvm_vm:1605| -netdev tap,id=idERNnUO,fd=32 
  10/05 07:18:56 INFO |

Re: [Qemu-devel] updated: kvm networking todo wiki

2013-05-23 Thread Lucas Meneghel Rodrigues

On 23/05/13 05:50 AM, Michael S. Tsirkin wrote:

Hey guys,
I've updated the kvm networking todo wiki with current projects.
Will try to keep it up to date more often.
Original announcement below.



I've put up a wiki page with a kvm networking todo list,
mainly to avoid effort duplication, but also in the hope
to draw attention to what I think we should try addressing
in KVM:

http://www.linux-kvm.org/page/NetworkingTodo

This page could cover all networking related activity in KVM,
currently most info is related to virtio-net.

Note: if there's no developer listed for an item,
this just means I don't know of anyone actively working
on an issue at the moment, not that no one intends to.

I would appreciate it if others working on one of the items on this list
would add their names so we can communicate better.  If others like this
wiki page, please go ahead and add stuff you are working on if any.

It would be especially nice to add autotest projects:
there is just a short test matrix and a catch-all
'Cover test matrix with autotest', currently.


Ok, I'll take a look and fill in with currently available networking tests.


Currently there are some links to Red Hat bugzilla entries,
feel free to add links to other bugzillas.

Thanks!






Re: [Qemu-devel] [PATCH v3] tests: set MALLOC_PERTURB_ to expose memory bugs

2013-05-22 Thread Lucas Meneghel Rodrigues

On 22/05/13 05:16 AM, Stefan Hajnoczi wrote:

glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environment
variable is set.  The value of the environment variable determines the
bit pattern used to wipe memory.  For more information, see
http://udrepper.livejournal.com/11429.html.

Set MALLOC_PERTURB_ for gtester and qemu-iotests.  Note we pick a random
value from 1 to 255 to expose more bugs.  If you need to reproduce a
crash use 'show environment' in gdb to extract the MALLOC_PERTURB_
value from a core dump.

Both make check and qemu-iotests pass with MALLOC_PERTURB_ enabled.


This looks good to me, thanks Stefan!

Acked-by: Lucas Meneghel Rodrigues l...@redhat.com


Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
v3:
  * Use $ escaping in tests/Makefile [eblake]

v2:
  * Randomize MALLOC_PERTURB_ value [armbru]
  * Preserve existing MALLOC_PERTURB_ variable, if set [danpb]

  tests/Makefile   | 5 -
  tests/qemu-iotests/check | 3 ++-
  2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index a307d5a..7844cd7 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -171,6 +171,7 @@ GCOV_OPTIONS = -n $(if $(V),-f,)
  $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: 
$(check-qtest-y)
$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
+   MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(($$RANDOM % 255 + 1))} \
gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),GTESTER 
$@)
$(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
  echo Gcov report for $$f:;\
@@ -180,7 +181,9 @@ $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): 
check-qtest-%: $(check-qtest-y)
  .PHONY: $(patsubst %, check-%, $(check-unit-y))
  $(patsubst %, check-%, $(check-unit-y)): check-%: %
$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
-   $(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,GTESTER 
$*)
+   $(call quiet-command, \
+   MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(($$RANDOM % 255 + 1))} \
+   gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,GTESTER $*)
$(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y); do \
  echo Gcov report for $$f:;\
  $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \
diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index 432732c..74628ae 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -214,7 +214,8 @@ do
start=`_wallclock`
$timestamp  echo -n [`date +%T`]
[ ! -x $seq ]  chmod u+x $seq # ensure we can run it
-   ./$seq $tmp.out 21
+   MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \
+   ./$seq $tmp.out 21
sts=$?
$timestamp  _timestamp
stop=`_wallclock`






Re: [Qemu-devel] [PATCH] tests: set MALLOC_PERTURB_ to expose memory bugs

2013-05-17 Thread Lucas Meneghel Rodrigues

On 17/05/13 07:07 AM, Daniel P. Berrange wrote:

If you want punishment, why not go for extra punishment?

MALLOC_PERTURB_=$(($RANDOM % 255 + 1))


That could lead to non-reproducable failures though. I think it is better
to use a fixed value so that you're more likely to be able to reproduce
the issue every time you run the tests.

Rather than setting MALLOC_PERTURB_=1 unconditionally in the Makefile
though, it ought to honour any existing MALLOC_PERTURB_ env variable
the user has set. That could let automated test harness run repeatedly
with random MALLOC_PERTURB_, while still giving a deterministic value
for developers by default.


Indeed. I've never thought about it, thanks for sharing the insight.



Re: [Qemu-devel] [PATCH] tests: set MALLOC_PERTURB_ to expose memory bugs

2013-05-17 Thread Lucas Meneghel Rodrigues

On 17/05/13 08:15 AM, Stefan Hajnoczi wrote:

On Fri, May 17, 2013 at 11:54 AM, Markus Armbruster arm...@redhat.com wrote:

Stefan Hajnoczi stefa...@redhat.com writes:


glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environment
variable is set.  The value of the environment variable determines the
bit pattern used to wipe memory.  For more information, see
http://udrepper.livejournal.com/11429.html.

Set MALLOC_PERTURB_ for gtester and qemu-iotests.  Note we always set
the environment variable to 1 so the test is deterministic.  Setting a
random variable might expose more bugs but would be harder to reproduce.

Both make check and qemu-iotests pass with MALLOC_PERTURB_ enabled.

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
Lucas noticed KVM autotest failures when enabling MALLOC_PERTURB_.  By enabling
it for in-tree test suites we can detect memory management errors earlier.

  tests/Makefile   | 4 +++-
  tests/qemu-iotests/check | 2 +-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index a307d5a..25f6d28 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -171,6 +171,7 @@ GCOV_OPTIONS = -n $(if $(V),-f,)
  $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: 
$(check-qtest-y)
   $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
   $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
+ MALLOC_PERTURB_=1 \
   gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),GTESTER 
$@)
   $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
 echo Gcov report for $$f:;\


If you want punishment, why not go for extra punishment?

MALLOC_PERTURB_=$(($RANDOM % 255 + 1))


Covered in the commit description:
Note we always set
the environment variable to 1 so the test is deterministic.  Setting a
random variable might expose more bugs but would be harder to reproduce.

I didn't want to clutter output with MALLOC_PERTURB_=123 on every
run.  AFAIK we have no log where this can be silently stashed.  I
guess we could write it to a file and add that to .gitignore.


Yes, you could consider to have a debug log or something similar.



Re: [Qemu-devel] [PATCH] tests: set MALLOC_PERTURB_ to expose memory bugs

2013-05-17 Thread Lucas Meneghel Rodrigues

On 17/05/13 07:58 AM, Markus Armbruster wrote:

Daniel P. Berrange berra...@redhat.com writes:


On Fri, May 17, 2013 at 11:54:12AM +0200, Markus Armbruster wrote:

Stefan Hajnoczi stefa...@redhat.com writes:


glibc wipes malloc(3) memory when the MALLOC_PERTURB_ environment
variable is set.  The value of the environment variable determines the
bit pattern used to wipe memory.  For more information, see
http://udrepper.livejournal.com/11429.html.

Set MALLOC_PERTURB_ for gtester and qemu-iotests.  Note we always set
the environment variable to 1 so the test is deterministic.  Setting a
random variable might expose more bugs but would be harder to reproduce.

Both make check and qemu-iotests pass with MALLOC_PERTURB_ enabled.

Signed-off-by: Stefan Hajnoczi stefa...@redhat.com
---
Lucas noticed KVM autotest failures when enabling MALLOC_PERTURB_.  By enabling
it for in-tree test suites we can detect memory management errors earlier.

  tests/Makefile   | 4 +++-
  tests/qemu-iotests/check | 2 +-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index a307d5a..25f6d28 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -171,6 +171,7 @@ GCOV_OPTIONS = -n $(if $(V),-f,)
  $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: 
$(check-qtest-y)
$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
+   MALLOC_PERTURB_=1 \
gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y),GTESTER 
$@)
$(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y); do \
  echo Gcov report for $$f:;\


If you want punishment, why not go for extra punishment?

MALLOC_PERTURB_=$(($RANDOM % 255 + 1))


That could lead to non-reproducable failures though. I think it is better
to use a fixed value so that you're more likely to be able to reproduce
the issue every time you run the tests.


A fixed value misses failures.

A random value is just as reproducible as a fixed one, simply use the
same value.  Requires the value to be logged, of course.


That's a pretty great idea, Markus. I'm going to implement it in 
virt-test, thanks!





Re: [Qemu-devel] [BUG latest master] - qemu segfaults when issuing screendump cmd

2013-04-18 Thread Lucas Meneghel Rodrigues
On Thu, 2013-04-18 at 08:53 +0200, Gerd Hoffmann wrote:
  Can you try this?
git://git.kraxel.org/qemu rebase/pixman
 
 
  With current master, qemu crashes.
 
 FYI: pull req sent, anthony merged, so it is fixed in master now.
 
 autotest might need adaptions nevertheless, on headless configurations
 (-vga none) qemu starts throwing errors now (due to lack of a screen it
 can dump from) instead of silently doing nothing.

Oh, absolutely. An error at least is normal program operation/behavior,
so we'll adapt it. It's rather different than a segmentation fault,
which is a bug regardless of the circumstances.

Thanks, I'll verify and mark the bug as fixed.





[Qemu-devel] [Bug 1169254] Re: latest qemu.git master - qemu-system-x86_64 crashes when issuing screendump command over monitor

2013-04-18 Thread Lucas Meneghel Rodrigues
Gerd sent a pull request that was merged, fixing the problem

top commit: 09dada400328d75daf79e3eca1e48e024fec148d

Problem is now fixed on latest qemu.git master.

** Changed in: qemu
   Status: New = Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169254

Title:
  latest qemu.git master - qemu-system-x86_64 crashes when issuing
  screendump command over monitor

Status in QEMU:
  Fix Committed

Bug description:
  Found the problem during sanity test of the 'next' branch

  git commit ID is e2ec3f976803b360c70d9ae2ba13852fa5d11665 (tag
  v1.4.0-1202-ge2ec3f9)

  For reference, kernel is upstream kvm.git

  git commit ID is 31880c37c11e28cb81c70757e38392b42e695dc6 (tag
  v3.8-12524-g31880c3)

  Steps to reproduce:

  Start qemu, reference cmd:

  MALLOC_PERTURB_=1 /usr/local/autotest/tests/virt/qemu/qemu \
  -S \
  -name 'vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=qmp_id_qmp1,mode=control \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-120337-CX4dw84y,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-120337-CX4dw84y,path=/tmp/seabios-20130415-120337-CX4dw84y,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-120337-CX4dw84y,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=id7t6ont,mac='9a:16:17:18:19:1a',id='idQ3SyRX' \
  -netdev tap,id=id7t6ont,vhost=on,fd=24 \
  -m 2048 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'Opteron_G3' \
  -M pc \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/isos/linux/RHEL-6.3-x86_64-DVD.iso',media=cdrom,index=2
 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/ks.iso',media=cdrom,index=1
 \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -kernel 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/vmlinuz' \
  -append 'ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0' \
  -initrd 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/initrd.img' \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=d,menu=off  \
  -enable-kvm

  2) Connect to the monitor

  nc -U /tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait

  3) Unpause the VM

  [root@virtblade03 autotest]# nc -U /tmp/monitor-hmp1-20130415-120943-D6zKUQFO
  QEMU 1.4.50 monitor - type 'help' for more information
  (qemu) cont
  cont

  4) Ask for a screendump

  (qemu) screendump abc.ppm
  screendump abc.ppm

  At this point, qemu crashes.

   Program terminated with signal 11, Segmentation fault.
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   834 if (image-type == BITS)
   (gdb) bt
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   #1  0x7f0b44158374 in ppm_save (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, ds=0x7f0b466b7a50, errp=0x7fff41c08260)
   at /usr/local/autotest/tmp/virt/src/qemu/hw/display/vga.c:2401
   #2  0x7f0b4410f18e in qmp_screendump (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, errp=0x7fff41c08260) at ui/console.c:195
   #3  0x7f0b43ffc77a in hmp_screen_dump (mon=0x7f0b46530d80, 
qdict=optimized out) at hmp.c:1335
   #4  0x7f0b4418c889 in handle_user_command (mon=mon@entry=0x7f0b46530d80, 
cmdline=optimized out) at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4007
   #5  0x7f0b4418cc0b in monitor_command_cb (mon=0x7f0b46530d80, 
cmdline=optimized out, opaque=optimized out)
   at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4623
   #6  0x7f0b440fe69b in readline_handle_byte (rs=0x7f0b46689a30, 
ch=optimized out) at readline.c:373
   #7  0x7f0b4418c954 in monitor_read (opaque=optimized out, 
buf=optimized out, size=optimized out) at 
/usr/local/autotest/tmp/virt/src/qemu/monitor.c:4609
   #8  0x7f0b440ec029 in qemu_chr_be_write (len=optimized out, 
buf=0x7fff41c08400 \n, s=0x7f0b46506c00) at qemu-char.c:187
   #9  tcp_chr_read (chan=optimized out, cond=optimized out, 
opaque=0x7f0b46506c00) at qemu-char.c:2519
   #10 0x7f0b43622a75 in g_main_dispatch (context=0x7f0b46506240) at 
gmain.c:2715
   #11 g_main_context_dispatch (context=context@entry=0x7f0b46506240) at 
gmain.c:3219
   #12 0x7f0b440c4c78 in glib_pollfds_poll () at main-loop.c:187
   #13 

Re: [Qemu-devel] [BUG latest master] - qemu segfaults when issuing screendump cmd

2013-04-17 Thread Lucas Meneghel Rodrigues
On Tue, 2013-04-16 at 09:39 +0200, Gerd Hoffmann wrote:
 On 04/15/13 18:49, Lucas Meneghel Rodrigues wrote:
  Latest qemu.git master is failing big time to pass sanity checks:
  
  https://bugs.launchpad.net/qemu/+bug/1169254
  
  We've had some issues with the test jobs, and finally managed to
  stabilize the grid, so we don't have results for the last couple of
  weeks to bisect the problem.
 
 Can you try this?
   git://git.kraxel.org/qemu rebase/pixman
 
 [ I'm about to prepare a pull req, was planning
to do it last week but got sick ... ]

Yes, in your branch, the problem is solved. Anthony came up with an even
simpler reproducer:

$ (sleep 1; echo -e 'screendump abc.ppm\nquit') | MALLOC_PERTURB_=1 
x86_64-softmmu/qemu-system-x86_64 -monitor stdio -vnc :0
QEMU 1.4.50 monitor - type 'help' for more information
(qemu) screendump abc.ppm
(qemu) quit

With current master, qemu crashes.

[lmr@thinkpad-t420s qemu-gerd]$ (sleep 1; echo -e 'screendump abc.ppm\nquit') | 
MALLOC_PERTURB_=1 x86_64-softmmu/qemu-system-x86_64 -monitor stdio -vnc :0
QEMU 1.4.50 monitor - type 'help' for more information
(qemu) screendump abc.ppm
Segmentation fault





[Qemu-devel] [Bug 1169375] Re: qemu.git master - qemu segfaults during tcp migration (and other modes when using MALLOC_PERTURB_=1)

2013-04-17 Thread Lucas Meneghel Rodrigues
Problem fixed with this commit, recently pushed to master:

commit 7dda5dc82a776a39a7996020c188eb2a29187117
Author: Paolo Bonzini pbonz...@redhat.com
Date:   Tue Apr 9 17:43:43 2013 +0200

migration: initialize RAM to zero

Using qemu_memalign only leaves the RAM zero by chance, because libc
will usually use mmap to satisfy our huge requests.  But memory will
not be zero when using MALLOC_PERTURB_ with a nonzero value.  In the
case of incoming migration, this breaks a recently-introduced
invariant (commit f1c7279, migration: do not sent zero pages in
bulk stage, 2013-03-26).

To fix this, use mmap ourselves to get a well-aligned, always zero
block for the RAM.  Mmap-ed memory is easy to trim at the sides.

This also removes the need to do something special on valgrind
(see commit c2a8238a, Support running QEMU on Valgrind, 2011-10-31),
thus effectively reverts that patch.

Reviewed-by: Juan Quintela quint...@redhat.com
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
Reviewed-by: Markus Armbruster arm...@redhat.com
Message-id: 136553-20153-1-git-send-email-pbonz...@redhat.com
Signed-off-by: Anthony Liguori aligu...@us.ibm.com

I'll take the opportunity and also make MALLOC_PERTURB_=1 as default on
virt-tests. This will help to avoid such regressions in the future.

** Changed in: qemu
   Status: New = Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169375

Title:
  qemu.git master - qemu segfaults during tcp migration (and other
  modes when using MALLOC_PERTURB_=1)

Status in QEMU:
  Fix Committed

Bug description:
  Relevant qemu.git master commit:

  24a6e7f4d91e9ed5f8117ecb083431a23f8609a0

  When trying to migrate a VM using the TCP protocol, a segfault
  happened:

  21:45:07 INFO | Running qemu command (reformatted):
  /home/lmr/Code/qemu/x86_64-softmmu/qemu-system-x86_64 \
  -S \
  -name 'virt-tests-vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-214507-8fDeX7Fj,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-214507-8fDeX7Fj,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-214507-8fDeX7Fj,path=/tmp/seabios-20130415-214507-8fDeX7Fj,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-214507-8fDeX7Fj,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -drive 
file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=idr5RNof,mac='9a:42:43:44:45:46',id='idJVlBu3' \
  -netdev user,id=idr5RNof,hostfwd=tcp::5000-:22 \
  -m 1024 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'SandyBridge' \
  -M pc \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -vnc :1 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=c,menu=off  \
  -enable-kvm \
  -incoming tcp:0:5200
  21:45:08 INFO | [qemu output] qemu-system-x86_64: -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1: Bus 'virtio-pci-bus.0' is full
  21:45:08 DEBUG| VM appears to be alive with PID 2002
  21:45:08 DEBUG| (monitor hmp1) Sending command 'info cpus' 
  21:45:08 DEBUG| (monitor hmp1) Response to 'info cpus'
  21:45:08 DEBUG| (monitor hmp1)* CPU #0: pc=0xfff0 
thread_id=2004
  21:45:08 DEBUG| (monitor hmp1)  CPU #1: pc=0xfff0 
thread_id=2005
  21:45:09 DEBUG| (monitor hmp1) Sending command 'cont' 
  21:45:09 INFO | Migrating to tcp:0:5200
  21:45:09 DEBUG| (monitor hmp1) Sending command 'migrate -d tcp:0:5200' 
  21:45:10 WARNI| Could not find (qemu) prompt after command 'screendump 
/dev/shm/scrdump-MDE7wl.ppm'. Output so far: ''
  21:45:10 WARNI| VM 'virt-tests-vm1' produced an invalid screendump
  21:45:10 INFO | [qemu output] qemu: warning: error while loading state 
section id 3
  21:45:10 INFO | [qemu output] load of migration failed
  21:45:10 INFO | [qemu output] /bin/sh: line 1:  1867 Segmentation fault  
/home/lmr/Code/qemu/x86_64-softmmu/qemu-system-x86_64 -S -name 'virt-tests-vm1' 
-nodefaults -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-214454-pGmRwNvs,server,nowait
 -mon chardev=hmp_id_hmp1,mode=readline -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-214454-pGmRwNvs,server,nowait
 -device isa-serial,chardev=serial_id_serial1 -chardev 
socket,id=seabioslog_id_20130415-214454-pGmRwNvs,path=/tmp/seabios-20130415-214454-pGmRwNvs,server,nowait
 -device 
isa-debugcon,chardev=seabioslog_id_20130415-214454-pGmRwNvs,iobase=0x402 
-device ich9-usb-uhci1,id=usb1 -drive 

[Qemu-devel] [PATCH] run: Introduce --use-malloc-perturb specific qemu flag

2013-04-17 Thread Lucas Meneghel Rodrigues
Setting the environment variable MALLOC_PERTURB_ to
a non zero value [1] helps to find out some subtle
memory allocation problems, and it is being used in
our test grid. However, by default, the virt test
runner doesn't use it.

Add the new, qemu test specific --use-malloc-perturb flag
and set it to 'yes' (use the env variable) by default.
This way we're being more strict, which makes sense
in the context of a test suite. If people want to double
check the behavior of the test without the flag, just
use '--use-malloc-perturb no'.

[1] http://udrepper.livejournal.com/11429.html

Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 run | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/run b/run
index 170f00a..dd203aa 100755
--- a/run
+++ b/run
@@ -238,6 +238,11 @@ class VirtTestRunParser(optparse.OptionParser):
 If -c is provided and this flag is omitted, 
 no attempt to set the qemu binaries will be made. 

   Default path: %s % qemu_bin_path))
+qemu.add_option(--use-malloc-perturb, action=store,
+dest=malloc_perturb, default=yes,
+help=(Use MALLOC_PERTURB_ env variable set to 1 
+  to help catch memory allocation problems on 
+  qemu (yes or no). Default: %default))
 qemu.add_option(--accel, action=store, dest=accel, default=kvm,
 help=(Accelerator used to run qemu (kvm or tcg). 
   Default: kvm))
@@ -468,6 +473,11 @@ class VirtTestApp(object):
 logging.info(Config provided, ignoring --vhost option)
 
 
+def _process_malloc_perturb(self):
+self.cartesian_parser.assign(malloc_perturb,
+ self.options.malloc_perturb)
+
+
 def _process_qemu_specific_options(self):
 
 Calls for processing all options specific to the qemu test.
@@ -484,6 +494,7 @@ class VirtTestApp(object):
 self._process_nic_model()
 self._process_disk_buses()
 self._process_vhost()
+self._process_malloc_perturb()
 
 
 def _process_guest_os(self):
-- 
1.8.2




[Qemu-devel] [BUG latest master] - qemu segfaults when issuing screendump cmd

2013-04-15 Thread Lucas Meneghel Rodrigues
Latest qemu.git master is failing big time to pass sanity checks:

https://bugs.launchpad.net/qemu/+bug/1169254

We've had some issues with the test jobs, and finally managed to
stabilize the grid, so we don't have results for the last couple of
weeks to bisect the problem.





[Qemu-devel] [Bug 1169254] [NEW] latest qemu.git master - qemu-system-x86_64 crashes when issuing screendump command over monitor

2013-04-15 Thread Lucas Meneghel Rodrigues
Public bug reported:

Found the problem during sanity test of the 'next' branch

git commit ID is e2ec3f976803b360c70d9ae2ba13852fa5d11665 (tag
v1.4.0-1202-ge2ec3f9)

For reference, kernel is upstream kvm.git

git commit ID is 31880c37c11e28cb81c70757e38392b42e695dc6 (tag
v3.8-12524-g31880c3)

Steps to reproduce:

Start qemu, reference cmd:

MALLOC_PERTURB_=1 /usr/local/autotest/tests/virt/qemu/qemu \
-S \
-name 'vm1' \
-nodefaults \
-chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait
 \
-mon chardev=hmp_id_hmp1,mode=readline \
-chardev 
socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20130415-120337-CX4dw84y,server,nowait
 \
-mon chardev=qmp_id_qmp1,mode=control \
-chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-120337-CX4dw84y,server,nowait
 \
-device isa-serial,chardev=serial_id_serial1 \
-chardev 
socket,id=seabioslog_id_20130415-120337-CX4dw84y,path=/tmp/seabios-20130415-120337-CX4dw84y,server,nowait
 \
-device 
isa-debugcon,chardev=seabioslog_id_20130415-120337-CX4dw84y,iobase=0x402 \
-device ich9-usb-uhci1,id=usb1 \
-drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64.qcow2',if=none,id=virtio0
 \
-device virtio-blk-pci,drive=virtio0,bootindex=1 \
-device 
virtio-net-pci,netdev=id7t6ont,mac='9a:16:17:18:19:1a',id='idQ3SyRX' \
-netdev tap,id=id7t6ont,vhost=on,fd=24 \
-m 2048 \
-smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
-cpu 'Opteron_G3' \
-M pc \
-drive 
file='/usr/local/autotest/tests/virt/shared/data/isos/linux/RHEL-6.3-x86_64-DVD.iso',media=cdrom,index=2
 \
-drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/ks.iso',media=cdrom,index=1
 \
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
-kernel 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/vmlinuz' \
-append 'ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0' \
-initrd 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/initrd.img' \
-vnc :0 \
-vga std \
-rtc base=utc,clock=host,driftfix=none  \
-boot order=cdn,once=d,menu=off  \
-enable-kvm

2) Connect to the monitor

nc -U /tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait

3) Unpause the VM

[root@virtblade03 autotest]# nc -U /tmp/monitor-hmp1-20130415-120943-D6zKUQFO
QEMU 1.4.50 monitor - type 'help' for more information
(qemu) cont
cont

4) Ask for a screendump

(qemu) screendump abc.ppm
screendump abc.ppm

At this point, qemu crashes.

 Program terminated with signal 11, Segmentation fault.
 #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
 834 if (image-type == BITS)
 (gdb) bt
 #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
 #1  0x7f0b44158374 in ppm_save (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, ds=0x7f0b466b7a50, errp=0x7fff41c08260)
 at /usr/local/autotest/tmp/virt/src/qemu/hw/display/vga.c:2401
 #2  0x7f0b4410f18e in qmp_screendump (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, errp=0x7fff41c08260) at ui/console.c:195
 #3  0x7f0b43ffc77a in hmp_screen_dump (mon=0x7f0b46530d80, 
qdict=optimized out) at hmp.c:1335
 #4  0x7f0b4418c889 in handle_user_command (mon=mon@entry=0x7f0b46530d80, 
cmdline=optimized out) at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4007
 #5  0x7f0b4418cc0b in monitor_command_cb (mon=0x7f0b46530d80, 
cmdline=optimized out, opaque=optimized out)
 at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4623
 #6  0x7f0b440fe69b in readline_handle_byte (rs=0x7f0b46689a30, 
ch=optimized out) at readline.c:373
 #7  0x7f0b4418c954 in monitor_read (opaque=optimized out, buf=optimized 
out, size=optimized out) at 
/usr/local/autotest/tmp/virt/src/qemu/monitor.c:4609
 #8  0x7f0b440ec029 in qemu_chr_be_write (len=optimized out, 
buf=0x7fff41c08400 \n, s=0x7f0b46506c00) at qemu-char.c:187
 #9  tcp_chr_read (chan=optimized out, cond=optimized out, 
opaque=0x7f0b46506c00) at qemu-char.c:2519
 #10 0x7f0b43622a75 in g_main_dispatch (context=0x7f0b46506240) at 
gmain.c:2715
 #11 g_main_context_dispatch (context=context@entry=0x7f0b46506240) at 
gmain.c:3219
 #12 0x7f0b440c4c78 in glib_pollfds_poll () at main-loop.c:187
 #13 os_host_main_loop_wait (timeout=optimized out) at main-loop.c:232
 #14 main_loop_wait (nonblocking=optimized out) at main-loop.c:468
 #15 0x7f0b43faab55 in main_loop () at vl.c:2043
 #16 main (argc=optimized out, argv=optimized out, envp=optimized out) at 
vl.c:4432

 if (image-type == BITS)
 image=0x101010101010101

The pointer to the image is invalid. Need to investigate why.

** Affects: qemu
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169254

Title:
  latest qemu.git master - qemu-system-x86_64 crashes when 

[Qemu-devel] [Bug 1169254] Re: latest qemu.git master - qemu-system-x86_64 crashes when issuing screendump command over monitor

2013-04-15 Thread Lucas Meneghel Rodrigues
1 thing I don't see in your command line: MALLOC_PERTURB=1. I did build
it on my Fedora 19 work laptop and it is easily reproducible. I just
didn't use the echo -e:

[lmr@thinkpad-t420s qemu]$ MALLOC_PERTURB_=1 x86_64-softmmu/qemu-system-x86_64 
-monitor stdio -vga std -S -vnc :0 -enable-kvm -nodefaults
QEMU 1.4.50 monitor - type 'help' for more information
(qemu) cont
(qemu) screendump abc.ppm
Segmentation fault

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169254

Title:
  latest qemu.git master - qemu-system-x86_64 crashes when issuing
  screendump command over monitor

Status in QEMU:
  New

Bug description:
  Found the problem during sanity test of the 'next' branch

  git commit ID is e2ec3f976803b360c70d9ae2ba13852fa5d11665 (tag
  v1.4.0-1202-ge2ec3f9)

  For reference, kernel is upstream kvm.git

  git commit ID is 31880c37c11e28cb81c70757e38392b42e695dc6 (tag
  v3.8-12524-g31880c3)

  Steps to reproduce:

  Start qemu, reference cmd:

  MALLOC_PERTURB_=1 /usr/local/autotest/tests/virt/qemu/qemu \
  -S \
  -name 'vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=qmp_id_qmp1,mode=control \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-120337-CX4dw84y,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-120337-CX4dw84y,path=/tmp/seabios-20130415-120337-CX4dw84y,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-120337-CX4dw84y,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=id7t6ont,mac='9a:16:17:18:19:1a',id='idQ3SyRX' \
  -netdev tap,id=id7t6ont,vhost=on,fd=24 \
  -m 2048 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'Opteron_G3' \
  -M pc \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/isos/linux/RHEL-6.3-x86_64-DVD.iso',media=cdrom,index=2
 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/ks.iso',media=cdrom,index=1
 \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -kernel 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/vmlinuz' \
  -append 'ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0' \
  -initrd 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/initrd.img' \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=d,menu=off  \
  -enable-kvm

  2) Connect to the monitor

  nc -U /tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait

  3) Unpause the VM

  [root@virtblade03 autotest]# nc -U /tmp/monitor-hmp1-20130415-120943-D6zKUQFO
  QEMU 1.4.50 monitor - type 'help' for more information
  (qemu) cont
  cont

  4) Ask for a screendump

  (qemu) screendump abc.ppm
  screendump abc.ppm

  At this point, qemu crashes.

   Program terminated with signal 11, Segmentation fault.
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   834 if (image-type == BITS)
   (gdb) bt
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   #1  0x7f0b44158374 in ppm_save (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, ds=0x7f0b466b7a50, errp=0x7fff41c08260)
   at /usr/local/autotest/tmp/virt/src/qemu/hw/display/vga.c:2401
   #2  0x7f0b4410f18e in qmp_screendump (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, errp=0x7fff41c08260) at ui/console.c:195
   #3  0x7f0b43ffc77a in hmp_screen_dump (mon=0x7f0b46530d80, 
qdict=optimized out) at hmp.c:1335
   #4  0x7f0b4418c889 in handle_user_command (mon=mon@entry=0x7f0b46530d80, 
cmdline=optimized out) at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4007
   #5  0x7f0b4418cc0b in monitor_command_cb (mon=0x7f0b46530d80, 
cmdline=optimized out, opaque=optimized out)
   at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4623
   #6  0x7f0b440fe69b in readline_handle_byte (rs=0x7f0b46689a30, 
ch=optimized out) at readline.c:373
   #7  0x7f0b4418c954 in monitor_read (opaque=optimized out, 
buf=optimized out, size=optimized out) at 
/usr/local/autotest/tmp/virt/src/qemu/monitor.c:4609
   #8  0x7f0b440ec029 in qemu_chr_be_write (len=optimized out, 
buf=0x7fff41c08400 \n, s=0x7f0b46506c00) at qemu-char.c:187
   #9  tcp_chr_read (chan=optimized out, cond=optimized out, 
opaque=0x7f0b46506c00) at qemu-char.c:2519
   #10 0x7f0b43622a75 in g_main_dispatch (context=0x7f0b46506240) at 

[Qemu-devel] [Bug 1169254] Re: latest qemu.git master - qemu-system-x86_64 crashes when issuing screendump command over monitor

2013-04-15 Thread Lucas Meneghel Rodrigues
I've hacked up a (admittedly not very pretty) reproducer script

PATH_DEVEL=x86_64-softmmu/qemu-system-x86_64
MALLOC_PERTURB_=1 $PATH_DEVEL -chardev 
socket,id=hmp1,path=/tmp/hmp1-lmr,server,nowait -mon chardev=hmp1,mode=readline 
-vga std -S -vnc :0 -enable-kvm -nodefaults
QEMU_PID=$(pidof qemu-system-x86_64)

echo QEMU PID is $QEMU_PID
sleep 2
echo 'cont' | nc -U /tmp/hmp1-lmr
sleep 2
echo 'screendump abc.ppm' | nc -U /tmp/hmp1-lmr

if ps -p $QEMU_PID  /dev/null
then
echo PASS: QEMU is still alive
kill $QEMU_PID
exit 0
else
echo FAIL: QEMU segfaulted
exit 1
fi

And let me try git bisect here...

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169254

Title:
  latest qemu.git master - qemu-system-x86_64 crashes when issuing
  screendump command over monitor

Status in QEMU:
  New

Bug description:
  Found the problem during sanity test of the 'next' branch

  git commit ID is e2ec3f976803b360c70d9ae2ba13852fa5d11665 (tag
  v1.4.0-1202-ge2ec3f9)

  For reference, kernel is upstream kvm.git

  git commit ID is 31880c37c11e28cb81c70757e38392b42e695dc6 (tag
  v3.8-12524-g31880c3)

  Steps to reproduce:

  Start qemu, reference cmd:

  MALLOC_PERTURB_=1 /usr/local/autotest/tests/virt/qemu/qemu \
  -S \
  -name 'vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=qmp_id_qmp1,mode=control \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-120337-CX4dw84y,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-120337-CX4dw84y,path=/tmp/seabios-20130415-120337-CX4dw84y,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-120337-CX4dw84y,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=id7t6ont,mac='9a:16:17:18:19:1a',id='idQ3SyRX' \
  -netdev tap,id=id7t6ont,vhost=on,fd=24 \
  -m 2048 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'Opteron_G3' \
  -M pc \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/isos/linux/RHEL-6.3-x86_64-DVD.iso',media=cdrom,index=2
 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/ks.iso',media=cdrom,index=1
 \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -kernel 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/vmlinuz' \
  -append 'ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0' \
  -initrd 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/initrd.img' \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=d,menu=off  \
  -enable-kvm

  2) Connect to the monitor

  nc -U /tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait

  3) Unpause the VM

  [root@virtblade03 autotest]# nc -U /tmp/monitor-hmp1-20130415-120943-D6zKUQFO
  QEMU 1.4.50 monitor - type 'help' for more information
  (qemu) cont
  cont

  4) Ask for a screendump

  (qemu) screendump abc.ppm
  screendump abc.ppm

  At this point, qemu crashes.

   Program terminated with signal 11, Segmentation fault.
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   834 if (image-type == BITS)
   (gdb) bt
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   #1  0x7f0b44158374 in ppm_save (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, ds=0x7f0b466b7a50, errp=0x7fff41c08260)
   at /usr/local/autotest/tmp/virt/src/qemu/hw/display/vga.c:2401
   #2  0x7f0b4410f18e in qmp_screendump (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, errp=0x7fff41c08260) at ui/console.c:195
   #3  0x7f0b43ffc77a in hmp_screen_dump (mon=0x7f0b46530d80, 
qdict=optimized out) at hmp.c:1335
   #4  0x7f0b4418c889 in handle_user_command (mon=mon@entry=0x7f0b46530d80, 
cmdline=optimized out) at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4007
   #5  0x7f0b4418cc0b in monitor_command_cb (mon=0x7f0b46530d80, 
cmdline=optimized out, opaque=optimized out)
   at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4623
   #6  0x7f0b440fe69b in readline_handle_byte (rs=0x7f0b46689a30, 
ch=optimized out) at readline.c:373
   #7  0x7f0b4418c954 in monitor_read (opaque=optimized out, 
buf=optimized out, size=optimized out) at 
/usr/local/autotest/tmp/virt/src/qemu/monitor.c:4609
   #8  0x7f0b440ec029 in qemu_chr_be_write (len=optimized out, 
buf=0x7fff41c08400 \n, s=0x7f0b46506c00) 

[Qemu-devel] [Bug 1169254] Re: latest qemu.git master - qemu-system-x86_64 crashes when issuing screendump command over monitor

2013-04-15 Thread Lucas Meneghel Rodrigues
First bad commit is

commit c78f71378a345ea240c288993ca1378ded5504b9
Author: Gerd Hoffmann kra...@redhat.com
Date:   Tue Mar 5 15:24:14 2013 +0100

console: stop using DisplayState in gfx hardware emulation

Use QemuConsole instead.  Updates interfaces in console.[ch] and adapts
gfx hardware emulation code.

Signed-off-by: Gerd Hoffmann kra...@redhat.com

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169254

Title:
  latest qemu.git master - qemu-system-x86_64 crashes when issuing
  screendump command over monitor

Status in QEMU:
  New

Bug description:
  Found the problem during sanity test of the 'next' branch

  git commit ID is e2ec3f976803b360c70d9ae2ba13852fa5d11665 (tag
  v1.4.0-1202-ge2ec3f9)

  For reference, kernel is upstream kvm.git

  git commit ID is 31880c37c11e28cb81c70757e38392b42e695dc6 (tag
  v3.8-12524-g31880c3)

  Steps to reproduce:

  Start qemu, reference cmd:

  MALLOC_PERTURB_=1 /usr/local/autotest/tests/virt/qemu/qemu \
  -S \
  -name 'vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=qmp_id_qmp1,path=/tmp/monitor-qmp1-20130415-120337-CX4dw84y,server,nowait
 \
  -mon chardev=qmp_id_qmp1,mode=control \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-120337-CX4dw84y,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-120337-CX4dw84y,path=/tmp/seabios-20130415-120337-CX4dw84y,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-120337-CX4dw84y,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=id7t6ont,mac='9a:16:17:18:19:1a',id='idQ3SyRX' \
  -netdev tap,id=id7t6ont,vhost=on,fd=24 \
  -m 2048 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'Opteron_G3' \
  -M pc \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/isos/linux/RHEL-6.3-x86_64-DVD.iso',media=cdrom,index=2
 \
  -drive 
file='/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/ks.iso',media=cdrom,index=1
 \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -kernel 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/vmlinuz' \
  -append 'ks=cdrom nicdelay=60 console=ttyS0,115200 console=tty0' \
  -initrd 
'/usr/local/autotest/tests/virt/shared/data/images/rhel63-64/initrd.img' \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=d,menu=off  \
  -enable-kvm

  2) Connect to the monitor

  nc -U /tmp/monitor-hmp1-20130415-120337-CX4dw84y,server,nowait

  3) Unpause the VM

  [root@virtblade03 autotest]# nc -U /tmp/monitor-hmp1-20130415-120943-D6zKUQFO
  QEMU 1.4.50 monitor - type 'help' for more information
  (qemu) cont
  cont

  4) Ask for a screendump

  (qemu) screendump abc.ppm
  screendump abc.ppm

  At this point, qemu crashes.

   Program terminated with signal 11, Segmentation fault.
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   834 if (image-type == BITS)
   (gdb) bt
   #0  pixman_image_get_width (image=0x101010101010101) at pixman-image.c:834
   #1  0x7f0b44158374 in ppm_save (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, ds=0x7f0b466b7a50, errp=0x7fff41c08260)
   at /usr/local/autotest/tmp/virt/src/qemu/hw/display/vga.c:2401
   #2  0x7f0b4410f18e in qmp_screendump (filename=0x7f0b46762a30 
/dev/shm/scrdump-miGZom.ppm, errp=0x7fff41c08260) at ui/console.c:195
   #3  0x7f0b43ffc77a in hmp_screen_dump (mon=0x7f0b46530d80, 
qdict=optimized out) at hmp.c:1335
   #4  0x7f0b4418c889 in handle_user_command (mon=mon@entry=0x7f0b46530d80, 
cmdline=optimized out) at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4007
   #5  0x7f0b4418cc0b in monitor_command_cb (mon=0x7f0b46530d80, 
cmdline=optimized out, opaque=optimized out)
   at /usr/local/autotest/tmp/virt/src/qemu/monitor.c:4623
   #6  0x7f0b440fe69b in readline_handle_byte (rs=0x7f0b46689a30, 
ch=optimized out) at readline.c:373
   #7  0x7f0b4418c954 in monitor_read (opaque=optimized out, 
buf=optimized out, size=optimized out) at 
/usr/local/autotest/tmp/virt/src/qemu/monitor.c:4609
   #8  0x7f0b440ec029 in qemu_chr_be_write (len=optimized out, 
buf=0x7fff41c08400 \n, s=0x7f0b46506c00) at qemu-char.c:187
   #9  tcp_chr_read (chan=optimized out, cond=optimized out, 
opaque=0x7f0b46506c00) at qemu-char.c:2519
   #10 0x7f0b43622a75 in g_main_dispatch (context=0x7f0b46506240) at 
gmain.c:2715
   #11 g_main_context_dispatch 

[Qemu-devel] [Bug 1169375] [NEW] qemu.git master - qemu segfaults during tcp migration (and other modes when using MALLOC_PERTURB_=1)

2013-04-15 Thread Lucas Meneghel Rodrigues
Public bug reported:

Relevant qemu.git master commit:

24a6e7f4d91e9ed5f8117ecb083431a23f8609a0

When trying to migrate a VM using the TCP protocol, a segfault happened:

21:45:07 INFO | Running qemu command (reformatted):
/home/lmr/Code/qemu/x86_64-softmmu/qemu-system-x86_64 \
-S \
-name 'virt-tests-vm1' \
-nodefaults \
-chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-214507-8fDeX7Fj,server,nowait
 \
-mon chardev=hmp_id_hmp1,mode=readline \
-chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-214507-8fDeX7Fj,server,nowait
 \
-device isa-serial,chardev=serial_id_serial1 \
-chardev 
socket,id=seabioslog_id_20130415-214507-8fDeX7Fj,path=/tmp/seabios-20130415-214507-8fDeX7Fj,server,nowait
 \
-device 
isa-debugcon,chardev=seabioslog_id_20130415-214507-8fDeX7Fj,iobase=0x402 \
-device ich9-usb-uhci1,id=usb1 \
-drive 
file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2',if=none,id=virtio0
 \
-device virtio-blk-pci,drive=virtio0,bootindex=1 \
-device 
virtio-net-pci,netdev=idr5RNof,mac='9a:42:43:44:45:46',id='idJVlBu3' \
-netdev user,id=idr5RNof,hostfwd=tcp::5000-:22 \
-m 1024 \
-smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
-cpu 'SandyBridge' \
-M pc \
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
-vnc :1 \
-vga std \
-rtc base=utc,clock=host,driftfix=none  \
-boot order=cdn,once=c,menu=off  \
-enable-kvm \
-incoming tcp:0:5200
21:45:08 INFO | [qemu output] qemu-system-x86_64: -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1: Bus 'virtio-pci-bus.0' is full
21:45:08 DEBUG| VM appears to be alive with PID 2002
21:45:08 DEBUG| (monitor hmp1) Sending command 'info cpus' 
21:45:08 DEBUG| (monitor hmp1) Response to 'info cpus'
21:45:08 DEBUG| (monitor hmp1)* CPU #0: pc=0xfff0 thread_id=2004
21:45:08 DEBUG| (monitor hmp1)  CPU #1: pc=0xfff0 thread_id=2005
21:45:09 DEBUG| (monitor hmp1) Sending command 'cont' 
21:45:09 INFO | Migrating to tcp:0:5200
21:45:09 DEBUG| (monitor hmp1) Sending command 'migrate -d tcp:0:5200' 
21:45:10 WARNI| Could not find (qemu) prompt after command 'screendump 
/dev/shm/scrdump-MDE7wl.ppm'. Output so far: ''
21:45:10 WARNI| VM 'virt-tests-vm1' produced an invalid screendump
21:45:10 INFO | [qemu output] qemu: warning: error while loading state section 
id 3
21:45:10 INFO | [qemu output] load of migration failed
21:45:10 INFO | [qemu output] /bin/sh: line 1:  1867 Segmentation fault  
/home/lmr/Code/qemu/x86_64-softmmu/qemu-system-x86_64 -S -name 'virt-tests-vm1' 
-nodefaults -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-214454-pGmRwNvs,server,nowait
 -mon chardev=hmp_id_hmp1,mode=readline -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-214454-pGmRwNvs,server,nowait
 -device isa-serial,chardev=serial_id_serial1 -chardev 
socket,id=seabioslog_id_20130415-214454-pGmRwNvs,path=/tmp/seabios-20130415-214454-pGmRwNvs,server,nowait
 -device 
isa-debugcon,chardev=seabioslog_id_20130415-214454-pGmRwNvs,iobase=0x402 
-device ich9-usb-uhci1,id=usb1 -drive 
file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2',if=none,id=virtio0
 -device virtio-blk-pci,drive=virtio0,bootindex=1 -device 
virtio-net-pci,netdev=id33wvth,mac='9a:42:43:44:45:46',id='idavPVhj' -netdev 
user,id=id33wvth,hostfwd=tcp::5001-:22 -m 1024 -smp 
2,maxcpus=2,cores=1,threads=1,so:

We've missed those problems during the last couple of weeks due to
problems in our test grid. The problem can be seen running the default
test set on virt-test. By default, virt-test does not use
MALLOC_PERTURB_=1. When using MALLOC_PERTURB_=1, pretty much all
migration modes will fail.

** Affects: qemu
 Importance: Undecided
 Status: New

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1169375

Title:
  qemu.git master - qemu segfaults during tcp migration (and other
  modes when using MALLOC_PERTURB_=1)

Status in QEMU:
  New

Bug description:
  Relevant qemu.git master commit:

  24a6e7f4d91e9ed5f8117ecb083431a23f8609a0

  When trying to migrate a VM using the TCP protocol, a segfault
  happened:

  21:45:07 INFO | Running qemu command (reformatted):
  /home/lmr/Code/qemu/x86_64-softmmu/qemu-system-x86_64 \
  -S \
  -name 'virt-tests-vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130415-214507-8fDeX7Fj,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130415-214507-8fDeX7Fj,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130415-214507-8fDeX7Fj,path=/tmp/seabios-20130415-214507-8fDeX7Fj,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130415-214507-8fDeX7Fj,iobase=0x402 \
 

[Qemu-devel] [Bug 1162644] Re: qemu-system-x86_64 crashed with SIGABRT in __assert_fail_base()

2013-04-01 Thread Lucas Meneghel Rodrigues
On my F19 box, it's failing about 2/3 of the attempts. What is funny is
that on the Ubuntu 13.04 box, I can't get the problem reproduced
anymore, for some reason beyond me.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1162644

Title:
  qemu-system-x86_64 crashed with SIGABRT in __assert_fail_base()

Status in QEMU:
  New
Status in “qemu” package in Ubuntu:
  New

Bug description:
  Description:
  When QEMU tries to boot with a usb 3.0 tablet (xhci) on a Raring ringtail box 
(QEMU package1.4.0+dfsg-1expubuntu4)  it will crash soon afterwards:

  qemu-system-x86_64: /build/buildd/qemu-1.4.0+dfsg/hw/usb/core.c:552:
  usb_packet_setup: Assertion `p-iov.iov != ((void *)0)' failed.

  Component:
  qemu-system - 1.4.0+dfsg-1expubuntu4

  Ubuntu Version:

  Description:  Ubuntu Raring Ringtail (development branch)
  Release:  13.04

  Steps to reproduce it:

  I met this bug while running the virt-test suite

  https://github.com/autotest/virt-test

  Instructions to install and run it can be seen on the README file

  https://github.com/autotest/virt-test#readme

  After the suite is set, it can be reproduced on a raring (13.04)
  simply by running:

  ./run -t qemu --tests usb.usb_reboot.usb_tablet.xhci

  Command line:

  23:52:42 INFO | Running qemu command (reformatted):
  /usr/bin/kvm \
  -S \
  -name 'virt-tests-vm1' \
  -nodefaults \
  -chardev 
socket,id=hmp_id_hmp1,path=/tmp/monitor-hmp1-20130331-233911-ndvUEvrV,server,nowait
 \
  -mon chardev=hmp_id_hmp1,mode=readline \
  -chardev 
socket,id=serial_id_serial1,path=/tmp/serial-serial1-20130331-233911-ndvUEvrV,server,nowait
 \
  -device isa-serial,chardev=serial_id_serial1 \
  -chardev 
socket,id=seabioslog_id_20130331-233911-ndvUEvrV,path=/tmp/seabios-20130331-233911-ndvUEvrV,server,nowait
 \
  -device 
isa-debugcon,chardev=seabioslog_id_20130331-233911-ndvUEvrV,iobase=0x402 \
  -device ich9-usb-uhci1,id=usb1 \
  -device nec-usb-xhci,id=usbtest \
  -drive 
file='/home/lmr/Code/virt-test.git/shared/data/images/jeos-17-64.qcow2',if=none,id=virtio0
 \
  -device virtio-blk-pci,drive=virtio0,bootindex=1 \
  -device 
virtio-net-pci,netdev=idumV1TE,mac='9a:c0:c1:c2:c3:c4',id='idmN7iHv' \
  -netdev user,id=idumV1TE,hostfwd=tcp::5000-:22 \
  -m 1024 \
  -smp 2,maxcpus=2,cores=1,threads=1,sockets=2 \
  -cpu 'SandyBridge' \
  -M pc \
  -device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
  -device usb-tablet,id=usb-testdev,bus=usbtest.0,port=1 \
  -vnc :0 \
  -vga std \
  -rtc base=utc,clock=host,driftfix=none  \
  -boot order=cdn,once=c,menu=off  \
  -enable-kvm

  ProblemType: Crash
  DistroRelease: Ubuntu 13.04
  Package: qemu-system-x86 1.4.0+dfsg-1expubuntu4
  ProcVersionSignature: Ubuntu 3.8.0-15.25-generic 3.8.4
  Uname: Linux 3.8.0-15-generic x86_64
  ApportVersion: 2.9.2-0ubuntu5
  Architecture: amd64
  Date: Sun Mar 31 23:52:46 2013
  EcryptfsInUse: Yes
  ExecutablePath: /usr/bin/qemu-system-x86_64
  InstallationDate: Installed on 2013-03-31 (0 days ago)
  InstallationMedia: Ubuntu 12.10 Quantal Quetzal - Release amd64 (20121017.5)
  MarkForUpload: True
  ProcEnviron:
   TERM=dumb
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=set
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  Signal: 6
  SourcePackage: qemu
  StacktraceTop:
   raise () from /lib/x86_64-linux-gnu/libc.so.6
   abort () from /lib/x86_64-linux-gnu/libc.so.6
   ?? () from /lib/x86_64-linux-gnu/libc.so.6
   __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
   ?? ()
  Title: qemu-system-x86_64 crashed with SIGABRT in raise()
  UpgradeStatus: Upgraded to raring on 2013-03-31 (0 days ago)
  UserGroups: adm cdrom dip libvirtd lpadmin plugdev sambashare sudo

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1162644/+subscriptions



Re: [Qemu-devel] The state of testing

2013-03-05 Thread Lucas Meneghel Rodrigues

On 03/05/2013 07:11 AM, Amit Shah wrote:

On (Mon) 04 Mar 2013 [16:53:55], Stefan Hajnoczi wrote:

People are working on testing for various parts of QEMU.  I started
this thread to gather an update on the state of testing and see where
we still need help.

I'm not sure yet if we should propose Google Summer of Code projects
to help with the testing infrastructure.  Perhaps working on libqtest
support for PCI, USB, virtio, etc would be a cool project.

Buildbot

The buildbot performs nightly builds and make check.  Test coverage
is still minimal but it's a starting point where we can add more tests
that will run every day.

Block

tests/qemu-iotests/ contains 49 tests for the block layer.  These
tests mostly cover image format features like backing files,
snapshots, resize, and basic I/O verify tests.

The test suite has a few areas for improvement:

1. aio is not well-supported.  We need to be able to control the order
in which asynchronous requests complete in order to test all possible
code paths.  This issue also means the current aio tests are not
deterministic and can fail randomly due to reordered output.

2. make check-block is not run by the buildbot.  We should do so to
get nightly coverage of basic qcow2 tests.  I will send a buildbot
config patch to fix this.

Net
---
No tests!

How are things looking with device emulation, migration, monitor, char, etc?


I have a few tests coded up for virtio-serial at

http://fedorapeople.org/cgit/amitshah/public_git/test-virtserial.git/

which indirectly test chardevs.

Autotest (virt-tests) also has virtio-serial tests which end up
testing chardevs.



chardevs, being an external interface to qemu, do get tested whenever
anyone starts qemu with e.g. libvirt.

Also, autotest has libvirt-based tests, which exercise the monitor.
However, I don't think there's anything comprehensive anywhere.


The virtio console tests span over 130 tests, and take ~4 hours to run, 
I'd consider they are comprehensive.




Re: [Qemu-devel] The state of testing

2013-03-05 Thread Lucas Meneghel Rodrigues

On 03/05/2013 08:17 AM, Gerd Hoffmann wrote:

On 03/05/13 11:46, Stefan Hajnoczi wrote:

On Mon, Mar 04, 2013 at 05:22:34PM +0100, Gerd Hoffmann wrote:

   Hi,


How are things looking with device emulation, migration, monitor, char, etc?


At the moment autotest/virt-test is pretty much the only workable thing
for non-trivial devices because libqtest lacks infrastructure for pci
and anything building on top of pci.

usb has no in-tree tests, but has autotest coverage.

chardevs have some autotest coverage, /me wrote a test for
chardev-{add,remove} qmp commands.  Still need to rebase + polish +
submit that one though.


Do the USB and chardev tests run regularly against qemu.git/master?


^ No. We still didn't add usb tests to the sanity/stable test sets, but 
it's something doable, we will add them.



I don't think we have *any* regular autotest coverage for master, have we?


^ Yes, there is coverage. There's a daily job called sanity that takes 
about 2.5 hours, that builds the latest kvm.git and installs it in the 
host, then reboots the box, builds the latest qemu master and runs:


1) Linux guest install (RHEL 6.3) with the latest virtio drivers build
2) Migration testing
3) Some more basic checks

4) Linux guest install (Windows 7 SP1) with the latest virtio drivers build
5) Migration testing
6) Some more basic checks

There are more extensive test sets that take about 8 hours, that 
exercise things like migration with file transfer, timedrift, among others.


This not only runs on master, but RHEL 5.x, 6.x and Fedora 17, 18.



Re: [Qemu-devel] The state of testing

2013-03-05 Thread Lucas Meneghel Rodrigues

On 03/04/2013 01:22 PM, Gerd Hoffmann wrote:

   Hi,


How are things looking with device emulation, migration, monitor, char, etc?


At the moment autotest/virt-test is pretty much the only workable thing
for non-trivial devices because libqtest lacks infrastructure for pci
and anything building on top of pci.

usb has no in-tree tests, but has autotest coverage.

chardevs have some autotest coverage, /me wrote a test for
chardev-{add,remove} qmp commands.  Still need to rebase + polish +
submit that one though.

Migration coverage is pretty bad overall I think.


On virt-tests there are at least 48 tests that are easy to run and 
involve migration. A subset of them is executed regularly in the daily jobs:


./run -t qemu -g Fedora.18.x86_64 --list-tests | grep migrat | grep -v 
multi_host


21 balloon_check.balloon-migrate
51 cpuflags.stress_guest.qemu_test_migration_with_additional_flags
65 migrate.default.tcp
66 migrate.default.unix
67 migrate.default.exec
68 migrate.default.fd
69 migrate.default.mig_cancel
70 migrate.with_speed_measurement.tcp
71 migrate.with_speed_measurement.unix
72 migrate.with_speed_measurement.exec
73 migrate.with_speed_measurement.fd
74 migrate.with_set_speed.tcp
75 migrate.with_set_speed.unix
76 migrate.with_set_speed.exec
77 migrate.with_set_speed.fd
78 migrate.with_reboot.tcp
79 migrate.with_reboot.unix
80 migrate.with_reboot.exec
81 migrate.with_reboot.fd
82 migrate.with_file_transfer.tcp
83 migrate.with_file_transfer.unix
84 migrate.with_file_transfer.exec
85 migrate.with_file_transfer.fd
86 migrate.with_autotest.dbench.tcp
87 migrate.with_autotest.dbench.unix
88 migrate.with_autotest.dbench.exec
89 migrate.with_autotest.dbench.fd
90 migrate.with_autotest.stress.tcp
91 migrate.with_autotest.stress.unix
92 migrate.with_autotest.stress.exec
93 migrate.with_autotest.stress.fd
94 migrate.with_autotest.monotonic_time.tcp
95 migrate.with_autotest.monotonic_time.unix
96 migrate.with_autotest.monotonic_time.exec
97 migrate.with_autotest.monotonic_time.fd
2146 nic_hotplug.migration.nic_8139 (requires root)
2147 nic_hotplug.migration.nic_virtio (requires root)
2148 nic_hotplug.migration.nic_e1000 (requires root)
2483 
virtio_console.spread_linear.specifiable.virtserialport.with_vm.migration.offline
2484 
virtio_console.spread_linear.specifiable.virtserialport.with_vm.migration.online
2515 
virtio_console.spread_linear.specifiable.virtconsole.with_vm.migration.offline
2516 
virtio_console.spread_linear.specifiable.virtconsole.with_vm.migration.online
2561 
virtio_console.spread_2.specifiable.virtserialport.with_vm.migration.offline
2562 
virtio_console.spread_2.specifiable.virtserialport.with_vm.migration.online
2584 
virtio_console.spread_2.specifiable.virtconsole.with_vm.migration.offline
2585 
virtio_console.spread_2.specifiable.virtconsole.with_vm.migration.online

2672 timedrift.ntp.with_migration
2676 timedrift.date.with_migration

Those can be run with relative ease on every developer laptop, not 
counting the many multi host tests involving migration, that are still 
not being executed on a regular basis on our test farm. So I don't think 
migration coverage is that bad.




Re: [Qemu-devel] The state of testing

2013-03-05 Thread Lucas Meneghel Rodrigues

On 03/05/2013 01:14 PM, Gerd Hoffmann wrote:

   Hi,


I don't think we have *any* regular autotest coverage for master, have
we?


^ Yes, there is coverage. There's a daily job called sanity that takes
about 2.5 hours, that builds the latest kvm.git and installs it in the
host, then reboots the box, builds the latest qemu master and runs:


Oh, good.  I guess it would be a good idea to send reports to
qemu-devel, maybe a weekly status or mails on regressions simliar to the
buildbot build failures.  So people (a) aware that the service exists in
the first place and (b) get informed that something broke which should
be fixed.


No doubt, I did try that before, but from my experience, the reports are 
likely to be ignored and people will complain about SPAM.


So we ended up creating an internal mailing list where Gleb and Marcelo 
are subscribed to, in case they want to look at the reports, and I'd 
look at the reports and report on the ML in case something bad happens.





Re: [Qemu-devel] The state of testing

2013-03-05 Thread Lucas Meneghel Rodrigues

On 03/05/2013 01:23 PM, Gerd Hoffmann wrote:

   Hi,


On virt-tests there are at least 48 tests that are easy to run and
involve migration. A subset of them is executed regularly in the daily
jobs:


Sure, there are a bunch of tests already, which is good.
But there are also important areas which are not covered at all yet.

For example there are no cross-version migration tests, which is an area
where we often have bugs, they often went unnoticed for quite a while
and they tend to be nasty to fix when noticed after release ...


Ok, I see your point. There are some provisions to implement tests for 
cross-version migration due to jzupka's work, but myself and Cleber 
could not get around to create multi host jobs in the test grid yet.




Re: [Qemu-devel] [PATCH] qemu:cpuid: speedup test by 3x times if grub2 is available

2013-02-14 Thread Lucas Meneghel Rodrigues

On 02/14/2013 11:41 AM, Eduardo Habkost wrote:

I'd glad to amend patch, if there are suggestions how to generalize it and
improve create boot image process for distros that doesn't have
grub2-mkrescue.


A reusable tool/script would be useful even outside virt-test. Anybody
who uses -kernel/-initrd today may want a more efficient solution (IIRC,
virt-install uses -kernel/-initrd when installing from a Fedora
repository URL).

But if we made that an independent tool we would have the additional
problem of having the new tool packaged and installed on the host. So
having something specific inside virt-test makes sense by now.


Absolutely, agreed.




Re: [Qemu-devel] [PATCH] qemu:cpuid: speedup test by 3x times if grub2 is available

2013-02-14 Thread Lucas Meneghel Rodrigues

On 02/14/2013 05:57 PM, Eduardo Habkost wrote:

On Thu, Feb 14, 2013 at 08:28:03PM +0100, Igor Mammedov wrote:

On Thu, 14 Feb 2013 13:13:18 +0100
Paolo Bonzini pbonz...@redhat.com wrote:


Il 14/02/2013 12:18, Eduardo Habkost ha scritto:

qemu boots from disk image 3 times faster than direct kernel load.

That's surprising. Do you have any idea why that happens?


Because kernel load uses MMIO (from fw_cfg), while booting from disk
uses at worst PCI DMA and at best virtio.

Paolo

I've tried Paolo's suggestion to run in TCG mode with instruction logging,
and it spends too much time reading 11K kernel from qemu compared to
kvm-unit-test kernel. I'll need debug it further to find out why.
But this patch looks unnecessary if I could fix qemu/seabios or test kernel
to reach the same load time as kvm-unit-test kernel.


Agreed.

Lucas, please don't apply this patch yet, until we find the actual cause
of the slow booting.


Okey dokey.




[Qemu-devel] qemu throws KVM internal error - Any ideas?

2013-02-09 Thread Lucas Meneghel Rodrigues

Hey Gleb, Marcelo:

I was looking at the sanity jobs for qemu.git and found this error that 
happened during RHEL 6.3 guest reboot test:


 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] KVM internal 
error. Suberror: 1

 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] emulation failure
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
RAX=81000122 RBX=01f92000 RCX=01d4e000 
RDX=0100
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
RSI=00093780 RDI=01a8c000 RBP= 
RSP=02367040
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] R8 
=01a8c000 R9 = R10=0038 
R11=0038
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
R12= R13= R14= 
R15=
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
RIP=81000122 RFL=00010006 [-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] ES = 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] CS =0010 
  00a09b00 DPL=0 CS64 [-RA]
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] SS = 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] DS = 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] FS = 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] GS = 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] LDT= 
  00c0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] TR =0020 
 0fff 00808b00 DPL=0 TSS64-busy
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] GDT= 
004c9ff8 0030
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] IDT= 
 
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] CR0=8011 
CR2= CR3=9238e090 CR4=00a0
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
DR0= DR1= DR2= 
DR3=
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] 
DR6=0ff0 DR7=0400

 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] EFER=0500
 02/09 05:16:45 INFO |   aexpect:0797| [qemu output] Code=?? ?? ?? ?? 
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 
?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??


qemu.git SHA1:

 02/09 04:41:50 INFO |   git:0153| git commit ID is 
70ef6a5b7121cb54d7f9713d6315fb8547761bfc (tag v1.4.0-rc1-7-g70ef6a5)


kvm.git SHA1:

 02/09 04:26:44 INFO |   git:0153| git commit ID is 
949db153b6466c6f7cad5a427ecea94985927311 (tag kvm-3.8-1-13793-g949db15)


I'm not sure this is reproducible (1st time I've seen this), I thought 
it'd be good to report it here though. We also seen the sieve unittest 
failure that I have already reported a couple of days ago.


Cheers,

Lucas



Re: [Qemu-devel] Headsup: windows virtio networking does not work on current git

2013-02-06 Thread Lucas Meneghel Rodrigues

On 02/05/2013 11:49 PM, Lucas Meneghel Rodrigues wrote:

On 02/05/2013 09:58 AM, Michael S. Tsirkin wrote:

Vadim, can you please describe in a bit more details what the actual
issue
here is, from the windows or windows driver point of view?  Is it really
that bad that the config space size changed?  Why it has this effect?
Is this size specified in the inf file somehow?  Just for us to actually
understand the issue?

Thanks!

/mjt


This should be educational:
https://github.com/YanVugenfirer/kvm-guest-drivers-windows/commit/10413d2bbef295cc0e0e75131147793ccc382155



I guess I chose a bad timing to do test grid maintenance. I've stopped
the grid last Thursday to upgrade the test code, then when I resumed
operations yesterday, I was checking out on the qemu.git results.

I found out that all Windows tests were failing due to a failure to
start the virtio driver. Attached there's an ogg video of what happens.
I found this thread and then things make sense...

Well, anyway, once a fix is in place, it'll be easy to verify whether
the problem is solved. I'll keep checking on this thread for a fix and
report whether it was successful or not.



Just reporting that the latest build of the internal virtio drivers 
(-54) passed all tests on latest qemu.git, no more networking problems.


Kernel (kvm.git):

02/06 18:31:29 INFO |   git:0153| git commit ID is 
949db153b6466c6f7cad5a427ecea94985927311 (tag kvm-3.8-1-13793-g949db15)


QEMU (qemu.git):

02/06 18:46:06 INFO |   git:0153| git commit ID is 
5f876756c57c15f5e14d4136fc432b74f05f082b (tag v1.4.0-rc0-15-g5f87675)


Windows Drivers build: 54 (Iso built automatically during the night).



Re: [Qemu-devel] [PATCH] hw/i386: Fix broken build for MinGW

2013-01-07 Thread Lucas Meneghel Rodrigues

On 01/07/2013 03:16 PM, Stefan Weil wrote:

Am 07.01.2013 09:35, schrieb Gerd Hoffmann:

On 01/04/13 22:57, Stefan Weil wrote:

pc-testdev.c cannot be compiled with MinGW:

   CCi386-softmmu/hw/i386/../pc-testdev.o
hw/i386/../pc-testdev.c:38:22: warning: sys/mman.h: file not found
hw/i386/../pc-testdev.c: In function ‘test_flush_page’:
hw/i386/../pc-testdev.c:103: warning: implicit declaration of
function ‘mprotect’
...



+obj-$(CONFIG_KVM) += pc-testdev.o


CONFIG_POSIX is the better choice I think.

cheers,
   Gerd


I agree.

This patch was superseded by a newer one which indeed uses
CONFIG_POSIX and was applied by Blue, see

http://patchwork.ozlabs.org/patch/209653/

Cheers,
Stefan


Ok, sorry about that, guys, and thanks for fixing things.

Lucas




Re: [Qemu-devel] [Virt-test-devel] [Autotest PATCH 2/2] virt run: add three logical case filters

2013-01-05 Thread Lucas Meneghel Rodrigues
On Sat, Jan 5, 2013 at 6:52 AM, Qingtang Zhou qz...@redhat.com wrote:
 * On 2012-12-31 17:55:24 -0200, Lucas Meneghel Rodrigues (look...@gmail.com) 
 wrote:
 Hmmm, about this one, I'm worried about making things more complex...

 The way I see the problem at hand, I'd say if people want to customize
 things, they'd be better of creating their own, specialized config
 files rather than adding command line flags to manipulate the test
 sets.
 Which kind of user interface do you want to provide to us (autotest user)?
 A cli?

Old autotest users know and care more about using the cartesian
config, and therefore they can make their own .cfg file. The old
tests.cfg was saved as tests-example.cfg, so one could use that and
build on top of it. If the person wants to run virt-tests using
autotest, that's fine, and we'll always support it.

 But why does it can't specify more parameters or filters?
 A config file? Why don't allow us to update tests.cfg?

See, you can always specify a config file:

./run -t qemu -c qemu/cfg/my-custom-file.cfg

The idea behind tests.cfg is that it's reserved for the test runner.
It's not a lot to ask I think, given that you can use a custom file
with -c.

 I'm totally confused.

I understand. You could be more willing to understand that we're doing
the possible to accomodate users that:

a) Don't care about 'autotest'. They just want a simple way to get to
test execution.
b) Don't care about 'cartesian files'. It's always been a point of
endless complaint, and I hope eventually we can get rid of it. While
we can't figure out how to do it, I'm trying to at least mitigate the
situation by making it *as transparent as possible* to users that fit
into a) and b).

I said I'm in principle against Amos' patch, but if you guys can
enlighten me as of why it's beneficial, I can change my mind.

 And why must I download that JeOS image?

You don't. There's always the option of doing things the 'old' way,
running the tests under autotest, etc. If you want a tutorial on how
to do that, I could write one.

 I've setup my own image, why can't I use it directly?

I'm working on a way of doing it from the test runner.

 Well, I prefer the old autotest style more now.

I won't say I liked the tone of your message, but let me try to be
objective and constructive:

 1) It's not our intention to piss off the people who have been using
and developing our tests over the last 4 years.
 2) It helps a lot opening issues and stating clearly what are the
problems you are seeing with the recent changes, remarks, and how you
see it could be solved. I think we can work this out together.

Thanks,

Lucas



Re: [Qemu-devel] [Autotest] [Autotest PATCH 2/2] virt run: add three logical case filters

2013-01-04 Thread Lucas Meneghel Rodrigues

On 01/04/2013 11:13 AM, Andreas Färber wrote:

Am 31.12.2012 20:55, schrieb Lucas Meneghel Rodrigues:

Hmmm, about this one, I'm worried about making things more complex...

The way I see the problem at hand, I'd say if people want to customize
things, they'd be better of creating their own, specialized config
files rather than adding command line flags to manipulate the test
sets.

So my initial stand on this particular patch is NACK, but you might
convince me otherwise :)


Lucas, following your nice presentation at KVM Forum I have set up
virt-test for local testing of my core CPU refactorings.
When run using
./run -t kvm --qemu-bin=/.../x86_64-softmmu/qemu-system-x86_64
it runs only 13 migration tests:

(1/13) migrate.default.tcp: PASS (41.04 s)
(2/13) migrate.default.unix: PASS (21.88 s)
(3/13) migrate.default.exec: PASS (20.84 s)
(4/13) migrate.default.fd: PASS (23.04 s)
(5/13) migrate.default.mig_cancel: PASS (18.66 s)
(6/13) migrate.with_set_speed.tcp: PASS (19.22 s)
(7/13) migrate.with_set_speed.unix: PASS (19.07 s)
(8/13) migrate.with_set_speed.exec: PASS (19.03 s)
(9/13) migrate.with_set_speed.fd: PASS (18.93 s)
(10/13) migrate.with_reboot.tcp: PASS (40.97 s)
(11/13) migrate.with_reboot.unix: PASS (42.90 s)
(12/13) migrate.with_reboot.exec: PASS (47.04 s)
(13/13) migrate.with_reboot.fd: PASS (47.95 s)

Whereas --list-tests shows 274 tests.

So while I am impartial to this specific patch, some easy way to run a
comprehensive test coverage without having to manually name each test
using --tests= would be very handy! Something like --all-tests maybe?


Hmm, could be. Due to the long time it'd be needed to run --all-tests, I 
thought it wouldn't be necessary.



If there is such a thing already, it is not obvious to the novice user
and --help output may need to be extended.


One thing that does help here is to know that you can specify only the 
first component of the test name displayed on --help, and it'll run all 
derivated tests. For example, if you want to run all virtio_console 
tests, you can just specify:


./run -t kvm --qemu-bin=/path/to/qemu --tests virtio_console

SETUP: PASS (1.60 s)
DATA DIR: /home/area/virt_test/
DEBUG LOG: 
/home/lmr/Code/virt-test.git/logs/run-2013-01-04-12.20.20/debug.log

TESTS: 118
(1/118) 
virtio_console.spread_linear.specifiable.virtserialport.with_vm.open:


I need to think of a good way of exposing this information on help output...




Re: [Qemu-devel] [Autotest PATCH 2/2] virt run: add three logical case filters

2013-01-04 Thread Lucas Meneghel Rodrigues
On Fri, Jan 4, 2013 at 1:06 PM, Gerd Hoffmann kra...@redhat.com wrote:
   Hi,

 So while I am impartial to this specific patch, some easy way to run a
 comprehensive test coverage without having to manually name each test
 using --tests= would be very handy! Something like --all-tests maybe?

 Hint from the dirty tricks department:
   --tests=JeOS will do (for --type=kvm).

 Not sure how useful that actually is though, not all tests are in a good
 and tested state.

Yep, there's that as well. I've fixed a lot of tests during the last
weeks, but indeed some tests might be broken.

 HTH,
   Gerd




-- 
Lucas



Re: [Qemu-devel] [Virt-test-devel] [Autotest PATCH 1/2] virt run: fix typo in help message

2012-12-31 Thread Lucas Meneghel Rodrigues
Ok, this looks good, applied, thanks!

On Sat, Dec 29, 2012 at 11:02 PM, Amos Kong ak...@redhat.com wrote:
 type 'kvm' already been changed to 'qemu'

 Signed-off-by: Amos Kong ak...@redhat.com
 ---
  run |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

 diff --git a/run b/run
 index 97dcdad..aac332a 100755
 --- a/run
 +++ b/run
 @@ -145,7 +145,7 @@ class VirtTestRunParser(optparse.OptionParser):
  general.add_option(-v, --verbose, action=store_true,
 dest=verbose, help=Exhibit debug messages)
  general.add_option(-t, --type, action=store, dest=type,
 -   help=Choose test type (kvm, libvirt, v2v))
 +   help=Choose test type (qemu, libvirt, v2v))
  general.add_option(-c, --config, action=store, dest=config,
 help=Explicitly choose a cartesian config)
  general.add_option(-r, --restore-image, action=store_true,
 @@ -174,7 +174,7 @@ class VirtTestRunParser(optparse.OptionParser):
   %default))
  self.add_option_group(general)

 -qemu = optparse.OptionGroup(self, 'Options specific to the kvm test')
 +qemu = optparse.OptionGroup(self, 'Options specific to the qemu 
 test')
  qemu.add_option(--qemu-bin, action=store, dest=qemu,
  help=(Path to a custom qemu binary to be tested. 
Default path: %s % qemu_bin_path))
 --
 1.7.1

 ___
 Virt-test-devel mailing list
 virt-test-de...@redhat.com
 https://www.redhat.com/mailman/listinfo/virt-test-devel



-- 
Lucas



Re: [Qemu-devel] [Autotest PATCH 2/2] virt run: add three logical case filters

2012-12-31 Thread Lucas Meneghel Rodrigues
Hmmm, about this one, I'm worried about making things more complex...

The way I see the problem at hand, I'd say if people want to customize
things, they'd be better of creating their own, specialized config
files rather than adding command line flags to manipulate the test
sets.

So my initial stand on this particular patch is NACK, but you might
convince me otherwise :)

On Sat, Dec 29, 2012 at 11:10 PM, Amos Kong ak...@redhat.com wrote:
 On Sun, Dec 30, 2012 at 09:02:09AM +0800, Amos Kong wrote:
 This patch added there options for filtering cases by logics,

 For example:
 ./run -t qemu -c tests.cfg --oronly=WinXP Win7 --andonly=boot 64 
 --not=sp1

 Oh! a typo in commitlog

  ./run -t qemu -c tests.cfg --or=WinXP Win7 --and=boot 64 --not=sp1

   (following cases will be executed)

 Test1: virtio_blk.smp2.virtio_net.WinXP.64.boot
 Test2: virtio_blk.smp2.virtio_net.Win7.64.boot
 ...

 Amos




-- 
Lucas



[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v4

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3

Gerd Hoffmann (1):
  add isa-debug-exit device

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v5

 hw/debugexit.c|   73 +++
 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  156 +
 3 files changed, 231 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




[Qemu-devel] [PATCH 1/2] add isa-debug-exit device

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 hw/pc-testdev.c   |  167 +
 3 files changed, 241 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..b652956
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,167 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device 

[Qemu-devel] [PATCH 1/2] add isa-debug-exit device

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 hw/pc-testdev.c   |  167 +
 3 files changed, 241 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..b652956
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,167 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device 

[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v4

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3

Gerd Hoffmann (1):
  add isa-debug-exit device

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v5

 hw/debugexit.c|   73 +++
 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  156 +
 3 files changed, 231 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v5

2012-12-13 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64\
-device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

Changes from v4:
* Pass iomem_buf as an opaque, as requested by Blue
* Ported to new MMIO schema, as requested by Jan

Changes from v3:
* Ported all register_ioport functions to memory API

Changes from v2:

* Rename struct testdev to PCTestdev
* Embed ioport_data into PCTestdev struct
* Porting most register_ioport functions to memory API

Changes from v1:

* Removed unused testdev member
* Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

* Removed port 0xf1, since now kvm-unit-tests use
  serial
* Removed exit code port 0xf4, since that can be
  replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

* Removed ram size port 0xd1, since guest memory
  size can be retrieved from firmware, there's a
  patch for kvm-unit-tests including an API to
  retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |1 +
 hw/pc-testdev.c   |   55 -
 2 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 56aaa9d..1ac5fc5 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -12,5 +12,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
index b652956..75889e7 100644
--- a/hw/pc-testdev.c
+++ b/hw/pc-testdev.c
@@ -41,10 +41,13 @@
 #include isa.h
 #include exec-memory.h
 
+#define IOMEM_LEN0x1
+
 typedef struct PCTestdev {
 ISADevice dev;
 MemoryRegion iomem;
 uint32_t ioport_data;
+char iomem_buf[IOMEM_LEN];
 } PCTestdev;
 
 #define TYPE_TESTDEV pc-testdev
@@ -74,48 +77,35 @@ static void test_device_flush_page(void *opaque, uint32_t 
addr, uint32_t data)
 hwaddr len = 4096;
 void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
 
-mprotect(a, 4096, PROT_NONE);
-mprotect(a, 4096, PROT_READ|PROT_WRITE);
+/* We might not be able to get the full page, only mprotect what we 
actually
+   have mapped */
+mprotect(a, len, PROT_NONE);
+mprotect(a, len, PROT_READ|PROT_WRITE);
 cpu_physical_memory_unmap(a, len, 0, 0);
 }
 
-static char *iomem_buf;
-
-static uint32_t test_iomem_readb(void *opaque, hwaddr addr)
-{
-return iomem_buf[addr];
-}
-
-static uint32_t test_iomem_readw(void *opaque, hwaddr addr)
-{
-return *(uint16_t*)(iomem_buf + addr);
-}
-
-static uint32_t test_iomem_readl(void *opaque, hwaddr addr)
+static uint64_t test_iomem_read(void *opaque, hwaddr addr, unsigned len)
 {
-return *(uint32_t*)(iomem_buf + addr);
-}
-
-static void test_iomem_writeb(void *opaque, hwaddr addr, uint32_t val)
-{
-iomem_buf[addr] = val;
-}
+struct PCTestdev *dev = opaque;
+uint64_t ret = 0;
+memcpy(ret, dev-iomem_buf[addr], len);
+ret = le64_to_cpu(ret);
 
-static void test_iomem_writew(void *opaque, hwaddr addr, uint32_t val)
-{
-*(uint16_t*)(iomem_buf + addr) = val;
+return ret;
 }
 
-static void test_iomem_writel(void *opaque, hwaddr addr, uint32_t val)
+static void test_iomem_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned len)
 {
-*(uint32_t*)(iomem_buf + addr) = val;
+struct PCTestdev *dev = opaque;
+val = cpu_to_le64(val);
+memcpy(dev-iomem_buf[addr], val, len);
+dev-iomem_buf[addr] = val;
 }
 
 static const MemoryRegionOps test_iomem_ops = {
-.old_mmio = {
-.read = { test_iomem_readb, test_iomem_readw, test_iomem_readl, },
-.write = { test_iomem_writeb, test_iomem_writew, test_iomem_writel, },
-},
+.read = test_iomem_read,
+.write = test_iomem_write,
 .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
@@ -137,9 +127,8 @@ static int init_test_device(ISADevice *isa)
  NULL, pc-testdev);
 portio_list_add(test_dev_port_list, get_system_io(), 0x0);
 
-iomem_buf = g_malloc0(0x1);
 memory_region_init_io(dev-iomem, test_iomem_ops, dev,
-  pc-testdev, 0x1);
+  pc-testdev, IOMEM_LEN);
 memory_region_add_subregion(isa_address_space(dev-dev), 0xff00,
   dev-iomem);
 return

[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v6

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3


Gerd Hoffmann (1):
  hw: add isa-debug-exit device v3

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v6

 hw/debugexit.c|   73 +++
 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  156 +
 3 files changed, 231 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device v3

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v2: Fixed rebase mistake

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
-- 
1.7.10.4




[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
-- 
1.7.10.4




[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v6

2012-12-13 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64\
-device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

Changes from v5:
* Fixed rebase mistake

Changes from v4:
* Pass iomem_buf as an opaque, as requested by Blue
* Ported to new MMIO schema, as requested by Jan

Changes from v3:
* Ported all register_ioport functions to memory API

Changes from v2:

* Rename struct testdev to PCTestdev
* Embed ioport_data into PCTestdev struct
* Porting most register_ioport functions to memory API

Changes from v1:

* Removed unused testdev member
* Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

* Removed port 0xf1, since now kvm-unit-tests use
  serial
* Removed exit code port 0xf4, since that can be
  replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

* Removed ram size port 0xd1, since guest memory
  size can be retrieved from firmware, there's a
  patch for kvm-unit-tests including an API to
  retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |1 +
 hw/pc-testdev.c   |  156 +
 2 files changed, 157 insertions(+)
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 56aaa9d..1ac5fc5 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -12,5 +12,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..75889e7
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,156 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device pc-testdev -serial stdio \
+ * -device isa-debugexit,iobase=0xf4,access-size=2 \
+ * -kernel /home/lmr/Code/virt-test.git/kvm/unittests/msr.flat
+ *
+ * Where msr.flat is one of the KVM unittests, present on a separate repo,
+ * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
+*/
+
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+#include exec-memory.h
+
+#define IOMEM_LEN0x1
+
+typedef struct PCTestdev {
+ISADevice dev;
+MemoryRegion iomem;
+uint32_t ioport_data;
+char iomem_buf[IOMEM_LEN];
+} PCTestdev;
+
+#define TYPE_TESTDEV pc-testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct PCTestdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct PCTestdev *dev = opaque;
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+struct PCTestdev *dev = opaque;
+dev-ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+struct PCTestdev *dev = opaque;
+return dev-ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+hwaddr len = 4096;
+void *a = cpu_physical_memory_map(data

[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
-- 
1.7.10.4




[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device v3

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v2: Fixed rebase mistake

Changes from v1: Add access_size property to the
device, needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
 hw/debugexit.c|   73 +
 hw/i386/Makefile.objs |2 +-
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..dfe1b2d
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
-- 
1.7.10.4




[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v6

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3


Gerd Hoffmann (1):
  hw: add isa-debug-exit device v3

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v6

 hw/debugexit.c|   73 +++
 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  156 +
 3 files changed, 231 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v6

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3

Gerd Hoffmann (1):
  hw: add isa-debug-exit device v4

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v7

 hw/debugexit.c|   87 ++
 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  161 +
 3 files changed, 250 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device v4

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v3:
 * Added a short description
 * Added a copyright notice
 * Added Signed-off-by line to the commit
   message
 * Made the GPL license header to say
   'or any later version', to simplify
   things and be more in line with other
   qemu source files
 * Turned TypeInfo into static const

Changes from v2:
 * Fixed rebase mistake

Changes from v1:
 * Add access_size property to the device,
   needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/debugexit.c|   87 +++
 hw/i386/Makefile.objs |2 +-
 hw/pc-testdev.c   |  156 +
 3 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..b90983b
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,87 @@
+/*
+ * QEMU debug exit port (LGPL'ed-VGA-BIOS-style port 501/502) emulation
+ *
+ * Copyright (c) 2012 Gerd Hoffmann
+ *
+ * (Based on previous work from Herve Poussineau)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static const TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..06cf872
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,156 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense

[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v7

2012-12-13 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64\
-device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

Changes from v6:
* Only use sys/mman.h and mprotect on non windows
  platforms

Changes from v5:
* Fixed rebase mistake

Changes from v4:
* Pass iomem_buf as an opaque, as requested by Blue
* Ported to new MMIO schema, as requested by Jan

Changes from v3:
* Ported all register_ioport functions to memory API

Changes from v2:

* Rename struct testdev to PCTestdev
* Embed ioport_data into PCTestdev struct
* Porting most register_ioport functions to memory API

Changes from v1:

* Removed unused testdev member
* Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

* Removed port 0xf1, since now kvm-unit-tests use
  serial
* Removed exit code port 0xf4, since that can be
  replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

* Removed ram size port 0xd1, since guest memory
  size can be retrieved from firmware, there's a
  patch for kvm-unit-tests including an API to
  retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |1 +
 hw/pc-testdev.c   |5 +
 2 files changed, 6 insertions(+)

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 56aaa9d..1ac5fc5 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -12,5 +12,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
index 06cf872..1bea8ea 100644
--- a/hw/pc-testdev.c
+++ b/hw/pc-testdev.c
@@ -35,7 +35,10 @@
  * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
  */
 
+#ifndef _WIN32
 #include sys/mman.h
+#endif
+
 #include hw.h
 #include qdev.h
 #include isa.h
@@ -77,10 +80,12 @@ static void test_device_flush_page(void *opaque, uint32_t 
addr, uint32_t data)
 hwaddr len = 4096;
 void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
 
+#ifndef _WIN32
 /* We might not be able to get the full page, only mprotect what we 
actually
have mapped */
 mprotect(a, len, PROT_NONE);
 mprotect(a, len, PROT_READ|PROT_WRITE);
+#endif
 cpu_physical_memory_unmap(a, len, 0, 0);
 }
 
-- 
1.7.10.4




[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v8

2012-12-13 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64\
-device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

Changes from v7:
* Fixed rebase mistake... again.

Changes from v6:
* Only use sys/mman.h and mprotect on non windows
  platforms

Changes from v5:
* Fixed rebase mistake

Changes from v4:
* Pass iomem_buf as an opaque, as requested by Blue
* Ported to new MMIO schema, as requested by Jan

Changes from v3:
* Ported all register_ioport functions to memory API

Changes from v2:

* Rename struct testdev to PCTestdev
* Embed ioport_data into PCTestdev struct
* Porting most register_ioport functions to memory API

Changes from v1:

* Removed unused testdev member
* Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

* Removed port 0xf1, since now kvm-unit-tests use
  serial
* Removed exit code port 0xf4, since that can be
  replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

* Removed ram size port 0xd1, since guest memory
  size can be retrieved from firmware, there's a
  patch for kvm-unit-tests including an API to
  retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Alexander Graf ag...@suse.de
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |1 +
 hw/pc-testdev.c   |  161 +
 2 files changed, 162 insertions(+)
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 56aaa9d..1ac5fc5 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -12,5 +12,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..1bea8ea
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,161 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device pc-testdev -serial stdio \
+ * -device isa-debugexit,iobase=0xf4,access-size=2 \
+ * -kernel /home/lmr/Code/virt-test.git/kvm/unittests/msr.flat
+ *
+ * Where msr.flat is one of the KVM unittests, present on a separate repo,
+ * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
+ */
+
+#ifndef _WIN32
+#include sys/mman.h
+#endif
+
+#include hw.h
+#include qdev.h
+#include isa.h
+#include exec-memory.h
+
+#define IOMEM_LEN0x1
+
+typedef struct PCTestdev {
+ISADevice dev;
+MemoryRegion iomem;
+uint32_t ioport_data;
+char iomem_buf[IOMEM_LEN];
+} PCTestdev;
+
+#define TYPE_TESTDEV pc-testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct PCTestdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct PCTestdev *dev = opaque;
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+struct PCTestdev *dev = opaque;
+dev-ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+struct PCTestdev *dev = opaque;
+return dev-ioport_data

[Qemu-devel] [PATCH 1/2] hw: add isa-debug-exit device v5

2012-12-13 Thread Lucas Meneghel Rodrigues
From: Gerd Hoffmann kra...@redhat.com

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.

Changes from v4:
 * Fixed rebase mistake... again.

Changes from v3:
 * Added a short description
 * Added a copyright notice
 * Added Signed-off-by line to the commit
   message
 * Made the GPL license header to say
   'or any later version', to simplify
   things and be more in line with other
   qemu source files
 * Turned TypeInfo into static const

Changes from v2:
 * Fixed rebase mistake

Changes from v1:
 * Add access_size property to the device,
   needed for kvm-unit-tests.

Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/debugexit.c|   87 +
 hw/i386/Makefile.objs |2 +-
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..b90983b
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,87 @@
+/*
+ * QEMU debug exit port (LGPL'ed-VGA-BIOS-style port 501/502) emulation
+ *
+ * Copyright (c) 2012 Gerd Hoffmann
+ *
+ * (Based on previous work from Herve Poussineau)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+uint8_t access_size;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, isa-access_size);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static const TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-y += lpc_ich9.o q35.o pc_q35.o
-- 
1.7.10.4




[Qemu-devel] [PATCH 0/2] Add pc-testdev to qemu v7

2012-12-13 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I took Gerd's recent patch and modified it to include the access-size
property, as well as fixed problems pointed in previous reviews of
the test device itself. Had to fix silly rebase mistakes, twice.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3

Gerd Hoffmann (1):
  hw: add isa-debug-exit device v5

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v8

 hw/i386/Makefile.objs |3 +-
 hw/pc-testdev.c   |  161 +
 2 files changed, 163 insertions(+), 1 deletion(-)
 create mode 100644 hw/pc-testdev.c

-- 
1.7.10.4




Re: [Qemu-devel] [PATCH] add isa-debug-exit device.

2012-12-12 Thread Lucas Meneghel Rodrigues

On 12/12/2012 01:29 PM, Paolo Bonzini wrote:

Il 12/12/2012 16:23, Gerd Hoffmann ha scritto:

When present it makes qemu exit on any write.
Mapped to port 0x501 by default.

Without this patch Anthony doesn't allow me to
remove the bochs bios debug ports because his
test suite uses this.


Wasn't this patch submitted already by Herve' first and Lucas second? :)

Lucas, what happened to your testdev patches?


I talked to Marcelo, he said he'd assume the patchset I sent to carry 
out with upstream inclusion. Since then I got absorbed in other tasks, 
so I really haven't checked the status.


Since it seem things got stalled, I'll resume from where I left, will 
re-send the patches soon.


Cheers,

Lucas


Paolo


Signed-off-by: Gerd Hoffmann kra...@redhat.com
---
  hw/debugexit.c|   71 +
  hw/i386/Makefile.objs |2 +-
  2 files changed, 72 insertions(+), 1 deletions(-)
  create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..e1f7570
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,71 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 or
+ * (at your option) version 3 of the License.
+ */
+
+#include hw.h
+#include isa.h
+
+#define TYPE_ISA_DEBUG_EXIT_DEVICE isa-debug-exit
+#define ISA_DEBUG_EXIT_DEVICE(obj) \
+ OBJECT_CHECK(ISADebugExitState, (obj), TYPE_ISA_DEBUG_EXIT_DEVICE)
+
+typedef struct ISADebugExitState {
+ISADevice parent_obj;
+
+uint32_t iobase;
+MemoryRegion io;
+} ISADebugExitState;
+
+static void debug_exit_write(void *opaque, hwaddr addr, uint64_t val,
+ unsigned width)
+{
+exit((val  1) | 1);
+}
+
+static const MemoryRegionOps debug_exit_ops = {
+.write = debug_exit_write,
+.valid.min_access_size = 1,
+.valid.max_access_size = 1,
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int debug_exit_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = ISA_DEBUG_EXIT_DEVICE(dev);
+
+memory_region_init_io(isa-io, debug_exit_ops, isa,
+  TYPE_ISA_DEBUG_EXIT_DEVICE, 1);
+memory_region_add_subregion(isa_address_space_io(dev),
+isa-iobase, isa-io);
+return 0;
+}
+
+static Property debug_exit_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debug_exit_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debug_exit_initfn;
+dc-props = debug_exit_properties;
+}
+
+static TypeInfo debug_exit_info = {
+.name  = TYPE_ISA_DEBUG_EXIT_DEVICE,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debug_exit_class_initfn,
+};
+
+static void debug_exit_register_types(void)
+{
+type_register_static(debug_exit_info);
+}
+
+type_init(debug_exit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 0d3f6a8..56aaa9d 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
  obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
  obj-y += vmport.o
  obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
  obj-y += pc_piix.o
  obj-y += pc_sysfw.o
  obj-y += lpc_ich9.o q35.o pc_q35.o









[Qemu-devel] [Bug 1058225] Re: When setting hardware clock on linux guest, hwclock shows crazy date (in the year 2043)

2012-10-16 Thread Lucas Meneghel Rodrigues
Paolo fixed the problem with upstream commit:

commit b6db4aca20e9af4f62c9c9e08b9b9672a6ed3390
Author: Paolo Bonzini pbonz...@redhat.com
Date:   Mon Oct 1 14:22:06 2012 +0200

rtc: fix overflow in mktimegm

When setting a date in 1980, Linux is actually disregarding the century
byte and setting the year to 2080.  This causes a year-2038 overflow
in mktimegm.  Fix this by doing the days-to-seconds computation in
64-bit math.

Reported-by: Lucas Meneghel Rodrigues look...@gmail.com
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Anthony Liguori aligu...@us.ibm.com

Confirmed that problem is solved. Closing bug.

** Changed in: qemu
   Status: New = Confirmed

** Changed in: qemu
   Status: Confirmed = Fix Committed

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1058225

Title:
  When setting hardware clock on linux guest, hwclock shows crazy date
  (in the year 2043)

Status in QEMU:
  Fix Committed

Bug description:
  Very easy to reproduce:

  1) Build the latest qemu.git (we've captured this on internal
  automated testing, verified manually), the commit for reference is:

  14:07:02 INFO | git commit ID is
  6f8fd2530e9a530f237240daf1c981fa5df7f978 (tag v1.2.0-461-g6f8fd25)

  2) Install a linux guest in it (caught with RHEL 6.2, verified with
  Fedora 17)

  3) In the linux guest, set the hardware clock with hwclock:

  /sbin/hwclock --set --date 2/2/80 03:04:00

  4) Verify if hardware clock was set back to the eighties:

  LC_ALL=C /sbin/hwclock

  5) Observe amazed that hwclock reports a date in the year 2043:

  14:09:34 INFO |  ('hwclock', 'FAIL', 2, Failed to set hwclock
  back to the eighties. Output of hwclock is 'Sun Dec 27 20:35:46 2043
  -0.489664 seconds')

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1058225/+subscriptions



[Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (LGPL VGA BIOS port 0x501) v2

2012-10-09 Thread Lucas Meneghel Rodrigues
From: Hervé Poussineau hpous...@reactos.org

Add generic support for simple I/O port which, when written to, cause
QEMU to exit with the given written value.

There is no vmstate associated with the debugging port, simply because
the entire interface is a single, stateless, write-only port.

Changes from v1:

 * Changing PIO from MMIO, as requested during review.

Signed-off-by: Hervé Poussineau hpous...@reactos.org
---
 hw/debugexit.c| 75 +++
 hw/i386/Makefile.objs |  2 +-
 2 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..fe4608c
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,75 @@
+/*
+ * QEMU debug exit port (LGPL'ed-VGA-BIOS-style port 501/502) emulation
+ *
+ * Copyright (c) 2012 Herve Poussineau
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include isa.h
+#include exec-memory.h
+
+typedef struct ISADebugExitState {
+ISADevice dev;
+uint32_t iobase;
+uint8_t access_size;
+} ISADebugExitState;
+
+static void debugexit_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+{
+exit((val  1) | 1);
+}
+
+static int debugexit_isa_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = DO_UPCAST(ISADebugExitState, dev, dev);
+
+const struct MemoryRegionPortio debugexit_portio_list[] = {
+{ isa-iobase, 1, isa-access_size, .write = debugexit_ioport_write, },
+PORTIO_END_OF_LIST(),
+};
+PortioList *debugexit_port_list = g_new(PortioList, 1);
+portio_list_init(debugexit_port_list, debugexit_portio_list,
+ NULL, isa-debugexit);
+portio_list_add(debugexit_port_list, get_system_io(), 0x0);
+return 0;
+}
+
+static Property debugexit_isa_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debugexit_isa_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debugexit_isa_initfn;
+dc-props = debugexit_isa_properties;
+}
+
+static TypeInfo debugexit_isa_info = {
+.name  = isa-debugexit,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debugexit_isa_class_initfn,
+};
+
+static void debugexit_register_types(void)
+{
+type_register_static(debugexit_isa_info);
+}
+
+type_init(debugexit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..b34c61c 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
-- 
1.7.11.4




[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v4

2012-10-09 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64 -device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

Changes from v3:
* Ported all register_ioport functions to memory API

Changes from v2:

* Rename struct testdev to PCTestdev
* Embed ioport_data into PCTestdev struct
* Porting most register_ioport functions to memory API

Changes from v1:

* Removed unused testdev member
* Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

* Removed port 0xf1, since now kvm-unit-tests use
  serial
* Removed exit code port 0xf4, since that can be
  replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

* Removed ram size port 0xd1, since guest memory
  size can be retrieved from firmware, there's a
  patch for kvm-unit-tests including an API to
  retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |   1 +
 hw/pc-testdev.c   | 167 ++
 2 files changed, 168 insertions(+)
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index b34c61c..3ef3b4a 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..d326e01
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,167 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device pc-testdev -serial stdio \
+ * -device isa-debugexit,iobase=0xf4,access-size=2 \
+ * -kernel /home/lmr/Code/virt-test.git/kvm/unittests/msr.flat
+ *
+ * Where msr.flat is one of the KVM unittests, present on a separate repo,
+ * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
+*/
+
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+#include exec-memory.h
+
+typedef struct PCTestdev {
+ISADevice dev;
+MemoryRegion iomem;
+uint32_t ioport_data;
+} PCTestdev;
+
+#define TYPE_TESTDEV pc-testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct PCTestdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct PCTestdev *dev = opaque;
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+struct PCTestdev *dev = opaque;
+dev-ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+struct PCTestdev *dev = opaque;
+return dev-ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void

[Qemu-devel] [PATCH 0/2] Adding pc-testdev to qemu v3

2012-10-09 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

I think now I've got all comments made by Jan sorted out.

I did notice that with the new test device, a lot of the
kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel /path/to/kvm/unittests/pcid.flat
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3

Hervé Poussineau (1):
  debugexit: support for custom exit port (LGPL VGA BIOS port 0x501) v2

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v4

 hw/debugexit.c|  75 +++
 hw/i386/Makefile.objs |   3 +-
 hw/pc-testdev.c   | 167 ++
 3 files changed, 244 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.11.4




[Qemu-devel] [Bug 1062411] Re: QEMU fails during migration and reports qemu: VQ 0 size 0x80 Guest index 0x2d6 inconsistent with Host index 0x18: delta 0x2be

2012-10-08 Thread Lucas Meneghel Rodrigues
No, I haven't. I'll do my best to reserve time this week to do so.

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1062411

Title:
  QEMU fails during migration and reports qemu: VQ 0 size 0x80 Guest
  index 0x2d6 inconsistent with Host index 0x18: delta 0x2be

Status in QEMU:
  New

Bug description:
  This issue is reproducing consistently on automated testing, verified
  on manual testing (although it may require many tries).

  Steps to reproduce:

  1) Start a linux guest. The command line used by automated testing
  was:

  10/05 06:48:27 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
  10/05 06:48:27 INFO |kvm_vm:1605| -S 
  10/05 06:48:27 INFO |kvm_vm:1605| -name 'vm1' 
  10/05 06:48:27 INFO |kvm_vm:1605| -nodefaults 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-062311-r6UwQhzg,path=/tmp/serial-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-062311-r6UwQhzg 
  10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-062311-r6UwQhzg,path=/tmp/seabios-20121005-062311-r6UwQhzg,server,nowait
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-062311-r6UwQhzg,iobase=0x402 
  10/05 06:48:27 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
  10/05 06:48:27 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idbdMz8N,mac='9a:cf:d0:d1:d2:d3',id='ida0Kc7l' 
  10/05 06:48:27 INFO |kvm_vm:1605| -netdev tap,id=idbdMz8N,fd=21 
  10/05 06:48:27 INFO |kvm_vm:1605| -m 2048 
  10/05 06:48:27 INFO |kvm_vm:1605| -smp 2,cores=1,threads=1,sockets=2 
  10/05 06:48:27 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 
  10/05 06:48:27 INFO |kvm_vm:1605| -vnc :0 
  10/05 06:48:27 INFO |kvm_vm:1605| -vga std 
  10/05 06:48:27 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none  
  10/05 06:48:27 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off  
  10/05 06:48:27 INFO |kvm_vm:1605| -enable-kvm

  Start a new VM in incoming mode. The example on this bug is using TCP
  protocol:

  10/05 07:18:56 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
  10/05 07:18:56 INFO |kvm_vm:1605| -S 
  10/05 07:18:56 INFO |kvm_vm:1605| -name 'vm1' 
  10/05 07:18:56 INFO |kvm_vm:1605| -nodefaults 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-071855-5QYsCtRS,path=/tmp/serial-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-071855-5QYsCtRS 
  10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-071855-5QYsCtRS,path=/tmp/seabios-20121005-071855-5QYsCtRS,server,nowait
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-071855-5QYsCtRS,iobase=0x402 
  10/05 07:18:56 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
  10/05 07:18:56 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0 
  10/05 07:18:56 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idERNnUO,mac='9a:cf:d0:d1:d2:d3',id='ideI7zfw' 
  10/05 07:18:56 INFO |kvm_vm:1605| -netdev tap,id=idERNnUO,fd=32 
  10/05 07:18:56 INFO |kvm_vm:1605| -m 2048 
  10/05 07:18:56 INFO |kvm_vm:1605| -smp 

[Qemu-devel] [Bug 1062411] [NEW] QEMU fails during migration and reports qemu: VQ 0 size 0x80 Guest index 0x2d6 inconsistent with Host index 0x18: delta 0x2be

2012-10-05 Thread Lucas Meneghel Rodrigues
Public bug reported:

This issue is reproducing consistently on automated testing, verified on
manual testing (although it may require many tries).

Steps to reproduce:

1) Start a linux guest. The command line used by automated testing was:

10/05 06:48:27 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
10/05 06:48:27 INFO |kvm_vm:1605| -S 
10/05 06:48:27 INFO |kvm_vm:1605| -name 'vm1' 
10/05 06:48:27 INFO |kvm_vm:1605| -nodefaults 
10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-062311-r6UwQhzg,server,nowait
 
10/05 06:48:27 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-062311-r6UwQhzg,path=/tmp/serial-20121005-062311-r6UwQhzg,server,nowait
 
10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-062311-r6UwQhzg 
10/05 06:48:27 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-062311-r6UwQhzg,path=/tmp/seabios-20121005-062311-r6UwQhzg,server,nowait
 
10/05 06:48:27 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-062311-r6UwQhzg,iobase=0x402 
10/05 06:48:27 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
10/05 06:48:27 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
10/05 06:48:27 INFO |kvm_vm:1605| -device virtio-blk-pci,drive=virtio0 
10/05 06:48:27 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idbdMz8N,mac='9a:cf:d0:d1:d2:d3',id='ida0Kc7l' 
10/05 06:48:27 INFO |kvm_vm:1605| -netdev tap,id=idbdMz8N,fd=21 
10/05 06:48:27 INFO |kvm_vm:1605| -m 2048 
10/05 06:48:27 INFO |kvm_vm:1605| -smp 2,cores=1,threads=1,sockets=2 
10/05 06:48:27 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 
10/05 06:48:27 INFO |kvm_vm:1605| -vnc :0 
10/05 06:48:27 INFO |kvm_vm:1605| -vga std 
10/05 06:48:27 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none  
10/05 06:48:27 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off  
10/05 06:48:27 INFO |kvm_vm:1605| -enable-kvm

Start a new VM in incoming mode. The example on this bug is using TCP
protocol:

10/05 07:18:56 INFO |kvm_vm:1605| MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu 
10/05 07:18:56 INFO |kvm_vm:1605| -S 
10/05 07:18:56 INFO |kvm_vm:1605| -name 'vm1' 
10/05 07:18:56 INFO |kvm_vm:1605| -nodefaults 
10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline 
10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20121005-071855-5QYsCtRS,server,nowait
 
10/05 07:18:56 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control 
10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20121005-071855-5QYsCtRS,path=/tmp/serial-20121005-071855-5QYsCtRS,server,nowait
 
10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20121005-071855-5QYsCtRS 
10/05 07:18:56 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20121005-071855-5QYsCtRS,path=/tmp/seabios-20121005-071855-5QYsCtRS,server,nowait
 
10/05 07:18:56 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20121005-071855-5QYsCtRS,iobase=0x402 
10/05 07:18:56 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1 
10/05 07:18:56 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0
 
10/05 07:18:56 INFO |kvm_vm:1605| -device virtio-blk-pci,drive=virtio0 
10/05 07:18:56 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idERNnUO,mac='9a:cf:d0:d1:d2:d3',id='ideI7zfw' 
10/05 07:18:56 INFO |kvm_vm:1605| -netdev tap,id=idERNnUO,fd=32 
10/05 07:18:56 INFO |kvm_vm:1605| -m 2048 
10/05 07:18:56 INFO |kvm_vm:1605| -smp 2,cores=1,threads=1,sockets=2 
10/05 07:18:56 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 
10/05 07:18:56 INFO |kvm_vm:1605| -vnc :1 
10/05 07:18:56 INFO |kvm_vm:1605| -vga std 
10/05 07:18:56 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none  
10/05 07:18:56 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off  
10/05 07:18:56 INFO |kvm_vm:1605| -enable-kvm 
10/05 07:18:56 INFO |kvm_vm:1605| -incoming 

Re: [Qemu-devel] qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-04 Thread Lucas Meneghel Rodrigues

On 10/04/2012 07:48 AM, Jan Kiszka wrote:

On 2012-10-03 15:19, Paolo Bonzini wrote:

Il 03/10/2012 12:57, Lucas Meneghel Rodrigues ha scritto:

Yep, I did send patches with the testdev device present on qemu-kvm.git
to qemu.git a while ago, but there were many comments on the review, I
ended up not implementing everything that was asked and the patches were
archived.

If nobody wants to step up to port it, I'll re-read the original thread
and will spin up new patches (and try to go through the end with it).
Executing the KVM unittests is something that we can't afford to lose,
so I'd say it's important on this last mile effort to get rid of qemu-kvm.


Absolutely, IIRC the problem was that testdev did a little bit of
everything... let's see what's the functionality of testdev:

- write (port 0xf1), can be replaced in autotest with:
-device isa-debugcon,iobase=0xf1,chardev=...

- exit code (port 0xf4), see this series:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

- ram size (port 0xd1).  If we can also patch kvm-unittests, the memory
is available in the CMOS or in fwcfg.  Here is the SeaBIOS code:

 u32 rs = ((inb_cmos(0x34)  16) | (inb_cmos(0x35)  24));
 if (rs)
 rs += 16 * 1024 * 1024;
 else
 rs = (((inb_cmos(0x30)  10) | (inb_cmos(0x31)  18))
   + 1 * 1024 * 1024);

The rest (ports 0xe0..0xe7, 0x2000..0x2017, MMIO) can be left in testdev.


IIRC, one of the biggest problem with testdev was its hack to inject
interrupts.


Jan, I assume this commit helps to fix this, right?

commit b334ec567f1de9a60349991e7b75083d569ddb0a
Author: Jan Kiszka jan.kis...@siemens.com
Date:   Fri Mar 2 10:30:47 2012 +0100

qemu-kvm: Use upstream kvm-i8259

Drop the qemu-kvm version in favor of the equivalent upstream
implementation. This allows to move the i8259 back into the hwlib.

Note that this also drops the testdev hack and restores proper
isa_get_irq. If testdev scripts exist that inject  IRQ15, they need
fixing. Testing for these interrupts on the PIIX3 makes no practical
sense anyway as those lines are unused.

Signed-off-by: Jan Kiszka jan.kis...@siemens.com
Signed-off-by: Avi Kivity a...@redhat.com





Re: [Qemu-devel] qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-04 Thread Lucas Meneghel Rodrigues

On 10/04/2012 09:27 AM, Jan Kiszka wrote:

On 2012-10-04 14:10, Lucas Meneghel Rodrigues wrote:

On 10/04/2012 07:48 AM, Jan Kiszka wrote:

On 2012-10-03 15:19, Paolo Bonzini wrote:

Il 03/10/2012 12:57, Lucas Meneghel Rodrigues ha scritto:

Yep, I did send patches with the testdev device present on qemu-kvm.git
to qemu.git a while ago, but there were many comments on the review, I
ended up not implementing everything that was asked and the patches were
archived.

If nobody wants to step up to port it, I'll re-read the original thread
and will spin up new patches (and try to go through the end with it).
Executing the KVM unittests is something that we can't afford to lose,
so I'd say it's important on this last mile effort to get rid of qemu-kvm.


Absolutely, IIRC the problem was that testdev did a little bit of
everything... let's see what's the functionality of testdev:

- write (port 0xf1), can be replaced in autotest with:
-device isa-debugcon,iobase=0xf1,chardev=...

- exit code (port 0xf4), see this series:
http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

- ram size (port 0xd1).  If we can also patch kvm-unittests, the memory
is available in the CMOS or in fwcfg.  Here is the SeaBIOS code:

  u32 rs = ((inb_cmos(0x34)  16) | (inb_cmos(0x35)  24));
  if (rs)
  rs += 16 * 1024 * 1024;
  else
  rs = (((inb_cmos(0x30)  10) | (inb_cmos(0x31)  18))
+ 1 * 1024 * 1024);

The rest (ports 0xe0..0xe7, 0x2000..0x2017, MMIO) can be left in testdev.


IIRC, one of the biggest problem with testdev was its hack to inject
interrupts.


Jan, I assume this commit helps to fix this, right?

commit b334ec567f1de9a60349991e7b75083d569ddb0a
Author: Jan Kiszka jan.kis...@siemens.com
Date:   Fri Mar 2 10:30:47 2012 +0100

  qemu-kvm: Use upstream kvm-i8259

  Drop the qemu-kvm version in favor of the equivalent upstream
  implementation. This allows to move the i8259 back into the hwlib.

  Note that this also drops the testdev hack and restores proper
  isa_get_irq. If testdev scripts exist that inject  IRQ15, they need
  fixing. Testing for these interrupts on the PIIX3 makes no practical
  sense anyway as those lines are unused.

  Signed-off-by: Jan Kiszka jan.kis...@siemens.com
  Signed-off-by: Avi Kivity a...@redhat.com


Yes, this improved it a lot as we no longer depend on additional
changes. I'm not sure if there was resistance beyond that.

When cleaning up the code: register_ioport_read must be replaced with
the memory API.


I did look at the MemoryRegionOps/memory_region_init_io and still did 
not figure out how to port things. I'll send a v2 addressing all the 
comments made so far but this one, just to see if people are OK with the 
direction of the full patch, then if you could give me some pointers of 
how to do this conversion, it'd be great.





[Qemu-devel] [PATCH 0/2] Adding pc-testdev to qemu

2012-10-04 Thread Lucas Meneghel Rodrigues
These two patches introduce:

 1) A ISA debugexit port device, that when written, causes qemu
to exit with the exit code passed as parameter.
 2) A port of the existing testdev present on qemu-kvm to qemu

One particular comment of previous reviews wasn't addressed, but
I'd like people to see this to see if we're in the right direction.

Another thing I did notice is that with the new test device, a lot
of the kvm-unit-tests are failing. The same tests are passing fine
under qemu-kvm, meaning there are some bugs we need to address.

Example:

qemu-kvm:

$ x86_64-softmmu/qemu-system-x86_64 -device testdev -serial stdio -kernel 
/path/to/kvm/unittests/pcid.flat 
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: PASS
Test on INVPCID when disabled: PASS
3 tests, 0 failures
$ echo $?
0

qemu:

$ x86_64-softmmu/qemu-system-x86_64 -device pc-testdev -serial stdio -device 
isa-debugexit,iobase=0xf4,access-size=4 -kernel 
/path/to/kvm/unittests/pcid.flat 
VNC server running on `127.0.0.1:5900'
enabling apic
CPUID consistency: PASS
Test on PCID when disabled: FAIL
Test on INVPCID when disabled: PASS
3 tests, 1 failures
$ echo $?
3


Hervé Poussineau (1):
  debugexit: support for custom exit port (LGPL VGA BIOS port 0x501)

Lucas Meneghel Rodrigues (1):
  hw: Add test device for unittests execution v2

 hw/debugexit.c|  68 +
 hw/i386/Makefile.objs |   3 +-
 hw/pc-testdev.c   | 160 ++
 3 files changed, 230 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c
 create mode 100644 hw/pc-testdev.c

-- 
1.7.11.4




[Qemu-devel] [PATCH 2/2] hw: Add test device for unittests execution v2

2012-10-04 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite.

Intended Usage:

qemu-system-x86_64 -device pc-testdev -serial stdio \
-device isa-debugexit,iobase=0xf4,access-size=4 \
-kernel /path/to/kvm/unittests/msr.flat

Where msr.flat is one of the KVM unittests, present on a
separate repo,

git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git

I still didn't figure out how to port register_ioport_read
to the memory API, but hopefully we'll get there.

Changes from v2:

1) Removed unused testdev member
2) Renamed device to a less generic name, pc-testdev

Initial changes from initial attempt:

1) Removed port 0xf1, since now kvm-unit-tests use
   serial
2) Removed exit code port 0xf4, since that can be
   replaced by

-device isa-debugexit,iobase=0xf4,access-size=4

3) Removed ram size port 0xd1, since guest memory
   size can be retrieved from firmware, there's a
   patch for kvm-unit-tests including an API to
   retrieve that value.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |   1 +
 hw/pc-testdev.c   | 160 ++
 2 files changed, 161 insertions(+)
 create mode 100644 hw/pc-testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index b34c61c..3ef3b4a 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += pc-testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/pc-testdev.c b/hw/pc-testdev.c
new file mode 100644
index 000..0234adb
--- /dev/null
+++ b/hw/pc-testdev.c
@@ -0,0 +1,160 @@
+/*
+ * QEMU x86 ISA testdev
+ *
+ * Copyright (c) 2012 Avi Kivity, Gerd Hoffmann, Marcelo Tosatti
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/*
+ * This device is used to test KVM features specific to the x86 port, such
+ * as emulation, power management, interrupt routing, among others. It's meant
+ * to be used like:
+ *
+ * qemu-system-x86_64 -device pc-testdev -serial stdio \
+ * -device isa-debugexit,iobase=0xf4,access-size=2 \
+ * -kernel /home/lmr/Code/virt-test.git/kvm/unittests/msr.flat
+ *
+ * Where msr.flat is one of the KVM unittests, present on a separate repo,
+ * git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git
+*/
+
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+
+struct testdev {
+ISADevice dev;
+MemoryRegion iomem;
+};
+
+#define TYPE_TESTDEV pc-testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct testdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct testdev *dev = opaque;
+
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static uint32 test_device_ioport_data;
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+test_device_ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+return test_device_ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
+{
+return iomem_buf[addr];
+}
+
+static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
+{
+return *(uint16_t*)(iomem_buf + addr

[Qemu-devel] [PATCH 1/2] debugexit: support for custom exit port (LGPL VGA BIOS port 0x501)

2012-10-04 Thread Lucas Meneghel Rodrigues
From: Hervé Poussineau hpous...@reactos.org

Add generic support for simple I/O port which, when written to, cause
QEMU to exit with the given written value.

There is no vmstate associated with the debugging port, simply because
the entire interface is a single, stateless, write-only port.

Signed-off-by: Hervé Poussineau hpous...@reactos.org
---
 hw/debugexit.c| 68 +++
 hw/i386/Makefile.objs |  2 +-
 2 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 hw/debugexit.c

diff --git a/hw/debugexit.c b/hw/debugexit.c
new file mode 100644
index 000..5c0d726
--- /dev/null
+++ b/hw/debugexit.c
@@ -0,0 +1,68 @@
+/*
+ * QEMU debug exit port (LGPL'ed-VGA-BIOS-style port 501/502) emulation
+ *
+ * Copyright (c) 2012 Herve Poussineau
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see http://www.gnu.org/licenses/.
+ */
+
+#include isa.h
+
+typedef struct ISADebugExitState {
+ISADevice dev;
+uint32_t iobase;
+uint8_t access_size;
+} ISADebugExitState;
+
+static void debugexit_ioport_write(void *opaque, uint32_t addr, uint32_t val)
+{
+exit((val  1) | 1);
+}
+
+static int debugexit_isa_initfn(ISADevice *dev)
+{
+ISADebugExitState *isa = DO_UPCAST(ISADebugExitState, dev, dev);
+
+register_ioport_write(isa-iobase, 1, isa-access_size,
+  debugexit_ioport_write, NULL);
+return 0;
+}
+
+static Property debugexit_isa_properties[] = {
+DEFINE_PROP_HEX32(iobase, ISADebugExitState, iobase, 0x501),
+DEFINE_PROP_UINT8(access-size, ISADebugExitState, access_size, 1),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void debugexit_isa_class_initfn(ObjectClass *klass, void *data)
+{
+DeviceClass *dc = DEVICE_CLASS(klass);
+ISADeviceClass *ic = ISA_DEVICE_CLASS(klass);
+ic-init = debugexit_isa_initfn;
+dc-props = debugexit_isa_properties;
+}
+
+static TypeInfo debugexit_isa_info = {
+.name  = isa-debugexit,
+.parent= TYPE_ISA_DEVICE,
+.instance_size = sizeof(ISADebugExitState),
+.class_init= debugexit_isa_class_initfn,
+};
+
+static void debugexit_register_types(void)
+{
+type_register_static(debugexit_isa_info);
+}
+
+type_init(debugexit_register_types)
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..b34c61c 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -3,7 +3,7 @@ obj-y += apic_common.o apic.o kvmvapic.o
 obj-y += sga.o ioapic_common.o ioapic.o piix_pci.o
 obj-y += vmport.o
 obj-y += pci-hotplug.o smbios.o wdt_ib700.o
-obj-y += debugcon.o multiboot.o
+obj-y += debugcon.o debugexit.o multiboot.o
 obj-y += pc_piix.o
 obj-y += pc_sysfw.o
 obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o
-- 
1.7.11.4




Re: [Qemu-devel] qemu-kvm: remove boot=on|off drive parameter compatibility

2012-10-03 Thread Lucas Meneghel Rodrigues

On 10/03/2012 06:55 AM, Gleb Natapov wrote:

On Mon, Oct 01, 2012 at 03:26:05PM +0200, Jan Kiszka wrote:

On 2012-10-01 15:19, Anthony Liguori wrote:

Jan Kiszka jan.kis...@siemens.com writes:


On 2012-10-01 11:31, Marcelo Tosatti wrote:

It's not just about default configs. We need to validate if the
migration formats are truly compatible (qemu-kvm - QEMU, the other way
around definitely not). For the command line switches, we could provide
a wrapper script that translates them into upstream format or simply
ignores them. That should be harmless to carry upstream.


qemu-kvm has:

  -no-kvm
  -no-kvm-irqchip
  -no-kvm-pit
  -no-kvm-pit-reinjection
  -tdf - does nothing

There are replacements for all of the above.  If we need to add them to
qemu.git, it's not big deal to add them.


But I don't think we should add them to the source code. This can
perfectly be handled my a (disposable) script layer on top of
qemu-system-x86_64 - the namespace (qemu-kvm in most cases) is also free.



  -drive ...,boot= - this is ignored

cpu_set command for CPU hotplug which is known broken in qemu-kvm.


Right, so nothing is lost when migrating to QEMU.



testdev which is nice but only used for development


Jan, do you have a plan for testdev device? It would be a pity to have
qemu-kvm just for that.


Yep, I did send patches with the testdev device present on qemu-kvm.git 
to qemu.git a while ago, but there were many comments on the review, I 
ended up not implementing everything that was asked and the patches were 
archived.


If nobody wants to step up to port it, I'll re-read the original thread 
and will spin up new patches (and try to go through the end with it). 
Executing the KVM unittests is something that we can't afford to lose, 
so I'd say it's important on this last mile effort to get rid of qemu-kvm.





[Qemu-devel] [PATCH] hw: Add test device for unittests execution

2012-10-03 Thread Lucas Meneghel Rodrigues
Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite [1].

Usage:

qemu -device testdev

1) Removed port 0xf1, since now kvm-unit-tests use
   serial

2) Removed exit code port 0xf4, since that can be
   replaced by

-device isa-debugexit,iobase=0xf4,access-size=2

3) Removed ram size port 0xd1, since guest memory
   size can be retrieved from firmware, there's a
   patch for kvm-unit-tests including an API to
   retrieve that value.

[1] Preliminary versions of this patch were posted
to the mailing list about a year ago, I re-read the
comments of the thread, and had guidance from
Paolo about which ports to remove from the test
device.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
 hw/i386/Makefile.objs |   1 +
 hw/testdev.c  | 131 ++
 2 files changed, 132 insertions(+)
 create mode 100644 hw/testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..64d2787 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
 obj-y += kvm/
 obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += testdev.o
 
 obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/testdev.c b/hw/testdev.c
new file mode 100644
index 000..44070f2
--- /dev/null
+++ b/hw/testdev.c
@@ -0,0 +1,131 @@
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+
+struct testdev {
+ISADevice dev;
+MemoryRegion iomem;
+CharDriverState *chr;
+};
+
+#define TYPE_TESTDEV testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct testdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct testdev *dev = opaque;
+
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static uint32 test_device_ioport_data;
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+test_device_ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+return test_device_ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
+{
+return iomem_buf[addr];
+}
+
+static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
+{
+return *(uint16_t*)(iomem_buf + addr);
+}
+
+static uint32_t test_iomem_readl(void *opaque, target_phys_addr_t addr)
+{
+return *(uint32_t*)(iomem_buf + addr);
+}
+
+static void test_iomem_writeb(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+iomem_buf[addr] = val;
+}
+
+static void test_iomem_writew(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint16_t*)(iomem_buf + addr) = val;
+}
+
+static void test_iomem_writel(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint32_t*)(iomem_buf + addr) = val;
+}
+
+static const MemoryRegionOps test_iomem_ops = {
+.old_mmio = {
+.read = { test_iomem_readb, test_iomem_readw, test_iomem_readl, },
+.write = { test_iomem_writeb, test_iomem_writew, test_iomem_writel, },
+},
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int init_test_device(ISADevice *isa)
+{
+struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
+
+register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
+register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
+register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
+iomem_buf = g_malloc0(0x1);
+memory_region_init_io(dev-iomem, test_iomem_ops, dev,
+  testdev, 0x1);
+memory_region_add_subregion(isa_address_space(dev-dev), 0xff00,
+  dev-iomem);
+return 0;
+}
+
+static Property testdev_isa_properties[] = {
+DEFINE_PROP_CHR(chardev, struct testdev, chr),
+DEFINE_PROP_END_OF_LIST(),
+};
+
+static void testdev_class_init(ObjectClass *klass, void *data)
+{
+DeviceClass *dc

Re: [Qemu-devel] [PATCH] hw: Add test device for unittests execution

2012-10-03 Thread Lucas Meneghel Rodrigues

On 10/04/2012 12:49 AM, Lucas Meneghel Rodrigues wrote:

Add a test device which supports the kvmctl ioports,
so one can run the KVM unittest suite [1].

Usage:

qemu -device testdev

1) Removed port 0xf1, since now kvm-unit-tests use
serial

2) Removed exit code port 0xf4, since that can be
replaced by

-device isa-debugexit,iobase=0xf4,access-size=2


I forgot to mention that this would work *if* the isa-debugexit device 
gets upstream. Paolo pointed this thread:


http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg00818.html

But it appears that no consensus was reached.


3) Removed ram size port 0xd1, since guest memory
size can be retrieved from firmware, there's a
patch for kvm-unit-tests including an API to
retrieve that value.

[1] Preliminary versions of this patch were posted
to the mailing list about a year ago, I re-read the
comments of the thread, and had guidance from
Paolo about which ports to remove from the test
device.

CC: Paolo Bonzini pbonz...@redhat.com
Signed-off-by: Gerd Hoffmann kra...@redhat.com
Signed-off-by: Avi Kivity a...@redhat.com
Signed-off-by: Marcelo Tosatti mtosa...@redhat.com
Signed-off-by: Lucas Meneghel Rodrigues l...@redhat.com
---
  hw/i386/Makefile.objs |   1 +
  hw/testdev.c  | 131 ++
  2 files changed, 132 insertions(+)
  create mode 100644 hw/testdev.c

diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
index 8c764bb..64d2787 100644
--- a/hw/i386/Makefile.objs
+++ b/hw/i386/Makefile.objs
@@ -11,5 +11,6 @@ obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
  obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o 
xen_pt_msi.o
  obj-y += kvm/
  obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
+obj-y += testdev.o

  obj-y := $(addprefix ../,$(obj-y))
diff --git a/hw/testdev.c b/hw/testdev.c
new file mode 100644
index 000..44070f2
--- /dev/null
+++ b/hw/testdev.c
@@ -0,0 +1,131 @@
+#include sys/mman.h
+#include hw.h
+#include qdev.h
+#include isa.h
+
+struct testdev {
+ISADevice dev;
+MemoryRegion iomem;
+CharDriverState *chr;
+};
+
+#define TYPE_TESTDEV testdev
+#define TESTDEV(obj) \
+ OBJECT_CHECK(struct testdev, (obj), TYPE_TESTDEV)
+
+static void test_device_irq_line(void *opaque, uint32_t addr, uint32_t data)
+{
+struct testdev *dev = opaque;
+
+qemu_set_irq(isa_get_irq(dev-dev, addr - 0x2000), !!data);
+}
+
+static uint32 test_device_ioport_data;
+
+static void test_device_ioport_write(void *opaque, uint32_t addr, uint32_t 
data)
+{
+test_device_ioport_data = data;
+}
+
+static uint32_t test_device_ioport_read(void *opaque, uint32_t addr)
+{
+return test_device_ioport_data;
+}
+
+static void test_device_flush_page(void *opaque, uint32_t addr, uint32_t data)
+{
+target_phys_addr_t len = 4096;
+void *a = cpu_physical_memory_map(data  ~0xffful, len, 0);
+
+mprotect(a, 4096, PROT_NONE);
+mprotect(a, 4096, PROT_READ|PROT_WRITE);
+cpu_physical_memory_unmap(a, len, 0, 0);
+}
+
+static char *iomem_buf;
+
+static uint32_t test_iomem_readb(void *opaque, target_phys_addr_t addr)
+{
+return iomem_buf[addr];
+}
+
+static uint32_t test_iomem_readw(void *opaque, target_phys_addr_t addr)
+{
+return *(uint16_t*)(iomem_buf + addr);
+}
+
+static uint32_t test_iomem_readl(void *opaque, target_phys_addr_t addr)
+{
+return *(uint32_t*)(iomem_buf + addr);
+}
+
+static void test_iomem_writeb(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+iomem_buf[addr] = val;
+}
+
+static void test_iomem_writew(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint16_t*)(iomem_buf + addr) = val;
+}
+
+static void test_iomem_writel(void *opaque, target_phys_addr_t addr, uint32_t 
val)
+{
+*(uint32_t*)(iomem_buf + addr) = val;
+}
+
+static const MemoryRegionOps test_iomem_ops = {
+.old_mmio = {
+.read = { test_iomem_readb, test_iomem_readw, test_iomem_readl, },
+.write = { test_iomem_writeb, test_iomem_writew, test_iomem_writel, },
+},
+.endianness = DEVICE_LITTLE_ENDIAN,
+};
+
+static int init_test_device(ISADevice *isa)
+{
+struct testdev *dev = DO_UPCAST(struct testdev, dev, isa);
+
+register_ioport_read(0xe0, 1, 1, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 1, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 2, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 2, test_device_ioport_write, dev);
+register_ioport_read(0xe0, 1, 4, test_device_ioport_read, dev);
+register_ioport_write(0xe0, 1, 4, test_device_ioport_write, dev);
+register_ioport_write(0xe4, 1, 4, test_device_flush_page, dev);
+register_ioport_write(0x2000, 24, 1, test_device_irq_line, NULL);
+iomem_buf = g_malloc0(0x1);
+memory_region_init_io(dev-iomem, test_iomem_ops, dev,
+  testdev, 0x1);
+memory_region_add_subregion(isa_address_space(dev-dev), 0xff00

[Qemu-devel] Bug: When setting hardware clock on linux guest, hwclock shows crazy date (in the year 2043)

2012-09-28 Thread Lucas Meneghel Rodrigues

Very easy to reproduce:

1) Build the latest qemu.git (we've captured this on internal automated 
testing, verified manually), the commit for reference is:


14:07:02 INFO | git commit ID is 
6f8fd2530e9a530f237240daf1c981fa5df7f978 (tag v1.2.0-461-g6f8fd25)


2) Install a linux guest in it (caught with RHEL 6.2, verified with 
Fedora 17)


3) In the linux guest, set the hardware clock with hwclock:

/sbin/hwclock --set --date 2/2/80 03:04:00

4) Verify if hardware clock was set back to the eighties:

LC_ALL=C /sbin/hwclock

5) Observe amazed that hwclock reports a date in the year 2043:

14:09:34 INFO | ('hwclock', 'FAIL', 2, Failed to set hwclock back to 
the eighties. Output of hwclock is 'Sun Dec 27 20:35:46 2043 -0.489664 
seconds')




[Qemu-devel] [Bug 1058225] [NEW] When setting hardware clock on linux guest, hwclock shows crazy date (in the year 2043)

2012-09-28 Thread Lucas Meneghel Rodrigues
Public bug reported:

Very easy to reproduce:

1) Build the latest qemu.git (we've captured this on internal automated
testing, verified manually), the commit for reference is:

14:07:02 INFO | git commit ID is
6f8fd2530e9a530f237240daf1c981fa5df7f978 (tag v1.2.0-461-g6f8fd25)

2) Install a linux guest in it (caught with RHEL 6.2, verified with
Fedora 17)

3) In the linux guest, set the hardware clock with hwclock:

/sbin/hwclock --set --date 2/2/80 03:04:00

4) Verify if hardware clock was set back to the eighties:

LC_ALL=C /sbin/hwclock

5) Observe amazed that hwclock reports a date in the year 2043:

14:09:34 INFO |  ('hwclock', 'FAIL', 2, Failed to set hwclock
back to the eighties. Output of hwclock is 'Sun Dec 27 20:35:46 2043
-0.489664 seconds')

** Affects: qemu
 Importance: Undecided
 Status: New


** Tags: kvmclock

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1058225

Title:
  When setting hardware clock on linux guest, hwclock shows crazy date
  (in the year 2043)

Status in QEMU:
  New

Bug description:
  Very easy to reproduce:

  1) Build the latest qemu.git (we've captured this on internal
  automated testing, verified manually), the commit for reference is:

  14:07:02 INFO | git commit ID is
  6f8fd2530e9a530f237240daf1c981fa5df7f978 (tag v1.2.0-461-g6f8fd25)

  2) Install a linux guest in it (caught with RHEL 6.2, verified with
  Fedora 17)

  3) In the linux guest, set the hardware clock with hwclock:

  /sbin/hwclock --set --date 2/2/80 03:04:00

  4) Verify if hardware clock was set back to the eighties:

  LC_ALL=C /sbin/hwclock

  5) Observe amazed that hwclock reports a date in the year 2043:

  14:09:34 INFO |  ('hwclock', 'FAIL', 2, Failed to set hwclock
  back to the eighties. Output of hwclock is 'Sun Dec 27 20:35:46 2043
  -0.489664 seconds')

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1058225/+subscriptions



Re: [Qemu-devel] qemu.git/qemu-kvm.git bugs during migrate + reboot

2012-09-25 Thread Lucas Meneghel Rodrigues

On 09/25/2012 09:59 AM, Anthony Liguori wrote:

Lucas Meneghel Rodrigues l...@redhat.com writes:


Hi guys,

We're seeing the following problem during upstream testing:

qemu: VQ 0 size 0x80 Guest index 0x2d6
  inconsistent with Host index 0x18: delta 0x2be
  qemu: warning:  error while loading state for
  instance 0x0 of device ':00:04.0/virtio-blk'
  load of migration failed

This is happening consistently with qemu and qemu-kvm. Test case is
simple, while the vm goes through a reboot loop, a parallel ping-pong
migration loop happens.

I'm happy to provide more details and logs.


Can you provide the full command line?


Sure. The problem happens with *all* migration protocols, let's use as 
an example the protocol fd. The vm is started with:


09/22 07:26:19 INFO |kvm_vm:1605| /usr/local/autotest/tests/kvm/qemu
09/22 07:26:19 INFO |kvm_vm:1605| -S
09/22 07:26:19 INFO |kvm_vm:1605| -name 'vm1'
09/22 07:26:19 INFO |kvm_vm:1605| -nodefaults
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20120922-072139-HDnHgnLh,path=/tmp/serial-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20120922-072139-HDnHgnLh
09/22 07:26:19 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20120922-072139-HDnHgnLh,path=/tmp/seabios-20120922-072139-HDnHgnLh,server,nowait 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20120922-072139-HDnHgnLh,iobase=0x402

09/22 07:26:19 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1
09/22 07:26:19 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0 

09/22 07:26:19 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0
09/22 07:26:19 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idPQlGQt,mac='9a:4b:4c:4d:4e:4f',id='id01mORp'

09/22 07:26:19 INFO |kvm_vm:1605| -netdev tap,id=idPQlGQt,fd=24
09/22 07:26:19 INFO |kvm_vm:1605| -m 2048
09/22 07:26:19 INFO |kvm_vm:1605| -smp 
2,cores=1,threads=1,sockets=2
09/22 07:26:19 INFO |kvm_vm:1605| -device 
usb-tablet,id=usb-tablet1,bus=usb1.0,port=1

09/22 07:26:19 INFO |kvm_vm:1605| -vnc :0
09/22 07:26:19 INFO |kvm_vm:1605| -vga std
09/22 07:26:19 INFO |kvm_vm:1605| -rtc 
base=utc,clock=host,driftfix=none

09/22 07:26:19 INFO |kvm_vm:1605| -boot order=cdn,once=c,menu=off
09/22 07:26:19 INFO |kvm_vm:1605| -enable-kvm
09/22 07:26:19 INFO |kvm_vm:1605| -enable-kvm

Then the state will be migrated to a new process:

09/22 07:26:48 INFO |kvm_vm:1605| /usr/local/autotest/tests/kvm/qemu
09/22 07:26:48 INFO |kvm_vm:1605| -S
09/22 07:26:48 INFO |kvm_vm:1605| -name 'vm1'
09/22 07:26:48 INFO |kvm_vm:1605| -nodefaults
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -mon 
chardev=hmp_id_humanmonitor1,mode=readline
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor-qmpmonitor1-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -mon 
chardev=qmp_id_qmpmonitor1,mode=control
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=serial_id_20120922-072648-g6gL8thp,path=/tmp/serial-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
isa-serial,chardev=serial_id_20120922-072648-g6gL8thp
09/22 07:26:48 INFO |kvm_vm:1605| -chardev 
socket,id=seabioslog_id_20120922-072648-g6gL8thp,path=/tmp/seabios-20120922-072648-g6gL8thp,server,nowait 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
isa-debugcon,chardev=seabioslog_id_20120922-072648-g6gL8thp,iobase=0x402

09/22 07:26:48 INFO |kvm_vm:1605| -device ich9-usb-uhci1,id=usb1
09/22 07:26:48 INFO |kvm_vm:1605| -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',if=none,cache=none,id=virtio0 

09/22 07:26:48 INFO |kvm_vm:1605| -device 
virtio-blk-pci,drive=virtio0
09/22 07:26:48 INFO |kvm_vm:1605| -device 
virtio-net-pci,netdev=idSld9kt,mac='9a:4b:4c:4d:4e:4f',id='idFBA7Vj'

09/22 07:26:48 INFO |kvm_vm:1605| -netdev tap,id=idSld9kt,fd=45
09/22 07:26:48 INFO |kvm_vm:1605| -m 2048
09/22 07:26:48 INFO |kvm_vm:1605| -smp 
2

[Qemu-devel] qemu.git/qemu-kvm.git bugs during migrate + reboot

2012-09-20 Thread Lucas Meneghel Rodrigues

Hi guys,

We're seeing the following problem during upstream testing:

qemu: VQ 0 size 0x80 Guest index 0x2d6
inconsistent with Host index 0x18: delta 0x2be
qemu: warning:  error while loading state for
instance 0x0 of device ':00:04.0/virtio-blk'
load of migration failed

This is happening consistently with qemu and qemu-kvm. Test case is 
simple, while the vm goes through a reboot loop, a parallel ping-pong 
migration loop happens.


I'm happy to provide more details and logs.

Lucas



[Qemu-devel] [Bug 1047576] Re: qemu unittest emulator failure on latest git master

2012-09-07 Thread Lucas Meneghel Rodrigues
** Attachment added: results.tar.bz2
   
https://bugs.launchpad.net/bugs/1047576/+attachment/3299328/+files/results.tar.bz2

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047576

Title:
  qemu unittest emulator failure on latest git master

Status in QEMU:
  New

Bug description:
  Running the emulator unittest, using the cmdline:

  16:01:30 INFO | Running emulator
  16:01:30 INFO | Running qemu command (reformatted):
  16:01:30 INFO | 
/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 
  16:01:30 INFO | -S 
  16:01:30 INFO | -name 'unittest_vm' 
  16:01:30 INFO | -nodefaults 
  16:01:30 INFO | -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 
  16:01:30 INFO | -chardev 
socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 
  16:01:30 INFO | -chardev 
socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 
  16:01:30 INFO | -m 512 
  16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 
  16:01:30 INFO | -kernel 
'/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat'
 
  16:01:30 INFO | -vnc :0 
  16:01:30 INFO | -chardev 
file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 
  16:01:30 INFO | -device testdev,chardev=testlog 
  16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none  
  16:01:30 INFO | -boot order=cdn,once=c,menu=off   
  16:01:30 INFO | -S 
  16:01:30 INFO | -enable-kvm

  We get

  16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, 
output in /tmp/testlog-20120907-155940-WomlFZY3
  16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1
  16:01:32 INFO | [qemu output] emulation failure
  16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 
RCX=f000 RDX=0044d2b0
  16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 
RBP=eff8 RSP=0044d2b0
  16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 
R10= R11=
  16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 
R14=1fff5000 R15=
  16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] 
CPL=0 II=0 A20=1 SMM=0 HLT=0
  16:01:32 INFO | [qemu output] ES =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] CS =0008   00a09b00 
DPL=0 CS64 [-RA]
  16:01:32 INFO | [qemu output] SS =   
  16:01:32 INFO | [qemu output] DS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] FS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] GS =0010 0044c370  00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] LDT=   8200 
DPL=0 LDT
  16:01:32 INFO | [qemu output] TR =0048 0040a452  8b00 
DPL=0 TSS64-busy
  16:01:32 INFO | [qemu output] GDT= 0040a00a 0447
  16:01:32 INFO | [qemu output] IDT=  0fff
  16:01:32 INFO | [qemu output] CR0=80010011 CR2= 
CR3=1000 CR4=0020
  16:01:32 INFO | [qemu output] DR0= DR1= 
DR2= DR3=
  16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400
  16:01:32 INFO | [qemu output] EFER=0500
  16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 
48 89 e9 48 89 c5 c9 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 
40 0f 94 c6 40 0f b6 f6 21 c6

  More logs will be attached to this bug report.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047576/+subscriptions



[Qemu-devel] [Bug 1047576] Re: qemu unittest emulator failure on latest git master

2012-09-07 Thread Lucas Meneghel Rodrigues
Adding relevant qemu and unittest versions

software_version_qemu_kvm=git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git:master:4c3e02beed9878a5f760eeceb6cd42c475cf0127
software_version_kvm_unit_tests=git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git:master:09b657b6d3a80d0424b8b370462a77d284117926

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047576

Title:
  qemu unittest emulator failure on latest git master

Status in QEMU:
  New

Bug description:
  Running the emulator unittest, using the cmdline:

  16:01:30 INFO | Running emulator
  16:01:30 INFO | Running qemu command (reformatted):
  16:01:30 INFO | 
/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 
  16:01:30 INFO | -S 
  16:01:30 INFO | -name 'unittest_vm' 
  16:01:30 INFO | -nodefaults 
  16:01:30 INFO | -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 
  16:01:30 INFO | -chardev 
socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 
  16:01:30 INFO | -chardev 
socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 
  16:01:30 INFO | -m 512 
  16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 
  16:01:30 INFO | -kernel 
'/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat'
 
  16:01:30 INFO | -vnc :0 
  16:01:30 INFO | -chardev 
file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 
  16:01:30 INFO | -device testdev,chardev=testlog 
  16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none  
  16:01:30 INFO | -boot order=cdn,once=c,menu=off   
  16:01:30 INFO | -S 
  16:01:30 INFO | -enable-kvm

  We get

  16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, 
output in /tmp/testlog-20120907-155940-WomlFZY3
  16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1
  16:01:32 INFO | [qemu output] emulation failure
  16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 
RCX=f000 RDX=0044d2b0
  16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 
RBP=eff8 RSP=0044d2b0
  16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 
R10= R11=
  16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 
R14=1fff5000 R15=
  16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] 
CPL=0 II=0 A20=1 SMM=0 HLT=0
  16:01:32 INFO | [qemu output] ES =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] CS =0008   00a09b00 
DPL=0 CS64 [-RA]
  16:01:32 INFO | [qemu output] SS =   
  16:01:32 INFO | [qemu output] DS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] FS =0010   00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] GS =0010 0044c370  00c09300 
DPL=0 DS   [-WA]
  16:01:32 INFO | [qemu output] LDT=   8200 
DPL=0 LDT
  16:01:32 INFO | [qemu output] TR =0048 0040a452  8b00 
DPL=0 TSS64-busy
  16:01:32 INFO | [qemu output] GDT= 0040a00a 0447
  16:01:32 INFO | [qemu output] IDT=  0fff
  16:01:32 INFO | [qemu output] CR0=80010011 CR2= 
CR3=1000 CR4=0020
  16:01:32 INFO | [qemu output] DR0= DR1= 
DR2= DR3=
  16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400
  16:01:32 INFO | [qemu output] EFER=0500
  16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 
48 89 e9 48 89 c5 c9 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 
40 0f 94 c6 40 0f b6 f6 21 c6

  More logs will be attached to this bug report.

To manage notifications about this bug go to:
https://bugs.launchpad.net/qemu/+bug/1047576/+subscriptions



[Qemu-devel] [Bug 1047576] [NEW] qemu unittest emulator failure on latest git master

2012-09-07 Thread Lucas Meneghel Rodrigues
Public bug reported:

Running the emulator unittest, using the cmdline:

16:01:30 INFO | Running emulator
16:01:30 INFO | Running qemu command (reformatted):
16:01:30 INFO | /home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 
16:01:30 INFO | -S 
16:01:30 INFO | -name 'unittest_vm' 
16:01:30 INFO | -nodefaults 
16:01:30 INFO | -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait
 
16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 
16:01:30 INFO | -chardev 
socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait
 
16:01:30 INFO | -device 
isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 
16:01:30 INFO | -chardev 
socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait
 
16:01:30 INFO | -device 
isa-debugcon,chardev=seabioslog_id_20120907-155940-WomlFZY3,iobase=0x402 
16:01:30 INFO | -m 512 
16:01:30 INFO | -smp 2,cores=1,threads=1,sockets=2 
16:01:30 INFO | -kernel 
'/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/unittests/emulator.flat'
 
16:01:30 INFO | -vnc :0 
16:01:30 INFO | -chardev 
file,id=testlog,path=/tmp/testlog-20120907-155940-WomlFZY3 
16:01:30 INFO | -device testdev,chardev=testlog 
16:01:30 INFO | -rtc base=utc,clock=host,driftfix=none  
16:01:30 INFO | -boot order=cdn,once=c,menu=off   
16:01:30 INFO | -S 
16:01:30 INFO | -enable-kvm

We get

16:01:32 INFO | Waiting for unittest emulator to complete, timeout 600, output 
in /tmp/testlog-20120907-155940-WomlFZY3
16:01:32 INFO | [qemu output] KVM internal error. Suberror: 1
16:01:32 INFO | [qemu output] emulation failure
16:01:32 INFO | [qemu output] RAX=eff8 RBX=e000 
RCX=f000 RDX=0044d2b0
16:01:32 INFO | [qemu output] RSI=0044c9fa RDI=0044e370 
RBP=eff8 RSP=0044d2b0
16:01:32 INFO | [qemu output] R8 =000a R9 =03f8 
R10= R11=
16:01:32 INFO | [qemu output] R12=e000 R13=1fff6000 
R14=1fff5000 R15=
16:01:32 INFO | [qemu output] RIP=00400a89 RFL=00010002 [---] CPL=0 
II=0 A20=1 SMM=0 HLT=0
16:01:32 INFO | [qemu output] ES =0010   00c09300 DPL=0 
DS   [-WA]
16:01:32 INFO | [qemu output] CS =0008   00a09b00 DPL=0 
CS64 [-RA]
16:01:32 INFO | [qemu output] SS =   
16:01:32 INFO | [qemu output] DS =0010   00c09300 DPL=0 
DS   [-WA]
16:01:32 INFO | [qemu output] FS =0010   00c09300 DPL=0 
DS   [-WA]
16:01:32 INFO | [qemu output] GS =0010 0044c370  00c09300 DPL=0 
DS   [-WA]
16:01:32 INFO | [qemu output] LDT=   8200 DPL=0 
LDT
16:01:32 INFO | [qemu output] TR =0048 0040a452  8b00 DPL=0 
TSS64-busy
16:01:32 INFO | [qemu output] GDT= 0040a00a 0447
16:01:32 INFO | [qemu output] IDT=  0fff
16:01:32 INFO | [qemu output] CR0=80010011 CR2= 
CR3=1000 CR4=0020
16:01:32 INFO | [qemu output] DR0= DR1= 
DR2= DR3=
16:01:32 INFO | [qemu output] DR6=0ff0 DR7=0400
16:01:32 INFO | [qemu output] EFER=0500
16:01:32 INFO | [qemu output] Code=88 77 00 49 8d 84 24 f8 0f 00 00 48 89 e2 48 
89 e9 48 89 c5 c9 48 87 e2 48 87 e9 48 81 f9 99 88 77 00 0f 94 c0 48 39 d5 40 
0f 94 c6 40 0f b6 f6 21 c6

More logs will be attached to this bug report.

** Affects: qemu
 Importance: Undecided
 Status: New


** Tags: unittest

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1047576

Title:
  qemu unittest emulator failure on latest git master

Status in QEMU:
  New

Bug description:
  Running the emulator unittest, using the cmdline:

  16:01:30 INFO | Running emulator
  16:01:30 INFO | Running qemu command (reformatted):
  16:01:30 INFO | 
/home/lmr/Code/autotest.git/autotest/client/tests/virt/kvm/qemu 
  16:01:30 INFO | -S 
  16:01:30 INFO | -name 'unittest_vm' 
  16:01:30 INFO | -nodefaults 
  16:01:30 INFO | -chardev 
socket,id=hmp_id_humanmonitor1,path=/tmp/monitor-humanmonitor1-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -mon chardev=hmp_id_humanmonitor1,mode=readline 
  16:01:30 INFO | -chardev 
socket,id=serial_id_20120907-155940-WomlFZY3,path=/tmp/serial-20120907-155940-WomlFZY3,server,nowait
 
  16:01:30 INFO | -device 
isa-serial,chardev=serial_id_20120907-155940-WomlFZY3 
  16:01:30 INFO | -chardev 
socket,id=seabioslog_id_20120907-155940-WomlFZY3,path=/tmp/seabios-20120907-155940-WomlFZY3,server,nowait
 

[Qemu-devel] qemu.git v1.0-1852-gf05f6b4 regression - Bus error, followed by core dump

2012-04-03 Thread Lucas Meneghel Rodrigues
Hi,

We've noticed the following error during Windows install when using the
latest qemu from HEAD:

04/03 01:45:42 INFO |   aexpect:0786| [qemu output] /bin/sh: line 1: 21674 Bus 
error   (core dumped) MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std -monitor 
unix:'/tmp/monitor-humanmonitor1-20120403-014341-3gsf',server,nowait -qmp 
unix:'/tmp/monitor-qmpmonitor1-20120403-014341-3gsf',server,nowait -serial 
unix:'/tmp/serial-20120403-014341-3gsf',server,nowait -device 
ich9-usb-uhci1,id=usb1 -drive 
file='/tmp/kvm_autotest_root/images/win7-64-sp1.qcow2',index=0,if=virtio,cache=none
 -device virtio-net-pci,netdev=idoz6GVm,mac='9a:8e:fc:08:52:29',id='idodEJ4d' 
-netdev tap,id=idoz6GVm,fd=23 -m 2048 -smp 2 -drive 
file='/tmp/kvm_autotest_root/isos/windows/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso',media=cdrom,index=1
 -drive 
file='/tmp/kvm_autotest_root/isos/windows/winutils.iso',media=cdrom,index=2 
-drive file='/tmp/kvm_autotest_root/isos/virtio-win.iso',media=cdrom,index=3 
-fda '/tmp/kvm_autotest_root/images/win7-64-sp1/answer.vfd' -device 
usb-tablet,id=usb-tablet1,bus=usb1.0 -vnc :0 -boot d -enable-kvm
04/03 01:45:42 INFO |   aexpect:0786| [qemu output] (Process terminated with 
status 135)

The actual command line used is:

MALLOC_PERTURB_=1 /usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults 
-vga std -monitor 
unix:'/tmp/monitor-humanmonitor1-20120403-014341-3gsf',server,nowait -qmp 
unix:'/tmp/monitor-qmpmonitor1-20120403-014341-3gsf',server,nowait -serial 
unix:'/tmp/serial-20120403-014341-3gsf',server,nowait -device 
ich9-usb-uhci1,id=usb1 -drive 
file='/tmp/kvm_autotest_root/images/win7-64-sp1.qcow2',index=0,if=virtio,cache=none
 -device virtio-net-pci,netdev=idoz6GVm,mac='9a:8e:fc:08:52:29',id='idodEJ4d' 
-netdev tap,id=idoz6GVm,fd=23 -m 2048 -smp 2 -drive 
file='/tmp/kvm_autotest_root/isos/windows/en_windows_7_ultimate_with_sp1_x64_dvd_u_677332.iso',media=cdrom,index=1
 -drive 
file='/tmp/kvm_autotest_root/isos/windows/winutils.iso',media=cdrom,index=2 
-drive file='/tmp/kvm_autotest_root/isos/virtio-win.iso',media=cdrom,index=3 
-fda '/tmp/kvm_autotest_root/images/win7-64-sp1/answer.vfd' -device 
usb-tablet,id=usb-tablet1,bus=usb1.0 -vnc :0  -boot d -enable-kvm

A similar error happened during RHEL 6.2 install

04/03 01:43:55 INFO |   aexpect:0786| [qemu output] /bin/sh: line 1: 21368 Bus 
error   (core dumped) MALLOC_PERTURB_=1 
/usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults -vga std -monitor 
unix:'/tmp/monitor-humanmonitor1-20120403-014341-3gsf',server,nowait -qmp 
unix:'/tmp/monitor-qmpmonitor1-20120403-014341-3gsf',server,nowait -serial 
unix:'/tmp/serial-20120403-014341-3gsf',server,nowait -device 
ich9-usb-uhci1,id=usb1 -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',index=0,if=virtio,cache=none
 -device virtio-net-pci,netdev=id9w6EMs,mac='9a:8e:fc:08:f7:80',id='idodEJ4d' 
-netdev tap,id=id9w6EMs,fd=23 -m 2048 -smp 2 -drive 
file='/tmp/kvm_autotest_root/isos/linux/RHEL-6.2-x86_64-DVD.iso',media=cdrom,index=2
 -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64/ks.iso',media=cdrom,index=1 
-device usb-tablet,id=usb-tablet1,bus=usb1.0 -kernel 
'/tmp/kvm_autotest_root/images/rhel62-64/vmlinuz' -append 'ks=cdrom nicdelay=60 
console=ttyS0,115200 console=tty0' -initrd 
'/tmp/kvm_autotest_root/images/rhel62-64/initrd.img' -vnc :0 -boot d -enable-kvm
04/03 01:43:55 INFO |   aexpect:0786| [qemu output] (Process terminated with 
status 135)

MALLOC_PERTURB_=1 /usr/local/autotest/tests/kvm/qemu -name 'vm1' -nodefaults 
-vga std -monitor 
unix:'/tmp/monitor-humanmonitor1-20120403-014341-3gsf',server,nowait -qmp 
unix:'/tmp/monitor-qmpmonitor1-20120403-014341-3gsf',server,nowait -serial 
unix:'/tmp/serial-20120403-014341-3gsf',server,nowait -device 
ich9-usb-uhci1,id=usb1 -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64.qcow2',index=0,if=virtio,cache=none
 -device virtio-net-pci,netdev=id9w6EMs,mac='9a:8e:fc:08:f7:80',id='idodEJ4d' 
-netdev tap,id=id9w6EMs,fd=23 -m 2048 -smp 2 -drive 
file='/tmp/kvm_autotest_root/isos/linux/RHEL-6.2-x86_64-DVD.iso',media=cdrom,index=2
 -drive 
file='/tmp/kvm_autotest_root/images/rhel62-64/ks.iso',media=cdrom,index=1 
-device usb-tablet,id=usb-tablet1,bus=usb1.0 -kernel 
'/tmp/kvm_autotest_root/images/rhel62-64/vmlinuz' -append 'ks=cdrom nicdelay=60 
console=ttyS0,115200 console=tty0' -initrd 
'/tmp/kvm_autotest_root/images/rhel62-64/initrd.img' -vnc :0  -boot d 
-enable-kvm

The relevant git commit used was:

04/03 01:41:37 DEBUG|base_utils:0077| Running '/usr/bin/git fetch -q -f -u -t 
git://git.qemu.org/qemu.git master:master'
04/03 01:41:41 INFO |   git:0153| git commit ID is 
f05f6b4adb4db3affb0cdd17383b0a7e905e66e1 (tag v1.0-1852-gf05f6b4)

There's a 2.1 core dump file saved in our results server, if there's any 
interested in it by contributors outside Red Hat, I can ssh it to some box, as 
requested.

So, even though it might be some flag 

Re: [Qemu-devel] [RFC] Future goals for autotest and virtualization tests

2012-03-09 Thread Lucas Meneghel Rodrigues

On 03/09/2012 09:13 AM, Anthony Liguori wrote:

On 03/08/2012 05:07 PM, Lucas Meneghel Rodrigues wrote:

Here is the qemu-test version

http://git.qemu.org/?p=qemu-test.git;a=blob;f=tests/virtio-serial.sh;h=e95ae6e0b63758262919702d51a9c83bebe2fb08;hb=master



So virtio-serial is an exception in autotest:

2174 virtio_console.py
1875 cgroup.py
615 ksm_overcommit.py
439 qemu_img.py
407 qmp_basic.py
389 qmp_basic_rhel6.py
356 stepmaker.py
247 steps.py

// The next largest actual test of QEMU
203 pci_hotplug.py
190 cdrom.py
182 physical_resources_check.py
181 timedrift.py
170 enospc.py
150 balloon_check.py
138 multi_disk.py
121 unittest.py
117 migration.py
111 cpu_hotplug.py
107 migration_multi_host.py
104 nic_hotplug.py
103 timedrift_with_stop.py
96 timedrift_with_migration.py
...

So picking virtio-serial as your comparison point is not really
representative of kvm-autotest but at any rate...


We have a bunch of high level test functions in 
client/virt/virt_test_utils.py that contain some commonly used test 
functions such as migration and running autotest tests on vms, and other 
functions, that allow us to reuse those functions on the tests and save 
code, but we can reasonably assume that it doesn't change the order of 
magnitude of the actual qemu tests in size, so point taken.


You also have a point in the respect that a lot of the large tests are 
more linux-qemu integration tests, name cpuflags, cgroups, ksm_overcommit.


The point you tried to make and I replied to was 'qemu-test tests are 
all smaller than the equivalent kvm autotest tests'. Well, sure they 
tend to be, but in pretty much all cases more code means more 
functionality being covered, and making sure the same test works on 
RHEL5, RHEL6, upstream, on an Ubuntu, Fedora, RHEL or even Windows guests.


It is indeed a bit nerve wrecking to hear that all you can do with the 
stuff you have been working on the last 3 years can be done better with 
a dozen of shell script functions. It's similar to say that we just like 
to throw lines at a text editor just for the fun of it. I am sure you 
didn't mean it but that is how it sounded, and that's why I'd like to 
assure that the code there *does stuff*. It's just that this extra stuff 
is potentially not interesting to the goal of doing developer level 
regression testing of qemu alone.




Re: [Qemu-devel] [RFC] Future goals for autotest and virtualization tests

2012-03-09 Thread Lucas Meneghel Rodrigues

On 03/09/2012 11:13 AM, Anthony Liguori wrote:

It is indeed a bit nerve wrecking to hear that all you can do with the
stuff you
have been working on the last 3 years can be done better with a dozen
of shell
script functions. It's similar to say that we just like to throw lines
at a text
editor just for the fun of it. I am sure you didn't mean it but that
is how it
sounded, and that's why I'd like to assure that the code there *does
stuff*.


Look at how this discussion started. We've been discussing testing on
qemu-devel at excruciating length and detail and have finally come to
something of a consensus. AFAIK, no one from autotest has participated
in those discussions which is fair as I'm sure ya'll don't read
qemu-devel religiously.


All right, point taken.


Then we see this note that more or less declares, this is how QEMU
should do all of its testing. What reaction did you really expect there
to be? :-)


It was an attempt to offer what we have rather than dictating how QEMU 
should do all its testing:



One of our main goals is to provide useful tools for the qemu community,
since we have a good number of tests and libraries written to perform
integration/QA testing for that tool, being successfuly used by a number
of QA teams that work on qemu.


I re-read the first message I sent, and certainly did not find where we 
declare that this is the way QEMU should do its testing.


If you judge that there's nothing interesting there for qemu, I'm fine 
with it. That all said, certainly I did not expect your repeated 
attempts to show that you can do it all better with a couple of shell 
script lines, oh boy, I did not.




  1   2   3   >