summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* ivshmem: Inline check_shm_size() into its only callerMarkus Armbruster2016-03-211-26/+11Star
| | | | | | | | Improve the error messages while there. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1458066895-20632-34-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* ivshmem: Simplify memory regions for BAR 2 (shared memory)Markus Armbruster2016-03-211-30/+17Star
| | | | | | | | | | | | | ivshmem_realize() puts the shared memory region in a container region. Used to be necessary to permit delayed mapping of the shared memory. However, we recently moved to synchronous mapping, in "ivshmem: Receive shared memory synchronously in realize()" and the commit following it. The container is redundant since then. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1458066895-20632-33-git-send-email-armbru@redhat.com>
* ivshmem: Implement shm=... with a memory backendMarkus Armbruster2016-03-211-56/+23Star
| | | | | | | | | | | | | | | | | | | ivshmem has its very own code to create and map shared memory. Replace that with an implicitly created memory backend. Reduces the number of ways we create BAR 2 from three to two. The memory-backend-file is currently available only with CONFIG_LINUX, so this adds a second Linuxism to ivshmem (the other one is eventfd). Should we ever need to make it portable to systems where memory-backend-file can't be made to serve, we could create a memory-backend-shmem that allocates memory with shm_open(). Bonus fix: shared memory files are now created with permissions 0655 instead of 0777. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1458066895-20632-32-git-send-email-armbru@redhat.com>
* ivshmem: Tighten check of property "size"Markus Armbruster2016-03-211-3/+4
| | | | | | | | | If size_t is narrower than 64 bits, passing uint64_t ivshmem_size to mmap() truncates. Reject such sizes. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-31-git-send-email-armbru@redhat.com>
* ivshmem: Simplify how we cope with short reads from serverMarkus Armbruster2016-03-211-59/+16Star
| | | | | | | | | | | Short reads from a UNIX domain sockets are exceedingly unlikely when the other side always sends eight bytes and we always read eight bytes. We cope with them anyway. However, the code doing that is rather convoluted. Dumb it down radically. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-30-git-send-email-armbru@redhat.com>
* ivshmem: Drop the hackish test for UNIX domain chardevMarkus Armbruster2016-03-211-9/+0Star
| | | | | | | | | | | | | | | The chardev must be capable of transmitting SCM_RIGHTS ancillary messages. We check it by comparing CharDriverState member filename to "unix:". That's almost as brittle as it is disgusting. When the actual transmission all happened asynchronously, this check was all we could do in realize(), and thus better than nothing. But now we receive at least one SCM_RIGHTS synchronously in realize(), it's not worth its keep anymore. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-29-git-send-email-armbru@redhat.com>
* ivshmem: Rely on server sending the ID right after the versionMarkus Armbruster2016-03-211-3/+24
| | | | | | | | | | | | | | The protocol specification (ivshmem-spec.txt, formerly ivshmem_device_spec.txt) has always required the ID message to be sent right at the beginning, and ivshmem-server has always complied. The device, however, accepts it out of order. If an interrupt setup arrived before it, though, it would be misinterpreted as connect notification. Fix the latent bug by relying on the spec and ivshmem-server's actual behavior. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-28-git-send-email-armbru@redhat.com>
* ivshmem: Propagate errors through ivshmem_recv_setup()Markus Armbruster2016-03-213-63/+95
| | | | | | | | | | This kills off the funny state described in the previous commit. Simplify ivshmem_io_read() accordingly, and update documentation. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1458066895-20632-27-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* ivshmem: Receive shared memory synchronously in realize()Markus Armbruster2016-03-212-39/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When configured for interrupts (property "chardev" given), we receive the shared memory from an ivshmem server. We do so asynchronously after realize() completes, by setting up callbacks with qemu_chr_add_handlers(). Keeping server I/O out of realize() that way avoids delays due to a slow server. This is probably relevant only for hot plug. However, this funny "no shared memory, yet" state of the device also causes a raft of issues that are hard or impossible to work around: * The guest is exposed to this state: when we enter and leave it its shared memory contents is apruptly replaced, and device register IVPosition changes. This is a known issue. We document that guests should not access the shared memory after device initialization until the IVPosition register becomes non-negative. For cold plug, the funny state is unlikely to be visible in practice, because we normally receive the shared memory long before the guest gets around to mess with the device. For hot plug, the timing is tighter, but the relative slowness of PCI device configuration has a good chance to hide the funny state. In either case, guests complying with the documented procedure are safe. * Migration becomes racy. If migration completes before the shared memory setup completes on the source, shared memory contents is silently lost. Fortunately, migration is rather unlikely to win this race. If the shared memory's ramblock arrives at the destination before shared memory setup completes, migration fails. There is no known way for a management application to wait for shared memory setup to complete. All you can do is retry failed migration. You can improve your chances by leaving more time between running the destination QEMU and the migrate command. To mitigate silent memory loss, you need to ensure the server initializes shared memory exactly the same on source and destination. These issues are entirely undocumented so far. I'd expect the server to be almost always fast enough to hide these issues. But then rare catastrophic races are in a way the worst kind. This is way more trouble than I'm willing to take from any device. Kill the funny state by receiving shared memory synchronously in realize(). If your hot plug hangs, go kill your ivshmem server. For easier review, this commit only makes the receive synchronous, it doesn't add the necessary error propagation. Without that, the funny state persists. The next commit will do that, and kill it off for real. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-26-git-send-email-armbru@redhat.com>
* ivshmem: Plug leaks on unplug, fix peer disconnectMarkus Armbruster2016-03-211-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | close_peer_eventfds() cleans up three things: ioeventfd triggers if they exist, eventfds, and the array to store them. Commit 98609cd (v1.2.0) fixed it not to clean up ioeventfd triggers when they don't exist (property ioeventfd=off, which is the default). Unfortunately, the fix also made it skip cleanup of the eventfds and the array then. This is a memory and file descriptor leak on unplug. Additionally, the reset of nb_eventfds is skipped. Doesn't matter on unplug. On peer disconnect, however, this permanently wedges the interrupt vectors used for that peer's ID. The eventfds stay behind, but aren't connected to a peer anymore. When the ID gets recycled for a new peer, the new peer's eventfds get assigned to vectors after the old ones. Commonly, the device's number of vectors matches the server's, so the new ones get dropped with a "Too many eventfd received" message. Interrupts either don't work (common case) or go to the wrong vector. Fix by narrowing the conditional to just the ioeventfd trigger cleanup. While there, move the "invalid" peer check to the only caller where it can actually happen, and tighten it to reject own ID. Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-25-git-send-email-armbru@redhat.com>
* ivshmem: Disentangle ivshmem_read()Markus Armbruster2016-03-211-79/+80
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-24-git-send-email-armbru@redhat.com>
* ivshmem: Simplify rejection of invalid peer ID from serverMarkus Armbruster2016-03-211-39/+22Star
| | | | | | | | | | | | | | | | | | | | | ivshmem_read() processes server messages. These are 64 bit signed integers. -1 is shared memory setup, 16 bit unsigned is a peer ID, anything else is invalid. ivshmem_read() rejects invalid negative messages right away, silently. Invalid positive messages get rejected only in resize_peers(), and ivshmem_read() then prints the rather cryptic message "failed to resize peers array". Extend the first check to cover all invalid messages, make it report "server sent invalid message", and drop the second check. Now resize_peers() can't fail anymore; simplify. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-23-git-send-email-armbru@redhat.com>
* ivshmem: Assert interrupts are set up onceMarkus Armbruster2016-03-211-5/+2Star
| | | | | | | | | | | | | | | | | | An interrupt is set up when the interrupt's file descriptor is received. Each message applies to the next interrupt vector. Therefore, each vector cannot be set up more than once. ivshmem_add_kvm_msi_virq() half-heartedly tries not to rely on this by doing nothing then, but that's not going to recover from this error should it become possible in the future. watch_vector_notifier() doesn't even try. Simply assert what is the case, so we get alerted if we ever screw it up. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-22-git-send-email-armbru@redhat.com>
* ivshmem: Leave INTx alone when using MSI-XMarkus Armbruster2016-03-211-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | The ivshmem device can either use MSI-X or legacy INTx for interrupts. With MSI-X enabled, peer interrupt events trigger an MSI as they should. But software can still raise INTx via interrupt status and mask register in BAR 0. This is explicitly prohibited by PCI Local Bus Specification Revision 3.0, section 6.8.3.3: While enabled for MSI or MSI-X operation, a function is prohibited from using its INTx# pin (if implemented) to request service (MSI, MSI-X, and INTx# are mutually exclusive). Fix the device model to leave INTx alone when using MSI-X. Document that we claim to use INTx in config space even when we don't. Unlike other devices, ivshmem does *not* use INTx when configured for MSI-X and MSI-X isn't enabled by software. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1458066895-20632-21-git-send-email-armbru@redhat.com>
* ivshmem: Clean up MSI-X conditionsMarkus Armbruster2016-03-211-12/+10Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three predicates related to MSI-X: * ivshmem_has_feature(s, IVSHMEM_MSI) is true unless the non-MSI-X variant of the device is selected with msi=off. * msix_present() is true when the device has the PCI capability MSI-X. It's initially false, and becomes true during successful realize of the MSI-X variant of the device. Thus, it's the same as ivshmem_has_feature(s, IVSHMEM_MSI) for realized devices. * msix_enabled() is true when msix_present() is true and guest software has enabled MSI-X. Code that differs between the non-MSI-X and the MSI-X variant of the device needs to be guarded by ivshmem_has_feature(s, IVSHMEM_MSI) or by msix_present(), except the latter works only for realized devices. Code that depends on whether MSI-X is in use needs to be guarded with msix_enabled(). Code review led me to two minor messes: * ivshmem_vector_notify() calls msix_notify() even when !msix_enabled(), unlike most other MSI-X-capable devices. As far as I can tell, msix_notify() does nothing when !msix_enabled(). Add the guard anyway. * Most callers of ivshmem_use_msix() guard it with ivshmem_has_feature(s, IVSHMEM_MSI). Not necessary, because ivshmem_use_msix() does nothing when !msix_present(). That's ivshmem's only use of msix_present(), though. Guard it consistently, and drop the now redundant msix_present() check. While there, rename ivshmem_use_msix() to ivshmem_msix_vector_use(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1458066895-20632-20-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* ivshmem: Clean up register callbacksMarkus Armbruster2016-03-211-9/+2Star
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-19-git-send-email-armbru@redhat.com>
* ivshmem: Failed realize() can leave migration blocker behindMarkus Armbruster2016-03-211-9/+14
| | | | | | | | | | | | If pci_ivshmem_realize() fails after it created its migration blocker, the blocker is left in place. Fix that by creating it last. Likewise, if it fails after it called fifo8_create(), it leaks fifo memory. Fix that the same way. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-18-git-send-email-armbru@redhat.com>
* ivshmem: Fix harmless misuse of ErrorMarkus Armbruster2016-03-211-3/+4
| | | | | | | | | | | | | | We reuse errp after passing it host_memory_backend_get_memory(). If both host_memory_backend_get_memory() and the reuse set an error, the reuse will fail the assertion in error_setv(). Fortunately, host_memory_backend_get_memory() can't fail. Pass it &error_abort to make our assumption explicit, and to get the assertion failure in the right place should it become invalid. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-17-git-send-email-armbru@redhat.com>
* ivshmem: Don't destroy the chardev on version mismatchMarkus Armbruster2016-03-212-2/+4
| | | | | | | | | | | | | | | Yes, the chardev is commonly useless after we read a bad version from it, but destroying it is inappropriate anyway: the user created it, so the user should be able to hold on to it as long as he likes. We don't destroy it on other errors. Screwed up in commit 5105b1d. Stop reading instead. Also note QEMU's behavior in ivshmem-spec.txt. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-16-git-send-email-armbru@redhat.com>
* ivshmem: Drop ivshmem_event() stubMarkus Armbruster2016-03-211-7/+2Star
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-15-git-send-email-armbru@redhat.com>
* ivshmem: Clean up after commit 9940c32Markus Armbruster2016-03-211-12/+0Star
| | | | | | | | | IVShmemState member eventfd_chr is useless since commit 9940c32. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-14-git-send-email-armbru@redhat.com>
* ivshmem: Compile debug prints unconditionally to prevent bit-rotMarkus Armbruster2016-03-211-7/+7
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-13-git-send-email-armbru@redhat.com>
* ivshmem: Add missing newlines to debug printfsMarkus Armbruster2016-03-211-3/+3
| | | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-12-git-send-email-armbru@redhat.com>
* ivshmem: Rewrite specification documentMarkus Armbruster2016-03-212-161/+243
| | | | | | | | | | | | | | | | | This started as an attempt to update ivshmem_device_spec.txt for clarity, accuracy and completeness while working on its code, and quickly became a full rewrite. Since the diff would be useless anyway, I'm using the opportunity to rename the file to ivshmem-spec.txt. I tried hard to ensure the new text contradicts neither the old text nor the code. If the new text contradicts the old text but not the code, it's probably a bug in the old text. If the new text contradicts both, its probably a bug in the new text. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-11-git-send-email-armbru@redhat.com>
* ivshmem-test: Improve test cases /ivshmem/server-*Markus Armbruster2016-03-211-7/+10
| | | | | | | | | | | | | | | | Document missing test: behavior with MSI-X present but not enabled. For MSI-X, we test and clear the interrupt pending bit before testing the interrupt. For INTx, we only clear. Change to test and clear for consistency. Test MSI-X vector 1 in addition to vector 0. Improve comments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-10-git-send-email-armbru@redhat.com>
* ivshmem-test: Clean up wait for devices to become operationalMarkus Armbruster2016-03-211-6/+4Star
| | | | | | | | | | | | | | | test_ivshmem_server() waits until the first byte in BAR 2 contains the 0x42 we put into shared memory. Works because the byte reads zero until the device maps the shared memory gotten from the server. Check the IVPosition register instead: it's initially -1, and becomes non-negative right when the device maps the share memory, so no change, just cleaner, because it's what guest software is supposed to do. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-9-git-send-email-armbru@redhat.com>
* ivshmem-test: Improve test case /ivshmem/singleMarkus Armbruster2016-03-211-7/+16
| | | | | | | | | | | | | | Test state of registers after reset. Test reading Interrupt Status clears it. Test (invalid) read of Doorbell. Add more comments. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-8-git-send-email-armbru@redhat.com>
* tests/libqos/pci-pc: Fix qpci_pc_iomap() to map BARs alignedMarkus Armbruster2016-03-212-9/+12
| | | | | | | | | | | | | | | | | qpci_pc_iomap() maps BARs one after the other, without padding. This is wrong. PCI Local Bus Specification Revision 3.0, 6.2.5.1. Address Maps: "all address spaces used are a power of two in size and are naturally aligned". That's because the size of a BAR is given by the number of address bits the device decodes, and the BAR needs to be mapped at a multiple of that size to ensure the address decoding works. Fix qpci_pc_iomap() accordingly. This takes care of a FIXME in ivshmem-test. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-7-git-send-email-armbru@redhat.com>
* event_notifier: Make event_notifier_init_fd() #ifdef CONFIG_EVENTFDMarkus Armbruster2016-03-213-2/+8
| | | | | | | | | | | | | | | Event notifiers are designed for eventfd(2). They can fall back to pipes, but according to Paolo, event_notifier_init_fd() really requires the real thing, and should therefore be under #ifdef CONFIG_EVENTFD. Do that. Its only user is ivshmem, which is currently CONFIG_POSIX. Narrow it to CONFIG_EVENTFD. Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1458066895-20632-6-git-send-email-armbru@redhat.com>
* qemu-doc: Fix ivshmem huge page exampleMarkus Armbruster2016-03-181-1/+1
| | | | | | | | | | | | | Option parameter "share" is missing. Without it, you get a *private* mmap(), which defeats ivshmem's purpose pretty thoroughly ;) While there, switch to the conventional mountpoint of hugetlbfs /dev/hugepages. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1458066895-20632-5-git-send-email-armbru@redhat.com>
* ivshmem-server: Don't overload POSIX shmem and file nameMarkus Armbruster2016-03-184-52/+24Star
| | | | | | | | | | | | | Option -m NAME is interpreted as directory name if we can statfs() it and its on hugetlbfs. Else it's interpreted as POSIX shared memory object name. This is nuts. Always interpret -m as directory. Create new -M for POSIX shared memory. Last of -m or -M wins. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1458066895-20632-4-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* ivshmem-server: Fix and clean up command line helpMarkus Armbruster2016-03-181-44/+42Star
| | | | | | | | | | | | Burying error messages in ~20 lines of usage help is bad form. Print a single line pointing to -h instead. Print -h help to stdout rather than stderr. Fix default of -p. Clean up the help text a bit. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <1458066895-20632-3-git-send-email-armbru@redhat.com>
* target-ppc: Document TOCTTOU in hugepage supportMarkus Armbruster2016-03-181-0/+6
| | | | | | | | | | | | | The code to find the minimum page size is is vulnerable to TOCTTOU. Added in commit 2d103aa "target-ppc: fix hugepage support when using memory-backend-file" (v2.4.0). Since I can't fix it myself right now, add a FIXME comment. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1458066895-20632-2-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell2016-03-1735-470/+736
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Block layer patches # gpg: Signature made Thu 17 Mar 2016 15:49:29 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (29 commits) iotests: Test QUORUM_REPORT_BAD in fifo mode quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode block: Use blk_co_pwritev() in blk_co_write_zeroes() block: Use blk_aio_prwv() for aio_read/write/write_zeroes block: Use blk_prw() in blk_pread()/blk_pwrite() block: Use blk_co_pwritev() in blk_write_zeroes() block: Pull up blk_read_unthrottled() implementation block: Use blk_co_pwritev() for blk_write() block: Use blk_co_preadv() for blk_read() block: Use BdrvChild in BlockBackend block: Remove bdrv_states list block: Use bdrv_next() instead of bdrv_states block: Rewrite bdrv_next() block: Add blk_next_root_bs() block: Add bdrv_next_monitor_owned() block: Move some bdrv_*_all() functions to BB blockdev: Remove blk_hide_on_behalf_of_hmp_drive_del() blockdev: Split monitor reference from BB creation blockdev: Separate BB name management blockdev: Add list of all BlockBackends ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * Merge remote-tracking branch ↵Kevin Wolf2016-03-173-12/+26
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'mreitz/tags/pull-block-for-kevin-2016-03-17-v2' into queue-block Two quorum patches for the block queue, v2. # gpg: Signature made Thu Mar 17 16:44:11 2016 CET using RSA key ID E838ACAD # gpg: Good signature from "Max Reitz <mreitz@redhat.com>" * mreitz/tags/pull-block-for-kevin-2016-03-17-v2: iotests: Test QUORUM_REPORT_BAD in fifo mode quorum: Emit QUORUM_REPORT_BAD for reads in fifo mode Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| | * iotests: Test QUORUM_REPORT_BAD in fifo modeAlberto Garcia2016-03-172-4/+17
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: c0a8dbfdbe939520cda5f661af6f1cd7b6b4df9d.1458034554.git.berto@igalia.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
| | * quorum: Emit QUORUM_REPORT_BAD for reads in fifo modeAlberto Garcia2016-03-171-8/+9
| |/ | | | | | | | | | | | | | | | | | | | | If there's an I/O error in one of Quorum children then QEMU should emit QUORUM_REPORT_BAD. However this is not working with read-pattern=fifo. This patch fixes this problem. Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: d57e39e8d3e8564003a1e2aadbd29c97286eb2d2.1458034554.git.berto@igalia.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
| * block: Use blk_co_pwritev() in blk_co_write_zeroes()Kevin Wolf2016-03-171-4/+5
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use blk_aio_prwv() for aio_read/write/write_zeroesKevin Wolf2016-03-171-13/+92
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use blk_prw() in blk_pread()/blk_pwrite()Kevin Wolf2016-03-171-15/+21
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use blk_co_pwritev() in blk_write_zeroes()Kevin Wolf2016-03-171-9/+8Star
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Pull up blk_read_unthrottled() implementationKevin Wolf2016-03-173-18/+10Star
| | | | | | | | | | | | | | Use blk_read(), so that it goes through blk_co_preadv() like all read requests from the BB to the BDS. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use blk_co_pwritev() for blk_write()Kevin Wolf2016-03-173-13/+34
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use blk_co_preadv() for blk_read()Kevin Wolf2016-03-173-8/+65
| | | | | | | | | | | | | | | | This patch introduces blk_co_preadv() as a central function on the BlockBackend level that is supposed to handle all read requests from the BB to its root BDS eventually. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use BdrvChild in BlockBackendKevin Wolf2016-03-173-114/+192
| | | | | | | | Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Remove bdrv_states listMax Reitz2016-03-174-40/+3Star
| | | | | | | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Use bdrv_next() instead of bdrv_statesMax Reitz2016-03-171-6/+6
| | | | | | | | | | | | | | | | | | There is no point in manually iterating through the bdrv_states list when there is bdrv_next(). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Rewrite bdrv_next()Max Reitz2016-03-171-3/+14
| | | | | | | | | | | | | | | | | | | | Instead of using the bdrv_states list, iterate over all the BlockDriverStates attached to BlockBackends, and over all the monitor-owned BDSs afterwards (except for those attached to a BB). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Add blk_next_root_bs()Max Reitz2016-03-172-0/+25
| | | | | | | | | | | | | | | | This function iterates over all BDSs attached to a BB. We are going to need it when rewriting bdrv_next() so it no longer uses bdrv_states. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
| * block: Add bdrv_next_monitor_owned()Max Reitz2016-03-174-0/+17
| | | | | | | | | | | | | | | | Add a function for iterating over all monitor-owned BlockDriverStates so the generic block layer can do so. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>