summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-01-26scripts/kvm/kvm_stat: Cleanup of platform detectionJanosch Frank1-16/+13
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>
2016-01-26scripts/kvm/kvm_stat: Set sensible no. files rlimitJanosch Frank1-2/+9
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>
2016-01-26scripts/kvm/kvm_stat: Fixup syscall error reportingJanosch Frank1-5/+4
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>
2016-01-26scripts/kvm/kvm_stat: Moved DebugfsProviderJanosch Frank1-12/+12
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>
2016-01-26scripts/kvm/kvm_stat: Rename variables that redefine globalsJanosch Frank1-11/+12
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>
2016-01-26scripts/kvm/kvm_stat: Fix spaces around keyword assignmentsJanosch Frank1-31/+31
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>
2016-01-26scripts/kvm/kvm_stat: Introduce main functionJanosch Frank1-71/+82
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>
2016-01-26scripts/kvm/kvm_stat: Improve debugfs access checkingJanosch Frank1-5/+11
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>
2016-01-26scripts/kvm/kvm_stat: Cleanup of path variablesJanosch Frank1-7/+7
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>
2016-01-26scripts/kvm/kvm_stat: Invert dictionariesJanosch Frank1-176/+173
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>
2016-01-26scripts/kvm/kvm_stat: Mark globals in functionsJanosch Frank1-19/+22
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>
2016-01-26scripts/kvm/kvm_stat: Removed unneeded PERF constantsJanosch Frank1-26/+2
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>
2016-01-26scripts/kvm/kvm_stat: Make constants uppercaseJanosch Frank1-32/+32
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>
2016-01-26scripts/kvm/kvm_stat: Replaced os.listdir with os.walkJanosch Frank1-4/+11
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>
2016-01-26scripts/kvm/kvm_stat: Cleanup of multiple importsJanosch Frank1-15/+11
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>
2016-01-26qemu-char: avoid leak in qemu_chr_open_pp_fdPaolo Bonzini1-5/+6
drv leaks if qemu_chr_alloc returns an error. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-26docs: Style the command and its options in the synopsisSitsofe Wheeler4-7/+7
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>
2016-01-26char: introduce support for TLS encrypted TCP chardev backendDaniel P. Berrange3-13/+134
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>
2016-01-26char: don't assume telnet initialization will not blockDaniel P. Berrange1-18/+69
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>
2016-01-26char: convert from GIOChannel to QIOChannelDaniel P. Berrange2-396/+254
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>
2016-01-26char: remove fixed length filename allocationDaniel P. Berrange1-43/+45
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>
2016-01-18Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-peter' ↵Peter Maydell9-83/+324
into staging QOM infrastructure fixes and device conversions * Dynamic class properties * Property iterator cleanup * Device hot-unplug ID race fix # gpg: Signature made Mon 18 Jan 2016 17:27:01 GMT using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-peter: MAINTAINERS: Fix sPAPR entry heading qdev: Free QemuOpts when the QOM path goes away qom: Change object property iterator API contract qom: Allow properties to be registered against classes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-18MAINTAINERS: Fix sPAPR entry headingAndreas Färber1-1/+1
get_maintainers.pl does not handle parenthesis in maintenance areas well in connection with list emails (here: qemu-ppc@nongnu.org). Resolve a recurring CC issue breaking git-send-email by reverting part of commit 085eb217dfb3ee12e7985c11f71f8a038394735a ("Add David Gibson for sPAPR in MAINTAINERS file"). Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Andreas Färber <afaerber@suse.de>
2016-01-18qdev: Free QemuOpts when the QOM path goes awayPaolo Bonzini1-1/+3
Otherwise there is a race where the DEVICE_DELETED event has been sent but attempts to reuse the ID will fail. Note that similar races exist for other QemuOpts, which this patch does not attempt to fix. For example, if the device is a block device, then unplugging it also deletes its backend. However, this backend's get deleted in drive_info_del(), which is only called when properties are destroyed. Just like device_finalize(), drive_info_del() is called some time after DEVICE_DELETED is sent. A separate patch series has been sent to plug this other bug. Character devices also have yet to be fixed. Reported-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2016-01-18qom: Change object property iterator API contractDaniel P. Berrange7-58/+36
Currently the ObjectProperty iterator API works as follows: ObjectPropertyIterator *iter; iter = object_property_iter_init(obj); while ((prop = object_property_iter_next(iter))) { ... } object_property_iter_free(iter); This has the benefit that the ObjectPropertyIterator struct can be opaque, but has the downside that callers need to explicitly call a free function. It is also not in keeping with iterator style used elsewhere in QEMU/GLib2. This patch changes the API to use stack allocation instead: ObjectPropertyIterator iter; object_property_iter_init(&iter, obj); while ((prop = object_property_iter_next(&iter))) { ... } Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [AF: Fused ObjectPropertyIterator struct with typedef] Signed-off-by: Andreas Färber <afaerber@suse.de>
2016-01-18qom: Allow properties to be registered against classesDaniel P. Berrange3-26/+287
When there are many instances of a given class, registering properties against the instance is wasteful of resources. The majority of objects have a statically defined list of possible properties, so most of the properties are easily registerable against the class. Only those properties which are conditionally registered at runtime need be recorded against the klass. Registering properties against classes also makes it possible to provide static introspection of QOM - currently introspection is only possible after creating an instance of a class, which severely limits its usefulness. This impl only supports simple scalar properties. It does not attempt to allow child object / link object properties against the class. There are ways to support those too, but it would make this patch more complicated, so it is left as an exercise for the future. There is no equivalent to object_property_del() provided, since classes must be immutable once they are defined. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2016-01-18hw/arm: Clean up includesPeter Maydell42-1/+42
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: 1449505425-32022-4-git-send-email-peter.maydell@linaro.org
2016-01-18target-arm: Clean up includesPeter Maydell19-31/+19
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: Daniel P. Berrange <berrange@redhat.com> Message-id: 1449505425-32022-3-git-send-email-peter.maydell@linaro.org
2016-01-18scripts: Add new clean-includes script to fix C include directivesPeter Maydell1-0/+109
Add a new scripts/clean-includes, which can be used to automatically ensure that a C source file includes qemu/osdep.h first and doesn't then include any headers which osdep.h provides already. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1449505425-32022-2-git-send-email-peter.maydell@linaro.org
2016-01-18Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160118-1' into ↵Peter Maydell4-4/+49
staging ui: misc small gtk/spice/vnc patches. # gpg: Signature made Mon 18 Jan 2016 15:52:13 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-ui-20160118-1: vnc: fix tls-creds error message Fix corner-case when using VNC+SASL+SPICE vnc: clear vs->tlscreds after unparenting it gtk: implement set_echo Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-18vnc: fix tls-creds error messageWolfgang Bumiller1-1/+1
The parameter is called 'tls-creds', 'credid' is just the variable name in the code. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Message-id: 1452681360-29239-1-git-send-email-w.bumiller@proxmox.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-18Fix corner-case when using VNC+SASL+SPICEChristophe Fergeau1-2/+2
Similarly to the commit 764eb39d1b6 fixing VNC+SASL+QXL, when starting QEMU with SPICE but no SASL, and at the same time VNC with SASL, then spice_server_init() will get called without a previous call to spice_server_set_sasl_appname(), which will cause cyrus-sasl to try to use /etc/sasl2/spice.conf (spice-server uses "spice" as its default appname) rather than the expected /etc/sasl2/qemu.conf. This commit unconditionally calls spice_server_set_sasl_appname() before calling spice_server_init() in order to use the correct appname even if SPICE without SASL was requested on qemu command line. Signed-off-by: Christophe Fergeau <cfergeau@redhat.com> Message-id: 1452607738-1521-1-git-send-email-cfergeau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-18vnc: clear vs->tlscreds after unparenting itWolfgang Bumiller1-0/+1
This pointer should be cleared in vnc_display_close() otherwise a use-after-free can happen when when using the old style 'x509' and 'tls' options rather than a persistent tls-creds -object, by issuing monitor commands to change the vnc server like so: Start with: -vnc unix:test.socket,x509,tls Then use the following monitor command: change vnc unix:test.socket After this the pointer is still set but invalid and a crash can be triggered for instance by issuing the same command a second time which will try to object_unparent() the same pointer again. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-18gtk: implement set_echoPaolo Bonzini2-1/+45
Even without line editing, this makes -qmp vc more pleasant with the GTK+ backend. The only issue is that set_echo is invoked very early, long before a vc is actually associated with a VirtualConsole. To work around this, create a temporary VirtualConsole until then. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1450356422-31710-1-git-send-email-pbonzini@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-18Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into ↵Peter Maydell9-236/+236
staging qemu-sparc update # gpg: Signature made Sat 16 Jan 2016 12:32:06 GMT using RSA key ID AE0F321F # gpg: Good signature from "Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>" * remotes/mcayland/tags/qemu-sparc-signed: target-sparc: Migrate CWP and PIL for SPARC64 target-sparc: Use VMState arrays for SPARC64 TLB/MMU state target-sparc: Convert to VMStateDescription target-sparc: Don't flush TLB in cpu_load function target-sparc: Split cpu_put_psr into side-effect and no-side-effect parts vmstate: define vmstate_info_uinttl vmstate: Introduce VMSTATE_VARRAY_MULTPLY vmstate: introduce CPU_DoubleU arrays Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-16target-sparc: Migrate CWP and PIL for SPARC64Peter Maydell1-1/+4
In SPARC32 the env->cwp and env->psrpil state is part of the PSR register, and gets migrated as part of that register. In SPARC64 this state is in separate CWP and PIL registers, but we were not doing anything to migrate those. Add the missing fields to the migration vmstate (which is a migration break, but without these fields migration is completely broken anyway). This change means that trying a save/load of a SPARC64 target at the boot rom prompt now produces a system which at least responds to keyboard input after the restore. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16target-sparc: Use VMState arrays for SPARC64 TLB/MMU statePeter Maydell1-295/+19
Use VMState arrays for SPARC64 TLB/MMU state. This is a migration-break for SPARC64 (but not for SPARC32), which is acceptable because currently migration does not work for any SPARC64 machines due to the lack of any migration of interrupt controller state. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16target-sparc: Convert to VMStateDescriptionJuan Quintela5-227/+449
Convert the SPARC CPU from cpu_load/save functions to VMStateDescription. We preserve migration compatibility with the previous version (required for SPARC32 but not necessarily for SPARC64). Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: * Rebase and update to apply to master * VMSTATE_STRUCT_POINTER now takes type, not pointer-to-type * QEMUTimer* are migrated via VMSTATE_TIMER_PTR * Put CPUTimer vmstate struct inside TARGET_SPARC64 ifdef * Convert handling of PSR to use a vmstate_psr, like Alpha and ARM ] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16target-sparc: Don't flush TLB in cpu_load functionPeter Maydell1-2/+0
There's no need to flush the TLB in the SPARC cpu_load function: we're guaranteed to be loading state into a fresh clean configuration. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16target-sparc: Split cpu_put_psr into side-effect and no-side-effect partsPeter Maydell2-7/+13
For inbound migration we really want to be able to set the PSR without having any side effects, but cpu_put_psr() calls cpu_check_irqs() which might try to deliver CPU interrupts. Split cpu_put_psr() into the no-side-effect and side-effect parts. This includes reordering the cpu_check_irqs() to the end of cpu_put_psr(), because that function may actually end up calling cpu_interrupt(), which does not seem like a good thing to happen in the middle of updating the PSR. Suggested-by: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16vmstate: define vmstate_info_uinttlJuan Quintela1-0/+2
We are going to define arrays of this type, so we need the integer type. Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: updated to apply on current QEMU; renamed to 'uinttl' rather than 'uinttls' to match other vmstate naming] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16vmstate: Introduce VMSTATE_VARRAY_MULTPLYJuan Quintela2-0/+15
This allows to send a partial array where the size is another structure field multiplied by a constant. Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: updated to current master] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-16vmstate: introduce CPU_DoubleU arraysJuan Quintela2-0/+30
Add vmstate support for migrating arrays of CPU_DoubleU via VMSTATE_CPUDOUBLE_ARRAY. Signed-off-by: Juan Quintela <quintela@redhat.com> [PMM: rebased, since files have all moved since 2012; added VMSTATE_CPUDOUBLE_ARRAY_V for consistency with FLOAT64] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2016-01-15Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell31-738/+1077
* qemu-char logfile facility * NBD coroutine based negotiation * bugfixes # gpg: Signature made Fri 15 Jan 2016 17:58:28 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: qemu-char: do not leak QemuMutex when freeing a character device qemu-char: add logfile facility to all chardev backends nbd-server: do not exit on failed memory allocation nbd-server: do not check request length except for reads and writes nbd-server: Coroutine based negotiation nbd: Split nbd.c nbd: Always call "close_fn" in nbd_client_new SCSI device: fix to incomplete QOMify iscsi: send readcapacity10 when readcapacity16 failed qemu-char: delete send_all/recv_all helper methods vmw_pvscsi: x-disable-pcie, x-old-pci-configuration back-compat props are 2.5 specific scsi: initialise info object with appropriate size i386: avoid null pointer dereference target-i386: do not duplicate page protection checks scsi: revert change to scsi_req_cancel_async and add assertions Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-15qemu-char: do not leak QemuMutex when freeing a character devicePaolo Bonzini1-0/+1
The leak is only apparent on Win32. On POSIX platforms destroying a mutex is not necessary. Reported-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15qemu-char: add logfile facility to all chardev backendsDaniel P. Berrange9-83/+313
Typically a UNIX guest OS will log boot messages to a serial port in addition to any graphical console. An admin user may also wish to use the serial port for an interactive console. A virtualization management system may wish to collect system boot messages by logging the serial port, but also wish to allow admins interactive access. Currently providing such a feature forces the mgmt app to either provide 2 separate serial ports, one for logging boot messages and one for interactive console login, or to proxy all output via a separate service that can multiplex the two needs onto one serial port. While both are valid approaches, they each have their own downsides. The former causes confusion and extra setup work for VM admins creating disk images. The latter places an extra burden to re-implement much of the QEMU chardev backends logic in libvirt or even higher level mgmt apps and adds extra hops in the data transfer path. A simpler approach that is satisfactory for many use cases is to allow the QEMU chardev backends to have a "logfile" property associated with them. $QEMU -chardev socket,host=localhost,port=9000,\ server=on,nowait,id-charserial0,\ logfile=/var/log/libvirt/qemu/test-serial0.log -device isa-serial,chardev=charserial0,id=serial0 This patch introduces a 'ChardevCommon' struct which is setup as a base for all the ChardevBackend types. Ideally this would be registered directly as a base against ChardevBackend, rather than each type, but the QAPI generator doesn't allow that since the ChardevBackend is a non-discriminated union. The ChardevCommon struct provides the optional 'logfile' parameter, as well as 'logappend' which controls whether QEMU truncates or appends (default truncate). Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1452516281-27519-1-git-send-email-berrange@redhat.com> [Call qemu_chr_parse_common if cd->parse is NULL. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15nbd-server: do not exit on failed memory allocationPaolo Bonzini3-1/+11
The amount of memory allocated in nbd_co_receive_request is driven by the NBD client (possibly a virtual machine). Parallel I/O can cause the server to allocate a large amount of memory; check for failures and return ENOMEM in that case. Cc: qemu-block@nongnu.org Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15nbd-server: do not check request length except for reads and writesPaolo Bonzini1-7/+7
Only reads and writes need to allocate memory correspondent to the request length. Other requests can be sent to the storage without allocating any memory, and thus any request length is acceptable. Reported-by: Sitsofe Wheeler <sitsofe@yahoo.com> Cc: qemu-block@nongnu.org Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15nbd-server: Coroutine based negotiationFam Zheng1-47/+103
Create a coroutine in nbd_client_new, so that nbd_send_negotiate doesn't need qemu_set_block(). Handlers need to be set temporarily for csock fd in case the coroutine yields during I/O. With this, if the other end disappears in the middle of the negotiation, we don't block the whole event loop. To make the code clearer, unify all function names that belong to negotiate, so they are less likely to be misused. This is important because we rely on negotiation staying in main loop, as commented in nbd_negotiate_read/write(). Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1452760863-25350-4-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-01-15nbd: Split nbd.cFam Zheng8-453/+547
We have NBD server code and client code, all mixed in a file. Now split them into separate files under nbd/, and update MAINTAINERS. filter_nbd for iotest 083 is updated to keep the log filtered out. Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1452760863-25350-3-git-send-email-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>