aboutsummaryrefslogtreecommitdiff
path: root/samples/client.c
AgeCommit message (Collapse)AuthorFilesLines
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: 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 Makatos1-22/+10
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-27implement fake guest thread in client/server live migration sample (#264)Thanos Makatos1-20/+113
* add fake guest thread in migration sample This patch adds a thread that pretends to be the guest VM (while the client itself is the VMM) in the live migration sample. Our goal is to have the fake guest modifying device state while live migration is ongoing and when live migration has finished the device state should be correct in the destination server. Currently this doesn't work because the server blindly applies device state when resuming, which is wrong because some device state must be applied to specific offsets. To fix this we have to include the offset and length (along with BAR1 data) in the migration stream. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-25add pre-copy phase in live migration example (#247)Thanos Makatos1-59/+144
This patch adds a simplistic pre-copy phase in the live migration sample. The end goal is have a separate thread in the client to modify device state while the device is in the pre-copy phase. This will be done in later patches. BAR1 is saved during the pre-copy phase and BAR0 is saved during the stop-and-copy phase. This is purely for convenience. There are quite a few assumptions and FIXMEs, even in the client code. We plan to address them in future patches. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-25don't assume specific message ID when negotiating (#248)Thanos Makatos1-5/+2
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-25use unique message IDs in client sample (#255)Thanos Makatos1-10/+11
This makes debugging a little bit easier. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-25don't use uninitialized memory (#244)Thanos Makatos1-4/+7
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-04re-work PCI config setup API (#198)John Levon1-5/+6
Split up vfu_pci_setup_config_hdr(): individual "helpers" like vfu_pci_set_id() are much simpler to use than making the user specify the values in header-formatted structs; and this way if we want to add additional helpers, we won't need to modify the existing functions. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2021-01-04pass vfu_ctx_t to callbacks (#222)John Levon1-1/+1
It's easy (with the new vfu_get_private()) to go from a vfu_ctx to the private pointer, but not the reverse; pass the ctx into all the callbacks. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-17Fix passing of recv_data (#214)swapnili1-1/+1
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-16fix clang build (#210)John Levon1-12/+19
Also add clang to pull request build checks. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-15send file descriptors for sparse areas in get region info (#201)Thanos Makatos1-17/+38
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-14return region capabilities a la VFIO (#187)Thanos Makatos1-44/+59
This patch returns region capabilities the same way VFIO does: if argsz is not large enough then it returns only region info and sets argsz to what it should be in order to fit the capabilities, the client then retries with a large enough argsz. The protocol specification has been updated as well. Plus unit tests. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-12-02use log level defines from syslogThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-27rename to libvfio-user (#128)John Levon1-78/+79
The muser name no longer reflects the implementation, and will just serve to confuse. Bite the bullet now, and rename ourselves to reflect the actual implementation. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-25PCI regions idx enum renamed to start with LM_PCI (#125)swapnili1-4/+4
* PCI regions idx enum renamed to start with LM_PCI Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-24Api refactoring (#115)swapnili1-5/+5
API refactoring
2020-11-24clean up headersJohn Levon1-3/+3
Introduce include/ dir for public headers, and clean up include guards etc.
2020-11-24refactor sock send/recv functions (#114)John Levon1-69/+85
Use shorter, more readable, function names, add re-jig the wrappers such that the most common operations are shortest.
2020-11-24parse VFIO_USER_VERSION JSON stanzaJohn Levon1-19/+24
2020-11-20don't expose migration as regionThanos Makatos1-30/+40
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20drop pci_info from lm_ctxThanos Makatos1-0/+12
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-20don't assume debug build for running server sampleThanos Makatos1-5/+12
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-19refactor socket code into lib/tran_sock.[ch] (#97)John Levon1-2/+21
2020-11-18implement new negotiation implementationJohn Levon1-24/+94
Refactor for a partial re-implementation of initial vfio-user negotiation. Still needs to do the JSON parsing - in the meantime, hard-code the max_fds parameters we expect.
2020-11-18implement migration resuming on destination serverThanos Makatos1-61/+219
This patch implements resuming on the destination server. We also demonstrate how to do this in the client/server sample. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-18samples/server: replace fprintf(stdout, ...) with printf for simplicityThanos Makatos1-7/+7
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-18samples/client: use err/errx for simplicityThanos Makatos1-205/+119
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-18client/server sample: trigger IRQ based on alarmThanos Makatos1-68/+67
This avoid having to manually send USR1 to the server. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-18remove commented out headerThanos Makatos1-1/+0
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-18don't assert on error, instead respond with the relevant bit setThanos Makatos1-0/+8
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-17Fix compiler errors for non-dbg buildSwapnil Ingle1-2/+3
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-16validate argszThanos Makatos1-0/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-16eliminate duplicate recv(2) codeThanos Makatos1-0/+6
Instead of having each command handler do its own recv(2) to receive the command, we do this once for all commands. This reduces the code a bit. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-11-12Fix issues pointed by CFLAGS "-Wall -Werror -Wextra"Swapnil Ingle1-20/+20
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-11-05experimental support for running the device state and copy iteration protocolThanos Makatos1-30/+198
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-10-29support for live migration region and dirty page loggingThanos Makatos1-59/+193
This patch adds support for the live migration region and dirty page logging following VFIO. Live migration is NOT yet functional as handling accesses to the migration region is not yet implemented. Currenty the live migration region is fixed at index 9 simply for simplifying the implementation. Dirty page logging is simplified by requiring IOVA ranges to match exactly the entire IOVA range. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-10-22samples/client: move VFIO_USER_REGION_READ/VFIO_USER_REGION_WRITE earlierThanos Makatos1-12/+12
It's better to have this test earlier in the code, before we have to manually trigger an IRQ, so that we can catch developement errors more easily. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-10-22samples/client: also receive region_access response for region writeThanos Makatos1-3/+9
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-10-22include region header when replying to ↵Thanos Makatos1-1/+3
VFIO_USER_REGION_READ/VFIO_USER_REGION_WRITE Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-10-07client, server changes for VFIO_USER_DEVICE_RESETSwapnil Ingle1-0/+15
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-10-07client, server changes for lm_irq_message()Swapnil Ingle1-2/+26
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-10-05Add test for VFIO_USER_DMA_READ and VFIO_USER_DMA_WRITESwapnil Ingle1-14/+140
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-30client: better output messagesSwapnil Ingle1-3/+3
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-29client: reviewed get_device_region_info()Swapnil Ingle1-20/+13
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-29Implementation of VFIO_USER_DEVICE_GET_REGION_INFOSwapnil Ingle1-2/+73
WIP: test sparse capability and add sample test for it Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-29Keep client dev_info for further useSwapnil Ingle1-9/+8
Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2020-09-29implement VFIO_USER_REGION_READ/VFIO_USER_REGION_WRITEThanos Makatos1-5/+66
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
2020-09-29fix typoThanos Makatos1-1/+1
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>