aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2010-12-03linux-user: remove unnecessary local from __get_user(), __put_user()Peter Maydell
Remove an unnecessary local variable from the __get_user() and __put_user() macros. This avoids confusing compilation failures if the name of the local variable ('size') happens to be the same as the variable the macro user is trying to read/write. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03linux-user: fix memory leaks with NPTL emulationNathan Froyd
Running programs that create large numbers of threads, such as this snippet from libstdc++'s pthread7-rope.cc: const int max_thread_count = 4; const int max_loop_count = 10000; ... for (int j = 0; j < max_loop_count; j++) { ... for (int i = 0; i < max_thread_count; i++) pthread_create (&tid[i], NULL, thread_main, 0); for (int i = 0; i < max_thread_count; i++) pthread_join (tid[i], NULL); } in user-mode emulation will quickly run out of memory. This is caused by a failure to free memory in do_syscall prior to thread exit: /* TODO: Free CPU state. */ pthread_exit(NULL); The first step in fixing this is to make all TaskStates used by QEMU dynamically allocated. The TaskState used by the initial thread was not, as it was allocated on main's stack. So fix that, free the cpu_env, free the TaskState, and we're home free, right? Not exactly. When we create a thread, we do: ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE); ... new_stack = ts->stack; ... ret = pthread_attr_setstack(&attr, new_stack, NEW_STACK_SIZE); If we blindly free the TaskState, then, we yank the current (host) thread's stack out from underneath it while it still has things to do, like calling pthread_exit. That causes problems, as you might expect. The solution adopted here is to let the C library allocate the thread's stack (so the C library can properly clean it up at pthread_exit) and provide a hint that we want NEW_STACK_SIZE bytes of stack. With those two changes, we're done, right? Well, almost. You see, we're creating all these host threads and their parent threads never bother to check that their children are finished. There's no good place for the parent threads to do so. Therefore, we need to create the threads in a detached state so the parent thread doesn't have to call pthread_join on the child to release the child's resources; the child does so automatically. With those three major changes, we can comfortably run programs like the above without exhausting memory. We do need to delete 'stack' from the TaskState structure. Signed-off-by: Nathan Froyd <froydnj@codesourcery.com> Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03linux-user: mmap_reserve() not controlled by RESERVED_VAamateur
mmap_reserve() should be called only when RESERVED_VA is enabled. Otherwise, unmaped virtual address space will never be reusable. This bug will exhaust virtual address space in extreme conditions. Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03[PATCH] target-arm: remove unused functions cpu_lock(), cpu_unlock()Peter Maydell
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-02Fix buildAnthony Liguori
msix.o and msi.o get pulled into the build unconditionally for QMP. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-12-02Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori
2010-12-02vhost: Fix address calculation in vhost_dev_sync_region()Jason Wang
We still need advance address even we find there's no dirty pages in current chunk. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-02migration: allow rate > 4gMichael S. Tsirkin
I'd like to disable bandwidth limit or make it very high, Use int64_t all over to make values >= 4g work. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-02migration: stable ram block orderingMichael S. Tsirkin
This makes ram block ordering under migration stable, ordered by offset. This is especially useful for migration to exec, for debugging. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-01tcg-ia64: Fix warning in qemu_ld.Richard Henderson
The usermode version of qemu_ld doesn't used mem_index, leading to set-but-not-used warnings. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01tcg-ia64: Fix address compilation in qemu_st.Richard Henderson
A typo in the usermode address calculation path; R3 used where R2 needed. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01tcg-ia64: Fix tlb read error for 32-bit targets.Richard Henderson
Use ld4 not ld8 for reading the tlb of 32-bit targets. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01tcg-ia64: Implement qemu_ld32.Richard Henderson
The port was not properly merged following 86feb1c860dc38e9c89e787c5210e8191800385e Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01tcg-ia64: Provide default GUEST_BASE.Richard Henderson
Fix compilation error when GUEST_BASE is not defined. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01tcg: Fix default definition of divu_i32 and remu_i32.Richard Henderson
The arguments to tcg_gen_helper32 for these functions were not updated correctly in rev 2bece2c88331f024a46527634e3dd91c71d22141. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01Merge remote branch 'origin/master' into pciMichael S. Tsirkin
Conflicts: Makefile.objs hw/virtio.c
2010-11-30Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori
2010-11-30Merge remote branch 'qmp/for-anthony' into stagingAnthony Liguori
2010-11-30Use a Linux-style MAINTAINERS fileAnthony Liguori
I make no claims that this is accurate or exhaustive but I think it's a reasonable place to start. As the file mentions, the purpose of this file is to give contributors information about who they can go to with questions about a particular piece of code or who they can ask for review. If you sign up for a piece of code and indicate that it's Maintained or Supported, please be prepared to be responsive to questions about that subsystem. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- v1 -> v2 - Sort alphabetically - Copy in instructions from linux MAINTAINERS - Fix entries based on review feedback
2010-11-29ide: Reset current_addr after stopping DMAKevin Wolf
Whenever SSBM is reset in the command register all state information is lost. Restarting DMA means that current_addr must be reset to the base address of the PRD table. The OS is not required to change the base address register before starting a DMA operation, it can reuse the value it wrote for an earlier request. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29ide: Ignore double DMA transfer starts/stopsKevin Wolf
You can only start a DMA transfer if it's not running yet, and you can only cancel it if it's running. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29ide: Set bus master inactive on errorKevin Wolf
BMIDEA in the status register must be cleared on error. This makes FreeBSD respond (more) correctly to I/O errors. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29ide: Factor ide_dma_set_inactive outKevin Wolf
Several places that stop a DMA transfer duplicate this code. Factor it out into a common function. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-27Add pcnet-pci.cPaul Brook
Add file missing from last commit. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27Split out common pcnet codePaul Brook
The core pcnet emulation code is used by both the PCI "pcnet" device and the SPARC "lance" device. Split the common code frm the PCI code so that that can be configures independantly. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27Remove PCI from sparc32 targetPaul Brook
None of the (current) sparc32 machines have a PCI bus, so remove the PCI code from these configs. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27Detect missing config includesPaul Brook
Terminate make_device_config.sh if the awk command fails. Typically this means a missing file. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27Fix previous commitPaul Brook
Fix breakage from previous commit (missing pci.mak, and incorrect include in default-configs/s390x-softmmu.mak). Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27VirtIO config optionPaul Brook
Make virtio devices optional. Selecting individual devices is not useful as the host bindings are all in one file. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27PCI config includePaul Brook
Split PCI config options into a separate file Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-26Include directives in default configsPaul Brook
Allow default configs to be split into several files. Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-26Add missing dependency.Paul Brook
Teach Makefile that cmd.o depends on a generated header (specifically config-host.h). Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-26raw-posix: raw_pwrite comment fixupChristoph Hellwig
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25scsi-disk: Remove duplicate cdb parsingHannes Reinecke
We parse the CDB twice, which is completely unnecessary. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25scsi: Move sense handling into the driverHannes Reinecke
The current sense handling in scsi-bus is only used by the scsi-disk driver; the scsi-generic driver is using its own. So we should move the current sense handling into the scsi-disk driver. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25scsi: INQUIRY VPD fixesHannes Reinecke
We should announce and support the block device characterics page only on block devices, not on CDROMs. And the VPD page 0x83 has an off-by-one error. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25scsi: Return SAM status codesHannes Reinecke
Traditionally, the linux stack is using SCSI status codes which are shifted by one as compared to those defined in SAM. A SCSI emulation should naturally return the SAM defined codes, not the linux ones. So to avoid any confusion this patch modifies the existing definitions to match those found in SAM and removes any (now obsolete) byte-shift from the returned status codes. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25scsi: Increase the number of possible devicesHannes Reinecke
The SCSI parallel interface has a limit of 8 devices, but not the SCSI stack in general. So we should be removing the hard-coded limit and use MAX_SCSI_DEVS instead. And we only need to scan those devices which are allocated by the bus. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24block: Remove unused s->hd in various driversKevin Wolf
All drivers use bs->file instead of s->hd for quite a while now, so it's time to remove s->hd. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-24qemu and qemu-xen: support empty write barriers in xen_diskStefano Stabellini
This patch can be applied to both qemu-xen and qemu and adds support for empty write barriers to xen_disk. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24ide: convert bmdma address ioport to ioport_register()Avi Kivity
cmd646, via compile tested, pci lightly boot tested. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24block migration: do not submit multiple AIOs for same sector (v2)Marcelo Tosatti
An old version of this patch was applied to master, so this contains the differences between v1 and v2. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24Implement drive_del to decouple block removal from device removalRyan Harper
Currently device hotplug removal code is tied to device removal via ACPI. All pci devices that are removable via device_del() require the guest to respond to the request. In some cases the guest may not respond leaving the device still accessible to the guest. The management layer doesn't currently have a reliable way to revoke access to host resource in the presence of an uncooperative guest. This patch implements a new monitor command, drive_del, which provides an explicit command to revoke access to a host block device. drive_del first quiesces the block device (qemu_aio_flush; bdrv_flush() and bdrv_close()). This prevents further IO from being submitted against the host device. Finally, drive_del cleans up pointers between the drive object (host resource) and the device object (guest resource). Signed-off-by: Ryan Harper <ryanh@us.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24scsi-disk: Move active request assertsStefan Hajnoczi
SCSI read/write requests should not be re-issued before the current fragment of I/O completes. There are asserts in scsi-disk.c that guard this constraint but they trigger on SPARC Linux 2.4. It turns out that the asserts are too early in the code path and don't allow for read requests to terminate. Only the read assert needs to be moved but move the write assert too for consistency. Reported-by: Nigel Horne <njh@bandsman.co.uk> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24virtio: fix up VQ checksMichael S. Tsirkin
When migration triggers before a VQ is initialized, base pa is 0 and last_used_index must be 0 too: we don't have a ring to compare to. Reported-by: Juan Quintela <quintela@redhat.com> Tested-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-24virtio: Convert fprintf() to error_report()Stefan Hajnoczi
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit cd92f4cc22fbe12a7bf60c9430731f768dc1537c)
2010-11-24pci: fix bus walk under secondary bus resetMichael S. Tsirkin
Take into account secondary bus reset bit for bus walk: devices behind a reset bus should not respond to configuration cycles. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-23microblaze: target-ify target_ucontextRichard Henderson
Rename the members of target_ucontext so that they don't conflict with possible host macros for ucontext members. This has already been done for the other targets. Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-11-22pci bridge: implement secondary bus resetIsaku Yamahata
Trigger secondary bus reset when secondary bus reset bit value changes from 0 to 1. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-11-22pci: use qdev reset framework for pci bus resetIsaku Yamahata
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>