Peter Maydell [Tue, 26 Jan 2016 18:16:58 +0000 (18:16 +0000)]
ppc: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1453832250-766-6-git-send-email-peter.maydell@linaro.org
Peter Maydell [Tue, 26 Jan 2016 18:16:57 +0000 (18:16 +0000)]
lm32: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1453832250-766-5-git-send-email-peter.maydell@linaro.org
Peter Maydell [Tue, 26 Jan 2016 18:16:56 +0000 (18:16 +0000)]
exec: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1453832250-766-4-git-send-email-peter.maydell@linaro.org
Peter Maydell [Tue, 26 Jan 2016 18:16:55 +0000 (18:16 +0000)]
crypto: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1453832250-766-3-git-send-email-peter.maydell@linaro.org
Peter Maydell [Tue, 26 Jan 2016 18:16:54 +0000 (18:16 +0000)]
migration: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1453832250-766-2-git-send-email-peter.maydell@linaro.org
Peter Maydell [Thu, 28 Jan 2016 11:46:33 +0000 (11:46 +0000)]
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-
20160128' into staging
Mostly bugfixes and small improvements; and the gdb target.xml
patch.
# gpg: Signature made Thu 28 Jan 2016 11:02:14 GMT using RSA key ID
C6F02FAF
# gpg: Good signature from "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg: aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
* remotes/cohuck/tags/s390x-
20160128:
s390x: s390_cpu_get_phys_page_debug has to return -1
gdb: provide the name of the architecture in the target.xml
s390x/css: fix control flags during csch
watchdog/diag288: don't reset for action=none|debug|pause
watchdog: introduction of get_watchdog_action
s390x: fix generation of event information crw
s390x/ioinst: set type and len for SEI response
s390x/sclp: add device to the sysbus in sclp_realize
s390x/machine: make addon register fields static
s390x/skeys: Fix instance and class size
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Peter Maydell [Tue, 26 Jan 2016 18:05:31 +0000 (18:05 +0000)]
microblaze: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id:
1453831531-667-3-git-send-email-peter.maydell@linaro.org
Peter Maydell [Tue, 26 Jan 2016 18:05:30 +0000 (18:05 +0000)]
disas/microblaze.c: Don't define TRUE or FALSE
Don't define TRUE and FALSE locally or manually include stdio.h;
instead use osdep.h which provides them.
This is a necessary prerequisite for moving to "everywhere includes
osdep.h", because otherwise there is a compile error due to the
redefinition of TRUE and FALSE.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id:
1453831531-667-2-git-send-email-peter.maydell@linaro.org
David Hildenbrand [Wed, 9 Dec 2015 15:36:42 +0000 (16:36 +0100)]
s390x: s390_cpu_get_phys_page_debug has to return -1
If translation fails, we have to return -1. For now, we
would simply return the value last stored to raddr (if any).
This way, reading invalid memory via gdb will return values, although it
shouldn't.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
David Hildenbrand [Thu, 3 Dec 2015 12:14:41 +0000 (13:14 +0100)]
gdb: provide the name of the architecture in the target.xml
This patch provides the name of the architecture in the target.xml
if available.
This allows the remote gdb to detect the target architecture on its
own - so there is no need to specify it manually (e.g. if gdb is
started without a binary) using "set arch *arch_name*".
The name of the architecture is provided by a callback that can
be implemented by all architectures. The arm implementation has
special handling for iwmmxt and returns arm otherwise. This can
be extended if necessary.
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
[rework to use a callback]
Message-Id: <
1449144881-130935-1-git-send-email-borntraeger@de.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Halil Pasic [Wed, 20 Jan 2016 18:51:30 +0000 (19:51 +0100)]
s390x/css: fix control flags during csch
From the beginning, css support contained an error in csch handling:
instead of setting the clear bit in the function control bits twice, we
need to set the clear pending bit in the activity control bits. Let's
fix this.
Cc: qemu-stable@nongnu.org
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Bo Tu [Tue, 19 Jan 2016 07:45:19 +0000 (08:45 +0100)]
watchdog/diag288: don't reset for action=none|debug|pause
If the watchdog expires and the guest is not notified (NONE, DEBUG, PAUSE),
we must not reset the watchdog device, otherwise watchdog_ping() and
watchdog_stop() will fail when triggered by the guest. This reset behavior
matches to the z/VM behavior when a custom command is to be executed
on expiry.
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Bo Tu <tubo@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Bo Tu [Tue, 19 Jan 2016 07:34:41 +0000 (08:34 +0100)]
watchdog: introduction of get_watchdog_action
Add get_watchdog_action(void) to allow access to the configured action.
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Bo Tu <tubo@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Song Shan Gong [Tue, 19 Jan 2016 01:55:00 +0000 (02:55 +0100)]
s390x: fix generation of event information crw
Only one channel report word (crw) may be pending if there is
event-information pending.
This patch introduces a bool-type field 'sei_pending' for the
channel subsystem, which indicates whether there are pending events.
It is set when event information is made pending and the crw
generated, and cleared after the guest has collected all pending
event information. A crw is not generated if this flag had already
been set.
Signed-off-by: Song Shan Gong <gongss@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Pierre Morel [Thu, 14 Jan 2016 12:29:53 +0000 (13:29 +0100)]
s390x/ioinst: set type and len for SEI response
If no event information is pending, the return code
is set to 0x0005 and the length of the response is
set to 8 bytes.
Signed-off-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Song Shan Gong <gongss@linux.vnet.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
David Hildenbrand [Mon, 23 Nov 2015 12:03:08 +0000 (13:03 +0100)]
s390x/sclp: add device to the sysbus in sclp_realize
The init of a device should have no side effects. Therefore move
registering of the event facility into the realize function, so
multiple instances of the SCLP device can be created e.g. for
introspection.
Add some more detail as to why we have to add it to the sysbus
at all.
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Christian Borntraeger [Tue, 8 Dec 2015 08:22:52 +0000 (09:22 +0100)]
s390x/machine: make addon register fields static
No need to have them as global symbol.
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Christian Borntraeger [Tue, 8 Dec 2015 08:16:27 +0000 (09:16 +0100)]
s390x/skeys: Fix instance and class size
fix a typo that messes up instance and class size.
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Peter Maydell [Tue, 26 Jan 2016 17:25:11 +0000 (17:25 +0000)]
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-
20160126-2' into staging
Xen 2016/01/26 with Signed-off-by lines.
# gpg: Signature made Tue 26 Jan 2016 17:20:12 GMT using RSA key ID
70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"
* remotes/sstabellini/tags/xen-
20160126-2:
xen: make it possible to build without the Xen PV domain builder
xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.
xen: Use stable library interfaces when they are available.
xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages
xen: Switch to libxengnttab interface for compat shims.
xen: Switch to libxenevtchn interface for compat shims.
xen_console: correctly cleanup primary console on teardown.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Ian Campbell [Fri, 15 Jan 2016 13:23:44 +0000 (13:23 +0000)]
xen: make it possible to build without the Xen PV domain builder
Until the previous patch this relied on xc_fd(), which was only
implemented for Xen 4.0 and earlier.
Given this wasn't working since Xen 4.0 I have marked this as disabled
by default.
Removing this support drops the use of a bunch of symbols from
libxenctrl, specifically:
- xc_domain_create
- xc_domain_destroy
- xc_domain_getinfo
- xc_domain_max_vcpus
- xc_domain_setmaxmem
- xc_domain_unpause
- xc_evtchn_alloc_unbound
- xc_linux_build
This is another step towards only using Xen libraries which provide a
stable inteface.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:43 +0000 (13:23 +0000)]
xen: domainbuild: reopen libxenctrl interface after forking for domain watcher.
Using an existing libxenctrl handle after a fork was never
particularly safe (especially if foreign mappings existed at the time
of the fork) and the xc fd has been unavailable for many releases.
Reopen the handle after fork and therefore do away with xc_fd().
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:42 +0000 (13:23 +0000)]
xen: Use stable library interfaces when they are available.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
Specifically libxenevtchn, libxengnttab and libxenforeignmemory.
Previous patches have already laid the groundwork for using these by
switching the existing compatibility shims to reflect the intefaces to
these libraries.
So all which remains is to update configure to detect the libraries
and enable their use. Although they are notionally independent we take
an all or nothing approach to the three libraries since they were
added at the same time.
The only non-obvious bit is that we now open a proper xenforeignmemory
handle for xen_fmem instead of reusing the xen_xc handle.
Build tested with 4.0 .. 4.6 (inclusive) and the patches targetting
4.7 which adds these libraries.
This uses CONFIG_XEN_CTRL_INTERFACE_VERSION == 471 to cover the
introduction of these new interfaces.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:41 +0000 (13:23 +0000)]
xen: Switch uses of xc_map_foreign_{pages,bulk} to use libxenforeignmemory API.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.
The new xenforeignmemory_map() function behaves like
xc_map_foreign_pages() when the err argument is NULL and like
xc_map_foreign_bulk() when err is non-NULL, which maps into the shim
here onto checking err == NULL and calling the appropriate old
function.
Note that xenforeignmemory_map() takes the number of pages before the
arrays themselves, in order to support potentially future use of
variable-length-arrays in the prototype (in the future, when Xen's
baseline toolchain requirements are new enough to ensure VLAs are
supported).
In preparation for adding support for libxenforeignmemory add support
to the <=4.0 and <=4.6 compat code in xen_common.h to allow us to
switch to using the new API. These shims will disappear for versions
of Xen which include libxenforeignmemory.
Since libxenforeignmemory will have its own handle type but for <= 4.6
the functionality is provided by using a libxenctrl handle we
introduce a new global xen_fmem alongside the existing xen_xc. In fact
we make xen_fmem a pointer to the existing xen_xc, which then works
correctly with both <=4.0 (xc handle is an int) and <=4.6 (xc handle
is a pointer). In the latter case xen_fmem is actually a double
indirect pointer, but it all falls out in the wash.
Unlike libxenctrl libxenforeignmemory has an explicit unmap function,
rather than just specifying that munmap should be used, so the unmap
paths are updated to use xenforeignmemory_unmap, which is a shim for
munmap on these versions of xen. The mappings in xen-hvm.c do not
appear to be unmapped (which makes sense for a qemu-dm process)
In fb_disconnect this results in a change from simply mmap over the
existing mapping (with an implicit munmap) to expliclty unmapping with
xenforeignmemory_unmap and then mapping the required anonymous memory
in the same hole. I don't think this is a problem since any other
thread which was racily touching this region would already be running
the risk of hitting the mapping halfway through the call. If this is
thought to be a problem then we could consider adding an extra API to
the libxenforeignmemory interface to replace a foreign mapping with
anonymous shared memory, but I'd prefer not to.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:40 +0000 (13:23 +0000)]
xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_{pages,bulk}.
In preparation for this switch all uses of xc_map_foreign_range to
xc_map_foreign_pages. This is trivial because size was always
XC_PAGE_SIZE so the necessary adjustments are trivial:
* Pass &mfn (an array of length 1) instead of mfn. The function
takes a pointer to const, so there is no possibily of mfn changing
due to this change.
* Pass nr_pages=1 instead of size=XC_PAGE_SIZE
There is one wrinkle in xen_console.c:con_initialise() where
con->ring_ref is an int but can in some code paths (when !xendev->dev)
be treated as an mfn. I think this is an existing latent truncation
hazard on platforms where xen_pfn_t is 64-bit and int is 32-bit (e.g.
amd64, both arm* variants). I'm unsure under what circumstances
xendev->dev can be NULL or if anything elsewhere ensures the value
fits into an int. For now I just use a temporary xen_pfn_t to in
effect upcast the pointer from int* to xen_pfn_t*.
In xenfb.c:common_bind we now explicitly launder the mfn into a
xen_pfn_t, so it has the correct type to be passed to
xc_map_foreign_pages and doesn't provoke warnings on 32-bit x86.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:39 +0000 (13:23 +0000)]
xen: Switch to libxengnttab interface for compat shims.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
One such library will be libxengnttab which provides access to grant
tables.
In preparation for this switch the compatibility layer in xen_common.h
(which support building with older versions of Xen) to use what will
be the new library API. This means that the gnttab shim will disappear
for versions of Xen which include libxengnttab.
To simplify things for the <= 4.0.0 support we wrap the int fd in a
malloc(sizeof int) such that the handle is always a pointer. This
leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUE etc for these interfaces.
Note that this patch does not add any support for actually using
libxengnttab, it just adjusts the existing shims.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:38 +0000 (13:23 +0000)]
xen: Switch to libxenevtchn interface for compat shims.
In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.
One such library will be libxenevtchn which provides access to event
channels.
In preparation for this switch the compatibility layer in xen_common.h
(which support building with older versions of Xen) to use what will
be the new library API. This means that the evtchn shim will disappear
for versions of Xen which include libxenevtchn.
To simplify things for the <= 4.0.0 support we wrap the int fd in a
malloc(sizeof int) such that the handle is always a pointer. This
leads to less typedef headaches and the need for
XC_HANDLER_INITIAL_VALUE etc for these interfaces.
Note that this patch does not add any support for actually using
libxenevtchn, it just adjusts the existing shims.
Note that xc_evtchn_alloc_unbound functionality remains in libxenctrl,
since that functionality is not exposed by /dev/xen/evtchn.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Ian Campbell [Fri, 15 Jan 2016 13:23:37 +0000 (13:23 +0000)]
xen_console: correctly cleanup primary console on teardown.
All of the work in con_disconnect applies to the primary console case
(when xendev->dev is NULL). Therefore remove the early check and bail
and allow it to fall through. All of the existing code is correctly
conditional already.
The ->dev and ->gnttabdev handles are either both set or neither. For
consistency with con_initialise() with to the former here too.
With this con_initialise and con_disconnect now mirror each other.
Fix up a hard tab in the function while editing.
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Peter Maydell [Tue, 26 Jan 2016 15:09:13 +0000 (15:09 +0000)]
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* chardev support for TLS and leak fix
* NBD fix from Denis
* condvar fix from Dave
* kvm_stat and dump-guest-memory almost rewrite
* mem-prealloc fix from Luiz
* manpage style improvement
# gpg: Signature made Tue 26 Jan 2016 14:58:18 GMT using RSA key ID
78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
* remotes/bonzini/tags/for-upstream: (49 commits)
scripts/dump-guest-memory.py: Fix module docstring
scripts/dump-guest-memory.py: Introduce multi-arch support
scripts/dump-guest-memory.py: Cleanup functions
scripts/dump-guest-memory.py: Improve python 3 compatibility
scripts/dump-guest-memory.py: Make methods functions
scripts/dump-guest-memory.py: Move constants to the top
nbd: add missed aio_context_acquire in nbd_export_new
memory: exit when hugepage allocation fails if mem-prealloc
cpus: use broadcast on qemu_pause_cond
scripts/kvm/kvm_stat: Add optparse description
scripts/kvm/kvm_stat: Add interactive filtering
scripts/kvm/kvm_stat: Fixup filtering
scripts/kvm/kvm_stat: Fix rlimit for unprivileged users
scripts/kvm/kvm_stat: Read event values as u64
scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr
scripts/kvm/kvm_stat: Fix output formatting
scripts/kvm/kvm_stat: Make tui function a class
scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS
scripts/kvm/kvm_stat: Group arch specific data
scripts/kvm/kvm_stat: Cleanup of Event class
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Janosch Frank [Fri, 22 Jan 2016 12:08:40 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Fix module docstring
The module docstring is changed into a multi-line comment to comply
with pep 257.
The comment about the docstring that gets used by gdb to print the
help is moved to the location of the docstring.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-7-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Fri, 22 Jan 2016 12:08:39 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Introduce multi-arch support
By modelling the ELF with ctypes we not only gain full python 3
support but can also create dumps for different architectures more easily.
Tested-by: Andrew Jones <drjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-6-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Fri, 22 Jan 2016 12:08:38 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Cleanup functions
Increase readability by adding newlines and comments, as well as
removing wrong whitespaces and C style braces around conditionals and
loops.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-5-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Fri, 22 Jan 2016 12:08:37 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Improve python 3 compatibility
This commit does not make the script python 3 compatible, it is a
preparation that fixes the easy and common incompatibilities.
Print is a function in python 3 and therefore needs braces around its
arguments.
Range does not cast a gdb.Value object to int in python 3, we have to
do it ourselves.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-4-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Fri, 22 Jan 2016 12:08:36 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Make methods functions
The functions dealing with qemu components rarely used parts of the
class, so they were moved out of the class.
As the uintptr_t variable is needed both within and outside the class,
it was made a constant and moved to the top.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-3-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Fri, 22 Jan 2016 12:08:35 +0000 (13:08 +0100)]
scripts/dump-guest-memory.py: Move constants to the top
The constants bloated the class definition and were therefore moved to
the top.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1453464520-3882-2-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Denis V. Lunev [Wed, 20 Jan 2016 07:12:20 +0000 (10:12 +0300)]
nbd: add missed aio_context_acquire in nbd_export_new
blk_invalidate_cache() can call qcow2_invalidate_cache which performs
IO inside.
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <
1453273940-15382-3-git-send-email-den@openvz.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Luiz Capitulino [Fri, 22 Jan 2016 14:15:01 +0000 (09:15 -0500)]
memory: exit when hugepage allocation fails if mem-prealloc
When -mem-prealloc is passed on the command-line, the expected
behavior is to exit if the hugepage allocation fails. However,
this behavior is broken since commit
cc57501dee which made
hugepage allocation fall back to regular ram in case of faliure.
This commit restores the expected behavior for -mem-prealloc.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-Id: <
20160122091501.
75bbd42a@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Dr. David Alan Gilbert [Mon, 25 Jan 2016 10:08:18 +0000 (10:08 +0000)]
cpus: use broadcast on qemu_pause_cond
Jiri saw a hang on pause_all_vcpus called from postcopy_start,
where the cpus are all apparently stopped ('stopped' flag set)
but pause_all_vcpus is still stuck on a cond_wait on qemu_paused_cond.
We suspect this is happening if a qmp_stop is called at about the
same time as the postcopy code calls that pause_all_vcpus;
although they both should have the main lock held, Paolo spotted
the cond_wait unlocks the global lock so perhaps they both
could end up waiting at the same time?
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reported-by: Jiri Denemark <jdenemar@redhat.com>
Message-Id: <
1453716498-27238-1-git-send-email-dgilbert@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:18:04 +0000 (16:18 +0100)]
scripts/kvm/kvm_stat: Add optparse description
Added a description text that explains what the script does and which
requirements have to be met to let it run.
The help formatter class is needed as the default optparse formatter
makes the text unreadable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-35-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:18:03 +0000 (16:18 +0100)]
scripts/kvm/kvm_stat: Add interactive filtering
Interactively changing the filter is much more useful than the
drilldown, because it is more versatile.
With this patch, the filter can be changed by pressing 'f' in the text
ui and entering a new filter regex.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-34-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:18:02 +0000 (16:18 +0100)]
scripts/kvm/kvm_stat: Fixup filtering
When filtering, the group leader event should not be disabled, as all
other events under it will also be disabled. Also we should make sure
that values from disabled fields will not be displayed.
This also filters the fields from the log and batch output for better
readability.
Also the drilldown update now directly checks for the stats' field
filter and (un)sets drilldown accordingly.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-33-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:18:01 +0000 (16:18 +0100)]
scripts/kvm/kvm_stat: Fix rlimit for unprivileged users
Setting the hard limit as a unprivileged user either returns an error
when it is higher than the current one or irreversibly sets it lower.
Therefore we leave the hardlimit untouched as long as we don't need to
raise it as this needs CAP_SYS_RESOURCE.
This gives admins the possibility to run the script as an unprivileged
user to increase security.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-32-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:18:00 +0000 (16:18 +0100)]
scripts/kvm/kvm_stat: Read event values as u64
The struct read_format, which denotes the returned values on a read
states that the values are u64 and not long long which is used for
struct unpacking.
Therefore the 'q' long long formatter was exchanged with 'Q' which is
the format for u64 data.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-31-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:59 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr
All initializations of the ctypes struct that don't need additional
information were moved to its init method. The unneeded
initializations for sample_type and sample_period were removed as they
do not affect the counters that are read.
This improves readability of the setup_event_attribute by halfing its
LOC.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-30-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:58 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Fix output formatting
The key names in log mode were capped to 10 characters which is not
enough for distinguishing between keys. Capping was therefore removed.
In batch mode the spacing between keys and values was too narrow and
therefore had to be extended to 42.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-29-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:57 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Make tui function a class
The tui function itself had a few sub-functions and therefore
basically already was class-like. Making it an actual one with proper
methods improved readability.
The curses wrapper was dropped in favour of __entry/exit__ methods
that implement the same behaviour.
Also renamed single character variable name, so the name reflects the
content.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-28-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:56 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS
The architecture detection method directly accesses vmx and smv exit
reason constants. Therefore we don't need it anymore.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-27-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:55 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Group arch specific data
Using global variables and multiple initialization functions for arch
specific data makes the code hard to read. By grouping them in the
Arch classes we encapsulate and initialize them in one place.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-26-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:54 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of Event class
Added additional newlines for readability.
Factored out attribute and event setup code into own methods.
Exchanged file() with preferred open().
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-25-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:53 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of Groups class
Introduced separating newlines for readability and removed special
treatment/variable of the group leader. Renamed fmt to read_format.
The group leader's file descriptor will not be turned into a file
object anymore, instead os.read is used to read from the descriptor.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-24-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:52 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of Stats class
Converted class definition to new style and renamed improper named
variables.
Introduced property for fields_filter.
Moved member variable declaration to init, so one can see all class
variables when reading the init method.
Completely clear the values dict, as we don't need to keep single values.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-23-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:51 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Encapsulate filters variable
The variable was only used in one class but still was defined
globally. Additionaly the detect_platform routine which prepares the
data that goes into the variable was called on each start of the
script, no matter if the class was needed.
To make the variable local to the TracepointProvider class, a new
function that calls detect_platform and returns the filters was
introduced.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-22-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:50 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup cpu list retrieval
Reading /sys/devices/system/cpu/online makes opening the cpu
directories unnecessary and works on more/older systems.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-21-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:49 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of TracepointProvider
Variables with bad names like f and m were renamed to their full name,
so it is clearer which data they contain.
Unneeded variables were removed and the field generating code was
moved in an own function.
dict.iteritems() was removed as directly iterating over a dictionary
also yields the needed keys.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-20-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:48 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Introduce properties for providers
As previous commit authors used a mixture of setters/getters and
direct access to class variables consolidating them the python way
improved readability.
Properties allow us to assign a value to a class variable through a
setter without the need to call the setter ourselves.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-19-git-send-email-frankja@linux.vnet.ibm.com>
[prop.setter is new in Python 2.6, which is the earliest supported
version. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:47 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Rename _perf_event_open
The underscore in front of the function name does not comply with the
python coding guidelines.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-18-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:46 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Make cpu detection a function
The online cpus detection method is in the Stats class but does not
use any class variables.
Moving it out of the class to the platform detection function makes
the Stats class more readable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-17-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:45 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of platform detection
s390 machines can also be detected via uname -m, i.e. python's
os.uname, no need for more complicated checks.
Calling uname once and saving its value for multiple checks is
perfectly sufficient. We don't expect the machine's architecture to
change when the script is running anyway.
On multi-cpu systems x86_init currently will get called multiple
times, returning makes sure we don't waste cicles on that.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-16-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:44 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Set sensible no. files rlimit
As num cpus * 1000 is NOT a sensible rlimit, we need to calculate a
more accurate rlimit.
The number of open files is directly dependent on the cpu count and on
the number of trace points per cpu. A additional constant works as a
buffer for files that are needed by python or do get opened when the
script runs.
Hence we have:
cpus * traces + constant
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-15-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:43 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Fixup syscall error reporting
In 2008 a patch was written that introduced ctypes.get_errno() and
set_errno() as official interfaces to the libc errno variable. Using
them we can avoid accessing private libc variables.
The patch was included in python 2.6.
Also we need to raise the right exception, with the right parameters
and a helpful message.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-14-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:42 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Moved DebugfsProvider
When it is next to the TracepointProvider less scrolling is needed to
change related, surrounding code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-13-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:41 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Rename variables that redefine globals
Filter, id and byte are builtin python modules which should not be
redefined by local variables.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-12-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:40 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Fix spaces around keyword assignments
Keyword assignments should not not have spaces around the equal
character according to PEP8.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-11-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:39 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Introduce main function
The main function should be the main location for initialization and
helps encapsulating variables into a scope. This way they don't have
to be global and might be mistaken for local ones.
As the providers variable is scoped now it can't be accessed from
within the Stats class. Hence, the global access to the variable was
changed to a local one.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-10-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:38 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Improve debugfs access checking
Access checking with F_OK was replaced with the better readable
os.path.exists().
On Linux exists() returns False when the user doesn't have sufficient
permissions for statting the directory. Therefore the error message
now states that sufficient rights are needed when the check fails.
Also added check for /sys/kernel/debug/tracing/.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-9-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:37 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of path variables
Paths to debugfs and trace dirs are now specified globally to remove
redundancies in the code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-8-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:36 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Invert dictionaries
The exit reasons dictionaries were defined number -> value but later
on were accessed the other way around. Therefore a invert function
inverted them.
Defining them the right way removes the need to invert them and
therefore also speeds up the script's setup process.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-7-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:35 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Mark globals in functions
Updating globals over the globals().update() method is not the
standard way of changing globals. Marking variables as global and
modifying them the standard way is better readable.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-6-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:34 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Removed unneeded PERF constants
Only two of the constants are actually needed to set up the events, so
the others were removed. All variables that used them were also removed.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-5-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:33 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Make constants uppercase
Constants should be uppercase with separating underscores, as
requested in PEP8. This helps identifying them when reading the code.
Reviewed-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-4-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:32 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Replaced os.listdir with os.walk
Os.walk gives back lists of directories and files, no need to filter
directories from the list that listdir gives back.
To make it better understandable a wrapper with docstring was
introduced.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-3-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Janosch Frank [Mon, 11 Jan 2016 15:17:31 +0000 (16:17 +0100)]
scripts/kvm/kvm_stat: Cleanup of multiple imports
Removed multiple imports of the same module and moved all imports to
the top.
It is not necessary to import a module each time one of its
functions/classes is used.
For readability each import should get its own line.
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Message-Id: <
1452525484-32309-2-git-send-email-frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo Bonzini [Mon, 18 Jan 2016 10:25:45 +0000 (11:25 +0100)]
qemu-char: avoid leak in qemu_chr_open_pp_fd
drv leaks if qemu_chr_alloc returns an error.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Sitsofe Wheeler [Wed, 13 Jan 2016 20:50:26 +0000 (20:50 +0000)]
docs: Style the command and its options in the synopsis
Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Message-Id: <
1452718226-25001-1-git-send-email-sitsofe@yahoo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrange [Tue, 19 Jan 2016 11:14:31 +0000 (11:14 +0000)]
char: introduce support for TLS encrypted TCP chardev backend
This integrates support for QIOChannelTLS object in the TCP
chardev backend. If the 'tls-creds=NAME' option is passed with
the '-chardev tcp' argument, then it will setup the chardev
such that the client is required to establish a TLS handshake
when connecting. There is no support for checking the client
certificate against ACLs in this initial patch. This is pending
work to QOM-ify the ACL object code.
A complete invocation to run QEMU as the server for a TLS
encrypted serial dev might be
$ qemu-system-x86_64 \
-nodefconfig -nodefaults -device sga -display none \
-chardev socket,id=s0,host=127.0.0.1,port=9000,tls-creds=tls0,server \
-device isa-serial,chardev=s0 \
-object tls-creds-x509,id=tls0,endpoint=server,verify-peer=off,\
dir=/home/berrange/security/qemutls
To test with the gnutls-cli tool as the client:
$ gnutls-cli --priority=NORMAL -p 9000 \
--x509cafile=/home/berrange/security/qemutls/ca-cert.pem \
127.0.0.1
If QEMU was told to use 'anon' credential type, then use the
priority string 'NORMAL:+ANON-DH' with gnutls-cli
Alternatively, if setting up a chardev to operate as a client,
then the TLS credentials registered must be for the client
endpoint. First a TLS server must be setup, which can be done
with the gnutls-serv tool
$ gnutls-serv --priority=NORMAL -p 9000 --echo \
--x509cafile=/home/berrange/security/qemutls/ca-cert.pem \
--x509certfile=/home/berrange/security/qemutls/server-cert.pem \
--x509keyfile=/home/berrange/security/qemutls/server-key.pem
Then QEMU can connect with
$ qemu-system-x86_64 \
-nodefconfig -nodefaults -device sga -display none \
-chardev socket,id=s0,host=127.0.0.1,port=9000,tls-creds=tls0 \
-device isa-serial,chardev=s0 \
-object tls-creds-x509,id=tls0,endpoint=client,\
dir=/home/berrange/security/qemutls
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <
1453202071-10289-5-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrange [Tue, 19 Jan 2016 11:14:30 +0000 (11:14 +0000)]
char: don't assume telnet initialization will not block
The current code for doing telnet initialization is writing to
a socket without checking the return status. While it is highly
unlikely to be a problem when writing to a bare socket, as the
buffers are large enough to prevent blocking, this cannot be
assumed safe with TLS sockets. So write the telnet initialization
code into a memory buffer and then use an I/O watch to fully
send the data.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <
1453202071-10289-4-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrange [Tue, 19 Jan 2016 11:14:29 +0000 (11:14 +0000)]
char: convert from GIOChannel to QIOChannel
In preparation for introducing TLS support to the TCP chardev
backend, convert existing chardev code from using GIOChannel
to QIOChannel. This simplifies the chardev code by removing
most of the OS platform conditional code for dealing with
file descriptor passing.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <
1453202071-10289-3-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Daniel P. Berrange [Tue, 19 Jan 2016 11:14:28 +0000 (11:14 +0000)]
char: remove fixed length filename allocation
A variety of places were snprintf()ing into a fixed length
filename buffer. Some of the buffers were stack allocated,
while another was heap allocated with g_malloc(). Switch
them all to heap allocated using g_strdup_printf() avoiding
arbitrary length restrictions.
This also facilitates later patches which will want to
populate the filename by calling external functions
which do not support use of a pre-allocated buffer.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <
1453202071-10289-2-git-send-email-berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Peter Maydell [Tue, 26 Jan 2016 09:16:07 +0000 (09:16 +0000)]
Merge remote-tracking branch 'remotes/jnsnow/tags/ide-pull-request' into staging
# gpg: Signature made Mon 25 Jan 2016 19:39:58 GMT using RSA key ID
AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>"
* remotes/jnsnow/tags/ide-pull-request:
fdc: change auto fallback drive for ISA FDC to 288
qtest/fdc: Support for 2.88MB drives
fdc: rework pick_geometry
fdc: add physical disk sizes
fdc: add drive type option
fdc: Add fallback option
fdc: add pick_drive
fdc: Throw an assertion on misconfigured fd_formats table
fdc: add disk field
fdc: add drive type qapi enum
fdc: reduce number of pick_geometry arguments
fdc: move pick_geometry
ide: Correct the CHS 'cyls_max' limit to be 65535
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
John Snow [Fri, 22 Jan 2016 20:51:05 +0000 (15:51 -0500)]
fdc: change auto fallback drive for ISA FDC to 288
The 2.88 drive is more suitable as a default because
it can still read 1.44 images correctly, but the reverse
is not true.
Since there exist virtio-win drivers that are shipped on
2.88 floppy images, this patch will allow VMs booted without
a floppy disk inserted to later insert a 2.88MB floppy and
have that work.
This patch has been tested with msdos, freedos, fedora,
windows 8 and windows 10 without issue: if problems do
arise for certain guests being unable to cope with 2.88MB
drives as the default, they are in the minority and can use
type=144 as needed (or insert a proper boot medium and omit
type=144/288 or use type=auto) to obtain different drive types.
As icing, the default will remain auto/144 for any pre-2.6
machine types, hopefully minimizing the impact of this change
in legacy hw to basically zero.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-13-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:51:04 +0000 (15:51 -0500)]
qtest/fdc: Support for 2.88MB drives
The old test assumes a 1.44MB drive.
Assert that the QEMU default drive is now either 1.44 or 2.88.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-12-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:51:03 +0000 (15:51 -0500)]
fdc: rework pick_geometry
This one is the crazy one.
fd_revalidate currently uses pick_geometry to tell if the diskette
geometry has changed upon an eject/insert event, but it won't allow us
to insert a 1.44MB diskette into a 2.88MB drive. This is inflexible.
The new algorithm applies a new heuristic to guessing disk geometries
that allows us to switch diskette types as long as the physical size
matches before falling back to the old heuristic.
The old one is roughly:
- If the size (sectors) and type matches, choose it.
- Fall back to the first geometry that matched our type.
The new one is:
- If the size (sectors) and type matches, choose it.
- If the size (sectors) and physical size match, choose it.
- Fall back to the first geometry that matched our type.
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id:
1453495865-9649-11-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:51:02 +0000 (15:51 -0500)]
fdc: add physical disk sizes
2.88MB capable drives can accept 1.44MB floppies,
for instance. To rework the pick_geometry function,
we need to know if our current drive can even accept
the type of disks we're considering.
NB: This allows us to distinguish between all of the
"total sectors" collisions between 1.20MB and 1.44MB
diskette types, by using the physical drive size as a
differentiator.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-10-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:51:01 +0000 (15:51 -0500)]
fdc: add drive type option
This patch adds a new explicit Floppy Drive Type option. The existing
behavior in QEMU is to automatically guess a drive type based on the
media inserted, or if a diskette is not present, arbitrarily assign one.
This behavior can be described as "auto." This patch adds the option
to pick an explicit behavior: 120, 144, 288 or none. The new "auto"
option is intended to mimic current behavior, while the other types
pick one explicitly.
Set the type given by the CLI during fd_init. If the type remains the
default (auto), we'll attempt to scan an inserted diskette if present
to determine a type. If auto is selected but no diskette is present,
we fall back to a predetermined default (currently 1.44MB to match
legacy QEMU behavior.)
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-9-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:51:00 +0000 (15:51 -0500)]
fdc: Add fallback option
Currently, QEMU chooses a drive type automatically based on the inserted
media. If there is no disk inserted, it chooses a 1.44MB drive type.
Change this behavior to be configurable, but leave it defaulted to 1.44.
This is not earnestly intended to be used by a user or a management
library, but rather exists so that pre-2.6 board types can configure it
to be a legacy value.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-8-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:59 +0000 (15:50 -0500)]
fdc: add pick_drive
Split apart pick_geometry by creating a pick_drive routine that will only
ever called during device bring-up instead of relying on pick_geometry to
be used in both cases.
With this change, the drive field is changed to be 'write once'. It is
not altered after the initialization routines exit.
media_validated does not need to be migrated. The target VM
will just revalidate the media on post_load anyway.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-7-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:58 +0000 (15:50 -0500)]
fdc: Throw an assertion on misconfigured fd_formats table
pick_geometry is a convoluted function that makes it difficult to tell
at a glance what QEMU's current behavior for choosing a floppy drive
type is when it can't quite identify the diskette.
The code iterates over all entries in the candidate geometry table
("fd_formats") and if our specific drive type matches a row in the table,
then either "match" is set to that entry (an exact match) and the loop
exits, or "first_match" will be non-negative (the first such entry that
shares the same drive type), and the loop continues. If our specific
drive type is NONE, then all drive types in the candidate geometry table
are considered. After iteration, if "match" was not set, we fall back to
"first match".
This means that either "match" was set, or we exited the loop without an
exact match, in which case:
- If drive type is NONE, the default is truly fd_formats[0], a 1.44MB
type, because "first_match" will always get set to the first item.
- If drive type is not NONE, pick_geometry's iteration was fussier and
only looked at rows that matched our drive type. However, since all
possible drive types are represented in the table, we still know that
"first match" was set.
- If drive type is not NONE and the fd_formats table lists no options for
our drive type, we choose fd_formats[1], an incomprehensibly bizarre
choice that can never happen anyway.
Correct this: If first_match is -1, it can ONLY mean we didn't edit our
fd_formats table correctly. Throw an assertion instead.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-6-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:57 +0000 (15:50 -0500)]
fdc: add disk field
Currently, 'drive' is used both to represent the current diskette
type as well as the current drive type.
This patch adds a 'disk' field that is updated explicitly to match
the type of the disk.
As of this patch, disk and drive are always the same, but forthcoming
patches to change the behavior of pick_geometry will invalidate this
assumption.
disk does not need to be migrated because it is not user-visible state
nor is it currently used for any calculations. It is purely informative,
and will be rebuilt automatically via fd_revalidate on the new host.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-5-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:56 +0000 (15:50 -0500)]
fdc: add drive type qapi enum
Change the floppy drive type to a QAPI enum type, to allow us to
specify the floppy drive type from the CLI in a forthcoming patch.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-4-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:55 +0000 (15:50 -0500)]
fdc: reduce number of pick_geometry arguments
Modify this function to operate directly on FDrive objects instead of
unpacking and passing all of those parameters manually. Reduces the
complexity in the caller and reduces the number of args to just one.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-3-git-send-email-jsnow@redhat.com
John Snow [Fri, 22 Jan 2016 20:50:54 +0000 (15:50 -0500)]
fdc: move pick_geometry
Code motion: I want to refactor this function to work with FDrive
directly, so shuffle it below that definition.
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id:
1453495865-9649-2-git-send-email-jsnow@redhat.com
Shmulik Ladkani [Mon, 25 Jan 2016 19:34:40 +0000 (14:34 -0500)]
ide: Correct the CHS 'cyls_max' limit to be 65535
In b7eb0c9:
hw/block-common: Factor out fall back to legacy -drive cyls=...
'blkconf_geometry()' was introduced, factoring out CHS limit validation
code that was repeated in ide, scsi, virtio-blk.
The original IDE CHS limit prior b7eb0c9 was 65535,16,255 (as per ATA
CHS addressing).
However the 'cyls_max' argument passed to 'blkconf_geometry' in the
ide_dev_initfn case was accidentally set to 65536 instead of 65535.
Fix, providing the correct 'cyls_max'.
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id:
1453112371-29760-1-git-send-email-shmulik.ladkani@ravellosystems.com
Signed-off-by: John Snow <jsnow@redhat.com>
Peter Maydell [Mon, 25 Jan 2016 10:42:51 +0000 (10:42 +0000)]
Merge remote-tracking branch 'remotes/lalrae/tags/mips-
20160125' into staging
MIPS patches 2016-01-25
Changes:
* fixes and includes clean-up
# gpg: Signature made Mon 25 Jan 2016 09:29:51 GMT using RSA key ID
0B29DA6B
# gpg: Good signature from "Leon Alrae <leon.alrae@imgtec.com>"
* remotes/lalrae/tags/mips-
20160125:
mips: Clean up includes
target-mips: Fix ALIGN instruction when bp=0
target-mips: silence NaNs for cvt.s.d and cvt.d.s
target-mips/cpu.h: Fix spell error
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Peter Maydell [Mon, 18 Jan 2016 17:35:00 +0000 (17:35 +0000)]
mips: Clean up includes
Clean up includes so that osdep.h is included first and headers
which it implies are not included manually.
This commit was created with scripts/clean-includes.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Miodrag Dinic [Thu, 3 Dec 2015 15:48:57 +0000 (16:48 +0100)]
target-mips: Fix ALIGN instruction when bp=0
If executing ALIGN with shift count bp=0 within mips64 emulation,
the result of the operation should be sign extended.
Taken from the official documentation (pseudo code) :
ALIGN:
tmp_rt_hi = unsigned_word(GPR[rt]) << (8*bp)
tmp_rs_lo = unsigned_word(GPR[rs]) >> (8*(4-bp))
tmp = tmp_rt_hi || tmp_rt_lo
GPR[rd] = sign_extend.32(tmp)
Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Aurelien Jarno [Sun, 6 Dec 2015 16:11:49 +0000 (17:11 +0100)]
target-mips: silence NaNs for cvt.s.d and cvt.d.s
cvt.s.d and cvt.d.s are FP operations and thus need to convert input
sNaN into corresponding qNaN. Explicitely use the floatXX_maybe_silence_nan
functions for that as the floatXX_to_floatXX functions do not do that.
Cc: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Dongxue Zhang [Wed, 25 Nov 2015 12:57:12 +0000 (20:57 +0800)]
target-mips/cpu.h: Fix spell error
CP0IntCtl_IPPC1, the last letter should be 'i', not 'one'.
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Reviewed-by: Leon Alrae <leon.alrae@imgtec.com>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
Peter Maydell [Fri, 22 Jan 2016 15:19:20 +0000 (15:19 +0000)]
Merge remote-tracking branch 'remotes/pmaydell/tags/pull-softfloat-
20160122' into staging
softfloat:
* drop confusing softfloat-only types
* fix return type of roundAndPackFloat16
# gpg: Signature made Fri 22 Jan 2016 15:15:17 GMT using RSA key ID
14360CDE
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org>"
# gpg: aka "Peter Maydell <pmaydell@gmail.com>"
# gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk>"
* remotes/pmaydell/tags/pull-softfloat-
20160122:
softfloat: fix return type of roundAndPackFloat16
fpu: Replace uint8 typedef with uint8_t
fpu: Replace int8 typedef with int8_t
fpu: Replace uint32 typedef with uint32_t
fpu: Replace int32 typedef with int32_t
fpu: Replace uint64 typedef with uint64_t
fpu: Replace int64 typedef with int64_t
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Aurelien Jarno [Fri, 22 Jan 2016 15:09:21 +0000 (15:09 +0000)]
softfloat: fix return type of roundAndPackFloat16
The roundAndPackFloat16 function should return a float16 value, not a
float32 one. Fix that.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id:
1452700993-6570-1-git-send-email-aurelien@aurel32.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Peter Maydell [Fri, 22 Jan 2016 15:09:21 +0000 (15:09 +0000)]
fpu: Replace uint8 typedef with uint8_t
Replace the uint8 softfloat-specific typedef with uint8_t.
This change was made with
find include hw fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\buint8\b/uint8_t/g'
together with manual removal of the typedef definition and
manual fixing of more erroneous uses found via test compilation.
It turns out that the only code using this type is an accidental
use where uint8_t was intended anyway...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Leon Alrae <leon.alrae@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Message-id:
1452603315-27030-7-git-send-email-peter.maydell@linaro.org
Peter Maydell [Fri, 22 Jan 2016 15:09:21 +0000 (15:09 +0000)]
fpu: Replace int8 typedef with int8_t
Replace the int8 softfloat-specific typedef with int8_t.
This change was made with
find include hw fpu target-* -name '*.[ch]' | xargs sed -i -e 's/\bint8\b/int8_t/g'
together with manual removal of the typedef definition, and
manual undoing of various mis-hits.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Leon Alrae <leon.alrae@imgtec.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Message-id:
1452603315-27030-6-git-send-email-peter.maydell@linaro.org