aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-02-17add unit tests for handle dirty pages w/o DMA (#348)Thanos Makatos5-2/+78
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-16exec_command: free out structs on failure (#345)John Levon1-0/+4
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-16fix DEVICE_GET_INFO specification and handling (#344)John Levon4-37/+51
The specification for DEVICE_GET_INFO differed from the implementation. After some discussion, fix the spec such that the struct should be passed in with ->argsz set. As it happened, the implementation was also wrong: we weren't actually checking the incoming ->argsz for validation, but we should. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-16support live migration in GPIO sample (#324)Thanos Makatos1-3/+84
* gpio: support live migration Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-15implement server-side max_msg_size (#323)John Levon1-4/+15
Pick an arbitrary limit of 65536, and report it back. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-15add vfu_get_poll_fd() (#322)John Levon4-81/+113
Library users can use this to sleep on either a newly-attached socket client, or a new message. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-15make file descriptors private to the transport (#321)John Levon5-46/+121
General code has no business knowing about the socket file descriptors. vfu_attach_ctx() is changed to not return the file descriptor; we'll re-expose a suitable file descriptor in a follow-up Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-15rename fedora workflow (#339)John Levon2-2/+2
We're no longer running CI on fedora-rawhide, so rename it. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-15handle VFIO_USER_DIRTY_PAGES in stopped and stop-and-copy states (#335)Thanos Makatos2-9/+9
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-15ack dirty page commands w/o DMA controller (#334)Thanos Makatos1-2/+7
need unit tests Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-11move exec_command socket handling into the transport (#320)John Levon3-104/+135
Also clean up some code surrounding this. In particular, don't play games with modifying the message header. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-11tiny rename of vfu_ctx_t::trans -> tran (#315)John Levon4-25/+25
This matches the tran_* namespace better. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-11introduce transport reply() handler (#313)John Levon4-11/+26
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-11CI: don't use development version of Fedora (#336)Thanos Makatos1-2/+2
Hopefully fixes the following problem: warning: /var/cache/dnf/rawhide-2d95c80a1fa0a67d/packages/openssl-devel-1.1.1i-3.fc35.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 9867c58f: NOKEY Fedora - Rawhide - Developmental packages for t 1.6 MB/s | 1.6 kB 00:00 GPG key at file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-34-x86_64 (0x45719A39) is already installed The GPG keys listed for the "Fedora - Rawhide - Developmental packages for the next Fedora release" repository are already installed but they are not correct for this package. Check that the correct key URLs are configured for this repository.. Failing package is: openssl-devel-1:1.1.1i-3.fc35.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-34-x86_64 Public key for openssl-libs-1.1.1i-3.fc35.x86_64.rpm is not installed. Failing package is: openssl-libs-1:1.1.1i-3.fc35.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-34-x86_64 The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'yum clean packages'. Error: GPG check FAILED Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.con>
2021-02-10timeout github actions jobs after 5 minutes (#332)John Levon1-0/+4
The default of 360 minutes isn't really necessary... Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-10don't expose -errno in public API (#327)John Levon5-25/+38
Regardless of what we do internally, most of our API uses standard mechanisms for reporting errors. Fix vfu_run_ctx() to do so properly as well, and fix a couple of other references for user-provided callbacks. This will require a small fix to SPDK. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-10API error return converged to one func (#325)swapnili6-68/+71
* API error return converged to one func Use ERROR_INT() or ERROR_PTR() to return errors from API's. This way if we want to change the behaviour later, we will just need to update these funcitons. Also fixed some error return cases and comments. Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-10fix pre-push build order (#326)John Levon1-4/+4
Re-order so we don't end up with an ASAN-enabled build at the end; purely for convenience. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-10set VFIO_REGION_INFO_FLAG_CAPS for migration region (#319)Thanos Makatos2-7/+30
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2021-02-10expose migration region (#305)Thanos Makatos10-88/+463
This patch exposes the fact that live migration is implemented as a special device region. Hiding this from the user doesn't offer much benefit since it only takes just a little bit of extra code for the user to handle it as a region. We do keep the migration callback functionality since this feature substantially simplifies supporting live migration from the device implementation's perspective. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Co-authored-by: John Levon <john.levon@nutanix.com>
2021-02-09samples/client: fix confusion over region_info argsz (#318)John Levon1-2/+2
get_device_region_info() was accidentally using the region size as the region info argsz. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-09introduce transport send_msg() handler (#314)John Levon4-10/+28
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-09remove recv_blocking() (#316)John Levon1-22/+3
It has the incorrect implication that other socket I/O is necessarily non-blocking. Replace with an explicit recv(..., MSG_WAITALL). Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-05use tran_sock_*() namespace (#308)John Levon8-190/+194
Rename (again!) all internal tran_sock APIs so it's very clear which cases are directly using them, perhaps when they shouldn't. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-04fix vfio_irq_idx_to_str() (#309)John Levon1-10/+11
This debug helper wasn't handling all the valid IRQ indexes. Found via ASAN. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-04open_sock(): remove stale comment (#307)John Levon1-4/+0
We fixed it so we don't accept() when we create the context, but only when we attach. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-04client/server: print number of FDs per region (#302)Thanos Makatos1-2/+4
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-04client/server: misc comments (#304)Thanos Makatos1-1/+12
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-04client/server: move mapping sparse areas to separate function (#301)Thanos Makatos1-14/+36
And print file path when it fails to mmap. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-04add AddressSanitizer run (#291)John Levon2-1/+17
Run unit tests with -fsanitize-address too. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-04close listening socket in vfu_destroy_ctx() (#299)John Levon4-15/+38
We were forgetting to close vfu_ctx->fd, add a tran callback for this. While we're there, clean up the tran callbacks somewhat. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-04fix leaks in unit tests (#298)John Levon1-0/+26
These aren't interesting, but it lets us run ASAN. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-02define full PCI Express capability struct (#289)John Levon2-6/+117
Define the full-size capability as defined in the specification. Previously, we were defining the structure as in the form used by PCI Express Integrated Endpoints. It's reasonable to assume, however, that a vfio-user device is a normal PCI Express Endpoint connected over a Link. We'll go further, and define the whole structure, including the slot registers at the end that are usually only used for Ports. The presumption here is that it can't hurt to use the larger size: the only way a client could care is if it presumed the next capability was at a particular offset from this one, and we must hope nothing is that silly. This also corrects a buffer overflow: cap_size() in fact disagreed with the original size of our struct pxcap (found via clang's address sanitizer). Signed-off-by: John Levon <john.levon@nutanix.com Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-01test_process_command_free_passed_fds: fix fd array size (#294)John Levon1-0/+1
We need to initialize .client_max_fds to get the fd array allocated properly in process_request(). Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-01samples/lspci: free vfu context (#293)John Levon1-0/+2
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2021-02-01remove stale FIXME (#290)John Levon1-1/+0
Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-01CI: run client/server through Valgrind (#282)Thanos Makatos2-7/+9
CI: run client/server through Valgrind And fail the test if Valgrind discovers any errors. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-02-01run client/server sample in CI (#274)Thanos Makatos2-0/+14
run client/server sample in CI Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-29CI: run apt-get update for Ubuntu 20 (#286)Thanos Makatos1-0/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28install static library (#267)John Levon1-0/+3
SPDK would like to statically link in libvfio-user, and it builds against a staged installation directory, so always install the static library too. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: don't sleep before migrating (#281)Thanos Makatos1-8/+0
Migration now takes a non-trivial amount of time, plus running the sample through Valgrind will inherently be slower. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28use unique errno when recv msg ID doesn't match (#280)Thanos Makatos1-1/+1
This is simply to make debugging easier. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: arm timer for a little longer (#283)Thanos Makatos1-3/+3
The interrupt might be delivered too soon, when e.g. the client is waiting for a response for a message it previously sent. This isn't 100% bulletproof. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: don't leak memory in client (#285)Thanos Makatos1-0/+6
Not that useful, apart from running it through Valgrind in CI. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28don't leak FDs after response (#284)Thanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: make number of migration iterations deterministic (#277)Thanos Makatos1-10/+3
The number of migration iterations would depend on whether or how many times the fake guest thread would touch BAR1. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: disarm timer when device is stopped (#276)Thanos Makatos1-0/+5
When the device is set to stop-and-copy state it must stop operating, which means that if it has been previously programmed to triggers it should refrain from doing so. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28client/server: don't sleep for fake guest thread (#275)Thanos Makatos1-3/+0
The fake guest thread unconditionally performs the first iteration, so there's no need to give it time to do stuff. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-28simplify client/server pre-copy phase by always copying entire BAR1 (#273)Thanos Makatos2-110/+53
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-27allow device to specify data_offset when resuming (#272)Thanos Makatos3-49/+45
Handling data_offset and data_size internally is wrong: we can't simply assume that the migration data should be appending to the migration region, devices might have their own requirements. This also requires a way for the device to return the data_offset, we do this by making the prepare_data callback applicable in resume state. Also, allow migration read/write callabcks to return errors. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>