aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2023-09-15refactor migration transition testWilliam Henderson1-2/+8
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15refactor bad pythonWilliam Henderson1-2/+2
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15refactor migration tests and small test fixesWilliam Henderson4-114/+111
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15respond to more of Thanos's commentsWilliam Henderson6-207/+310
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15fix: authors of test_migration.pyWilliam Henderson1-1/+2
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add more tests for bad argszWilliam Henderson1-1/+51
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15fix: argsz semantics in testsWilliam Henderson2-16/+20
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: improve test coverageWilliam Henderson3-5/+176
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add missing tests for different dirty page sizesWilliam Henderson2-6/+33
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15refactor: move a number of tests from C to PythonWilliam Henderson4-386/+195
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15fix: fixes for changes from John's core reviewWilliam Henderson4-55/+5
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add test for nonexistent stateWilliam Henderson1-0/+15
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add tests for migration FSM pathsWilliam Henderson4-18/+275
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15fix: memory leak in dirty page tracking testsWilliam Henderson1-5/+9
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add tests for logging specific pagesWilliam Henderson1-14/+84
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15fix: conflict with kernel definitions in testsWilliam Henderson3-58/+53
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: fix memory leak in unit testsWilliam Henderson1-0/+6
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add tests for dirty page loggingWilliam Henderson3-3/+367
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add test for starting in RESUMING stateWilliam Henderson1-0/+15
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add tests for `handle_mig_data_write`William Henderson1-2/+80
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add tests for `handle_mig_data_read`William Henderson1-3/+107
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: add migration state sequence testWilliam Henderson3-35/+37
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: reintroduce migration unit tests for v2William Henderson1-3/+200
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-09-15test: update existing testsWilliam Henderson12-1202/+41
Signed-off-by: William Henderson <william.henderson@nutanix.com>
2023-06-21Fix some python tests (#737)Axel PASCON3-6/+6
Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2023-06-08fix err/req irq fd issue (#731)limiao-intel1-0/+18
When handle_device_set_irqs set err irq/req irq, fd will be filled in vfu_ctx->irqs->efds[] rather than vfu_ctx->irqs->err_efd or vfu_ctx->irqs->req_efd. This patch adds irq index judgment before filling in fd to make sure fd is filled in the correct place. Signed-off-by: Miao Li <miao.li@intel.com> Reviewed-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2023-05-24test: don't leave global pointing to stack memory (#735)Jim Harris1-0/+1
test_device_is_stopped_and_copying points the global vfu_ctx structure to a local stack-allocated data structure. This is fine while the function is executing, but newer gcc complains that the pointer is left there after it returns. So clear the pointer to NULL before returning. Fixes issue #734. Reported-by: Kamil Godzwon <kamilx.godzwon@intel.com> Signed-off-by: Jim Harris <james.r.harris@intel.com>
2023-01-04allow -1 file descriptor for ioregionfd (#727)Thanos Makatos2-0/+97
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2023-01-03fix FLR reset callback (#729)John Levon3-14/+37
A reset callback is allowed to call functions disallowed in quiescent state. However, the FLR reset path neglected to account for this properly, causing an incorrect assert to be triggered if, for example, vfu_sgl_put() is called. To fix this, make sure all reset paths go through call_reset_cb(). Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2023-01-01test: use `grep -E` instead of `egrep` (#728)Ville Skyttä1-1/+1
`egrep` has been deprecated in GNU grep since 2007, and since 3.8 it emits obsolescence warnings: https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1 Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2022-11-22vfu_pci_init: initialize PCI config space flags (#724)Thanos Makatos1-0/+73
vfu_pci_init() sets the size of the PCI config space but not the flags; vfu_realize_ctx() won't initialize the flags since the size if already set. vfu_pci_init() must initialize flags as well. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-11-22fix shadow ioeventfd unit test (#726)Thanos Makatos2-3/+3
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-11-22allow shadow memory offset per shadow ioeventfd (#703)Thanos Makatos3-15/+17
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-11-16check spelling (#720)John Levon1-0/+11
Use misspell-fixer if available, and correct the small number of errors it found. Rather than trying to install into the CI, run it directly from a github action. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-10-05don't duplicate FD in get region info (#715)Thanos Makatos1-13/+2
This is out of spec. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-10-04fix compilation for i386 and ppc64 (#709)Thanos Makatos11-108/+158
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com> Reported-by: Eduardo Lima <eblima@gmail.com>
2022-08-08delete socket on vfu_ctx_destroy (#702)Thanos Makatos1-0/+1
fixes #660 Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2022-07-21disable client-server test by default (#700)John Levon1-12/+14
This test is flaky: there is some kind of race that causes the test to hang. Now we are run as part of qemu CI, we need to disable this by default, until we can find time to fix the test. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
2022-07-04support for shadow ioeventfd (#698)Thanos Makatos5-8/+121
When an ioeventfd is written to, KVM discards the value since it has no memory to write it to, and simply kicks the eventfd. This a problem for devices such a NVMe controllers that need the value (e.g. doorbells on BAR0). This patch allows the vfio-user server to pass a file descriptor that can be mmap'ed and KVM can write the ioeventfd value to this _shadow_ memory instead of discarding it. This shadow memory is not exposed to the guest. Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com> Change-Id: Iad849c94076ffa5988e034c8bf7ec312d01f095f
2022-06-09test/py: fix the arguments for vfu_dev_irq_state_cb_t (#695)Jag Raman2-4/+7
There is a typo in the arguments for vfu_dev_irq_state_cb_t - fix it in this patch. Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-06-07irq: inform device of IRQ mask & unmask via callback (#694)Jag Raman2-0/+38
Client masks or unmasks a device IRQ using the VFIO_USER_DEVICE_SET_IRQS message. Inform the device of such changes to the IRQ state. Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-05-30allow concurrent dirty bitmap get (#677)John Levon1-30/+74
Use atomic operations to allow concurrent bitmap updates with VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP operations. Dirtying clients can race against each other, so we must use atomic or when marking dirty: we do this byte-by-byte. When reading the dirty bitmap, we must be careful to not race and lose any set bits within the same byte. If we miss an update, we'll catch it the next time around, presuming that before the final pass we'll have quiesced all I/O. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-27re-work SGL API (#675)John Levon7-68/+68
Harmonize and rename the vfu_*sg() APIs to better reflect their functionality: in our case, there is no mapping happening as part of these calls, they are merely housekeeping for range splitting, dirty tracking, and so on. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-27remove maps list from DMA controller (#674)John Levon2-3/+1
->maps existed so that if a consumer does vfu_map_sg() and then we are asked to enable dirty page tracking, we won't mark those pages as dirty, and will hence potentially lose data. Now that we require quiesce and the use of either vfu_unmap_sg() or vfu_sg_mark_dirty(), there's no need to have this list any more. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-27remove refcnt from region (#673)John Levon1-1/+0
The reference count is unused, and not atomically handled, remove it. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-27re-work SG dirty tracking (#672)John Levon1-29/+26
Move SG dirtying to vfu_unmap_sg(): as we don't want to track SGs ourselves, doing this in vfu_map_sg() is no longer the right place. Note that the lack of tracking implies that any SGs must be unmapped before the final stop and copy phase. To avoid the need for this, add vfu_mark_sg_dirty(): this allows a consumer to mark a region as dirty explicitly without needing to unmap it. Currently it's the same as vfu_unmap_sg(), but that's an implementation detail. Note this still marks current maps after a get operation; that will change subsequently. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-27require quiesce for VFIO_USER_DIRTY_PAGES (#671)John Levon1-6/+87
If we require a quiesce for these calls, we can be sure that it will not race with any usage of vfu_*_sg() calls, as a first step towards concurrency. This is not ideal for VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP, which can potentially be called multiple times during pre-copy phase, but that's something we can fix later. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-23libvfio-user.h: sync VFIO_DEVICE_STATE_XXXX definitions with upstream (#690)Jag Raman4-15/+15
Rename VFIO_DEVICE_STATE_XXXX defines as VFIO_DEVICE_STATE_V1_XXXX. Upstream renamed these variable to be of the XXXX_V1_XXXX format and switched an enum for VFIO_DEVICE_STATE_XXXX. Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
2022-05-17tests: add checks to confirm test environment (#688)Jag Raman2-3/+8
test-lspci.sh: some test platforms don't include the lspci command, as such skip this test if lspci is not found test-linkage.sh: specify the source and build root paths of the subproject instead of the root paths of the master project Signed-off-by: Jagannathan Raman <jag.raman@oracle.com> Reviewed-by: John Levon <john.levon@nutanix.com>
2022-05-12run scan-build in CI (#680)John Levon1-1/+1
Yet another static analyzer pass, this one is used by SPDK, and as it did detect some minor issues, it's worth running. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>