Commit graph

3 commits

Author SHA1 Message Date
Matt Delco
ce03437d56 tests: avoid internal error in pause test
When running plugin tests it's not uncommon to see:

vcpu 0 has internal error

Though the tests don't actually fail on this problem. This seems
to occur as a side effect of the plugin_vcpu_pause.c calling
crosvm_destory_memory() before the test VM has actually finished
running.

The main thread will call read() on the 'kill' eventfd 5 times for:
init, pause, unpause, unpause, kill

The vcpu thread will call write() on the eventfd up to 8 times:

init, pause #1, unpause #1, pause #2, unpause #2, pause #3,
unpause #3, kill

The main thread's third pause request might occur before the second
pause request has been processed, in which case the vcpu thread will
only be paused twice (thus there will only be 6 calls to write()).
Given the unpredictable # of events I've opted to split the
init/pause/unpause events to a separate eventfd and keep the 'kill'
eventfd solely for its intended purpose.

BUG=None
TEST=ran ./build_test several times and observed no failures in the
pause plugin test.

Change-Id: Ie0817a4419ae6199fcc5c53496360b2bd81556e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2012788
Reviewed-by: Matt Delco <delco@chromium.org>
Commit-Queue: Matt Delco <delco@chromium.org>
Tested-by: Matt Delco <delco@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2020-02-19 23:05:34 +00:00
Dmitry Torokhov
532a94c1c8 Fix race between un-pausing vcpu and requesting vcpu pause
To ensure that we do not miss pause request sent while we were in paused
state, or were exiting paused state, let's start using
KVM_SET_SIGNAL_MASK. SIGRTMIN() + 0 signal will be blocked and thus is
not delivered, and it will only be checked when KVM_RUN is being
executed, reliably interrupting KVM_RUN.

TEST=cargo test --features plugin; cargo test -p kvm; ./build_test
BUG=chromium:800626

Change-Id: Iae67a411c23c2b14fbfcbc7d53d0bc86ec4b67d9
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/944850
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-03-08 00:37:33 -08:00
Dmitry Torokhov
0db8f41245 Ensure we are not holding per-cpu data lock when pausing VCPU
We may want to issue additional crosvm_pause_vcpu() requests while VCPUs
are waiting to be resumed, so we need to make sure we are not holding
lock while waiting.

TEST=cargo test --features plugin
BUG=chromium:800626

Change-Id: Ia74836a567fc565fbd868abdcaa6d0174a4341ad
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/917426
Reviewed-by: Zach Reizner <zachr@chromium.org>
2018-02-16 15:12:24 -08:00