Commit graph

17754 commits

Author SHA1 Message Date
Li Zhi Hui 16d2fc002a block/cow: Return real error code
Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:33 +01:00
Avi Kivity 39a7a362e1 coroutine: switch per-thread free pool to a global pool
ucontext-based coroutines use a free pool to reduce allocations and
deallocations of coroutine objects.  The pool is per-thread, presumably
to improve locality.  However, as coroutines are usually allocated in
a vcpu thread and freed in the I/O thread, the pool accounting gets
screwed up and we end allocating and freeing a coroutine for every I/O
request.  This is expensive since large objects are allocated via the
kernel, and are not cached by the C runtime.

Fix by switching to a global pool.  This is safe since we're protected
by the global mutex.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:33 +01:00
Kevin Wolf c2c9a46609 qcow2: Allow >4 GB VM state
This is a compatible extension to the snapshot header format that allows
saving a 64 bit VM state size.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:33 +01:00
Kevin Wolf 3763f26f2f Documentation: Add qemu-img -t parameter in man page
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-15 12:40:08 +01:00
Kevin Wolf 87a1b3e381 qemu-img rebase: Fix for undersized backing files
Backing files may be smaller than the corresponding COW file. When
reading directly from the backing file, qemu-img rebase must consider
this and assume zero sectors after the end of backing files.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-15 12:40:08 +01:00
Josh Durgin b9c532903f rbd: always set out parameter in qemu_rbd_snap_list
The caller expects psn_tab to be NULL when there are no snapshots or
an error occurs. This results in calling g_free on an invalid address.

Reported-by: Oliver Francke <Oliver@filoo.de>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Li Zhi Hui 28c1202ba6 block/qcow2.c: call qcow2_free_snapshots in the function of qcow2_close
Signed-off-by: Li Zhi Hui <zhihuili@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini 3f3aace830 block: avoid useless checks on acb->bh
Coverity is confused by this "if" and reports leaks on acb->bh.
The bottom half is always deleted before releasing the AIOCB,
in either bdrv_aio_cancel_em or bdrv_aio_bh_cb.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini b9b2008bbf block: dma_bdrv_* does not return NULL
Initially attempted with the following semantic patch:

@ rule1 @
expression E;
statement S;
@@
  E =
(
   dma_bdrv_io
|  dma_bdrv_read
|  dma_bdrv_write
)
     (...);
(
- if (E == NULL) { ... }
|
- if (E)
    { <... S ...> }
)

which however did not match anything.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini 6bee44ea34 dma: the passed io_func does not return NULL
Initially found with the following semantic patch:

@ type @
BlockDriverAIOCB *x;
expression E;
@@
  x = E;
- if (x == NULL) { ... }

@ acb1 @
expression E, E1;
@@
  E1->acb = E;
- if (E1->acb == NULL) { ... }

@ aiocb1 @
expression E, E1;
@@
  E1->aiocb = E;
- if (E1->aiocb == NULL) { ... }

@ acb @
expression E, E1;
@@
  E1.acb = E;
- if (E1.acb == NULL) { ... }

@ aiocb @
expression E, E1;
@@
  E1.aiocb = E;
- if (E1.aiocb == NULL) { ... }

but changed manually to include an assert.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini 91977c2e5f block: qemu_aio_get does not return NULL
Initially done with the following semantic patch:

@ rule1 @
expression E;
statement S;
@@
  E = qemu_aio_get (...);
(
- if (E == NULL) { ... }
|
- if (E)
    { <... S ...> }
)

which however missed occurrences in linux-aio.c and posix-aio-compat.c.
Those were done by hand.

The change in vdi_aio_setup's caller was also done by hand.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:08 +01:00
Paolo Bonzini df9309fb43 block: simplify failure handling for bdrv_aio_multiwrite
Now that early failure of bdrv_aio_writev is not possible anymore,
mcb->num_requests can be set before the loop starts.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:07 +01:00
Paolo Bonzini ad54ae80c7 block: bdrv_aio_* do not return NULL
Initially done with the following semantic patch:

@ rule1 @
expression E;
statement S;
@@
  E =
(
   bdrv_aio_readv
|  bdrv_aio_writev
|  bdrv_aio_flush
|  bdrv_aio_discard
|  bdrv_aio_ioctl
)
     (...);
(
- if (E == NULL) { ... }
|
- if (E)
    { <... S ...> }
)

which however missed the occurrence in block/blkverify.c
(as it should have done), and left behind some unused
variables.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-12-15 12:40:07 +01:00
Dr. David Alan Gilbert 222f23f508 tcg/arm: remove fixed map code buffer restriction
On ARM, don't map the code buffer at a fixed location, and fix up the
call/goto tcg routines to let it do long jumps.

Mapping the code buffer at a fixed address could sometimes result in it being
mapped over the top of the heap with pretty random results.

Signed-off-by: Dr. David Alan Gilbert <david.gilbert@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2011-12-14 21:58:18 +01:00
Andrzej Zaborowski 23ce84b1bb Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm 2011-12-14 21:34:00 +01:00
Anthony Liguori 9423a2e8dd Merge remote-tracking branch 'stefanha/trivial-patches-next' into staging 2011-12-14 07:59:21 -06:00
Stefan Weil 126c79133f doc: Remove Symbian Virtual Platform
Commit d396a657ba removed the code
for SVP, so the documentation needs this update.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:14:21 +00:00
Isaku Yamahata 3060eb7541 migration.h: remove incoming_expected declarations
The variable is deleted by 1bcef683bf
So remove its declaration.

Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:13:40 +00:00
Peter Maydell 73f5e3132a tcg: make tcg_const_ptr actually accept a pointer argument
Make tcg_const_ptr() include a cast so that you can pass it a
pointer. This allows us to drop the casts we had in all the places
that use this macro.

Acked-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:13:03 +00:00
Stefan Weil e7d81004e4 Fix spelling in comments, documentation and messages
accidently->accidentally
annother->another
choosen->chosen
consideres->considers
decriptor->descriptor
developement->development
paramter->parameter
preceed->precede
preceeding->preceding
priviledge->privilege
propogation->propagation
substraction->subtraction
throught->through
upto->up to
usefull->useful

Fix also grammar in posix-aio-compat.c

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:09:44 +00:00
Stefan Weil a1b6abe76b hw: Fix spelling in comments and code
compatiblity->compatibility
transfered->transferred
transfering->transferring

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:09:38 +00:00
Stefan Weil 26404edcce hw: Fix spelling in comments
adress->address
advertisment->advertisement
begining->beginning
bondary->boundary
controler->controller
controll->control
convertion->conversion
doesnt->doesn't
existant->existent
instuction->instruction
loosing->losing
managment->management
multipled->multiplied
negotation->negotiation
runing->running
teh->the
unchangable->unchangeable
writen->written
yeild->yield

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:09:12 +00:00
Stefan Weil 4d8db4e4a0 hw: Fix spelling (licenced->licensed)
New code introduced old misspellings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:08:23 +00:00
Stefan Weil c11e80e299 fmopl: Fix spelling in code and comments
algorythm->algorithm
rythm->rhythm

I did not try to fix the coding standard, so checkpatch.pl
reports lots of violations.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-12-14 11:08:20 +00:00
Andreas Färber db8336cd1f target-arm: Infer VFPv3 feature from VFPv4
VFP4 => VFP3

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:25 +00:00
Andreas Färber 86e72db6aa target-arm: Infer VFP feature from VFPv3
VFP3 => VFP

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber 908ce98085 target-arm: Infer Thumb division feature from M profile
M => THUMB_DIV

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber b3faf5f02e target-arm: Infer Thumb2 feature from ARMv7
V7 => THUMB2

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber 10e8770274 target-arm: Infer AUXCR feature from ARMv6
V6 && !M => AUXCR

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber bbc5c5fa17 target-arm: Infer ARMv6(K) feature from ARMv7
V7 && M => V6
V7 && !M => V6K

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber 6bf62124f5 target-arm: Infer ARMv6 feature from v6K
V6K => V6

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber 08c40f3c62 target-arm: Infer ARMv5 feature from ARMv6
V6 => V5

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:24 +00:00
Andreas Färber ddb572ec48 target-arm: Infer ARMv4T feature from ARMv5
V5 => V4T

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:23 +00:00
Jean-Christophe DUBOIS dd4ebc2ecd arm: Fix CP15 FSR (C5) domain setting
Return the correct value in the domain field in the cp15 DFSR
(C5) -- bug noticed during Xvisor development.

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
[Peter Maydell: reworded commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2011-12-13 18:19:23 +00:00
Paolo Bonzini da5361cc68 ccid: make threads joinable
Destroying a mutex that another thread might have just unlocked
is racy.  It usually works, but you cannot do that in general and
can lead to deadlocks or segfaults.  Change ccid to use joinable
threads instead.

(Also, qemu_mutex_init/qemu_cond_init were missing).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Paolo Bonzini 403e633126 qemu-thread: implement joinable threads for Win32
Rewrite the handshaking between qemu_thread_create and the
win32_start_routine, so that the thread can be joined without races.
Similar handshaking is done now between qemu_thread_exit and
qemu_thread_join.

This also simplifies how QemuThreads are initialized.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Jan Kiszka 8763046b4b qemu-thread: implement joinable threads for POSIX
Allow to control if a QEMU thread is created joinable or not. Make it
not joinable by default to avoid that we keep the associated resources
around when terminating a thread without joining it (what we couldn't do
so far for obvious reasons).

The audio subsystem will need the join feature when converting it to
QEMU threading/locking abstractions, so provide that service.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Jan Kiszka cf21871479 qemu-thread: add API for joinable threads
Split from Jan's original qemu-thread-posix.c patch.  No semantic change,
just introduce the new API that POSIX and Win32 implementations will
conform to.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Stefan Hajnoczi d396a657ba syborg: drop support for Symbian Virtual Platform
The Symbian Virtual Platform was an ARM-based development and debugging
board.  Since Symbian has been disbanded and the code is no longer being
used it can now be removed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:22 -06:00
Stefan Hajnoczi e5d1fca0f2 net: take ownership of fd in socket init functions
Today net/socket.c has no consistent policy for closing the socket file
descriptor when initialization fails.  This means we leak the file
descriptor in some cases or we could also try to close it twice.

Make error paths consistent by taking ownership of the file descriptor
and closing it on error.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:21 -06:00
Stefan Hajnoczi 842480d493 net: expand tabs in net/socket.c
In order to make later patches sane, expand the tab characters and
conform to QEMU coding style now.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:21 -06:00
Michael Roth bf95c0d55c guest agent: add supported command list to guest-info RPC
Not that there is blacklisting functionality we can no longer infer
the agent's capabilities via version. This patch extends the current
guest-info RPC to also return a list of dictionaries containing the name
of each supported RPC, along with a boolean indicating whether or not
the command has been disabled by a guest administrator/distro.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:21 -06:00
Michael Roth abd6cf6d8e guest agent: add RPC blacklist command-line option
This adds a command-line option, -b/--blacklist, that accepts a
comma-seperated list of RPCs to disable, or prints a list of
available RPCs if passed "?".

In consequence this also adds general blacklisting and RPC listing
facilities to the new QMP dispatch/registry facilities, should the
QMP monitor ever have a need for such a thing.

Ideally, to avoid support/compatability issues in the future,
blacklisting guest agent functionality will be the exceptional
case, but we add the functionality here to handle guest administrators
with specific requirements.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:21 -06:00
Peter Maydell 4cb016587a Add a .mailmap to map pre-git-conversion authors to friendly names
Add a .mailmap file so 'git shortlog' can map the unfriendly
pre-git-conversion author entries to real names.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 17:06:21 -06:00
Eduardo Habkost 8160bfbc4d unix_close(): check for close() errors too (v2)
In case close() fails, we want to report the error back.

Changes v1 -> v2:
 - Use braces on if statement to match coding style

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:20 -06:00
Eduardo Habkost 61a5872fd6 tcp_close(): check for close() errors too (v2)
In case close() fails, we want to report the error back.

Changes v1 -> v2:
 - Use braces on if statement to match coding style

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:20 -06:00
Eduardo Habkost e375fe3472 exec_close(): return -errno on errors (v2)
All qemu_fclose() callers were already changed to accept any negative
value as error, so we now can change it to return -errno.

When the process exits with a non-zero exit code, we return -EIO to as a
fake errno value.

Changes v1 -> v2:
 - Don't use "//" comments, to make checkpatch.pl happy

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:20 -06:00
Eduardo Habkost 0e28670519 stdio_fclose: return -errno on errors (v2)
This is what qemu_fclose() expects.

Changes v1 -> v2:
 - Add braces to if statement to match coding style

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:20 -06:00
Eduardo Habkost 26f1af0aa3 stdio_pclose: return -errno on error (v3)
This is what qemu_fclose() expects.

Changes v1 -> v2:
 - On success, keep returning pclose() return value, instead of always 0.

Changes v2 -> v3:
 - Add braces on if statements to match coding style

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:19 -06:00
Eduardo Habkost d82ca91587 qemu_fclose: return last_error if set (v3)
This will make sure no error will be missed as long as callers always
check for qemu_fclose() return value. For reference, this is the
complete list of qemu_fclose() callers:

 - exec_close(): already fixed to check for negative values, not -1
 - migrate_fd_cleanup(): already fixed to consider only negative values
   as error, not any non-zero value
 - exec_accept_incoming_migration(): no return value check (yet)
 - fd_accept_incoming_migration(): no return value check (yet)
 - tcp_accept_incoming_migration(): no return value check (yet)
 - unix_accept_incoming_migration(): no return value check (yet)
 - do_savevm(): no return value check (yet)
 - load_vmstate(): no return value check (yet)

Changes v1 -> v2:
 - Add small comment about the need to return previously-spotted errors

Changes v2 -> v3:
 - Add braces to "if" statements to match coding style

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-12-12 11:47:19 -06:00