In e2e tests, error 16 is thrown when a tap device is created when its
name is shared with another tap device. This makes the test flaky.
Distinct tap name is needed.
TEST=./tools/dev_container ./tools/presubmit crosvm_tests_x86_64
BUG=b:333090169
Change-Id: I205f69a81ef1f15c3a50c6aae5bcbcd80c30c99e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5453013
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
I can't reproduce the test flake, but I suspect the issue is that, in
the test infa machines, the restore is slow enough that it causes the 5
second timeout for sending a command to the guest to fail.
Instead of immediately proceeding with the test, wait for the restore
work to finish first. This allows us to use a longer timeout and also
should make it more obvious which step of the test is slow and/or flaky.
BUG=b:333090069
TEST=./tools/run_tests --dut=host --filter-expr="test(snapshot_restore) | test(suspend_resume)" --run-root-tests --no-unit-tests --repetitions 100
Change-Id: I75ad900dcd080d4fa76ceca14974ac044b41e7d5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5446126
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Flakyness is getting significant enough that CQ runs
with 3 retries are no longer passing.
BUG=b:333090069
BUG=b:333090169
BUG=b:333090177
TEST=None
Change-Id: I2409421be27f14cf6b25af30913c1b232a0a92f8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5429051
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
It looks like r13 of the prebuilt uploaded does not include the change
made in https://crrev.com/c/5190792 . This CL updates the prebuilt
with the CL as well as the updates made so far.
BUG=b:295256641
TEST=tools/dev_container tools/presubmit all
Change-Id: I795762089ae8aaa42ab34ad9e9cf393429c237cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5351685
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Make it easy to tell which prebuilt revision is used for the run.
BUG=b:295256641
TEST=CQ
Change-Id: Ib62d0539a248abe83291c4cec8085f929f159b2b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5343248
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
Auto-Submit: Hikaru Nishida <hikalium@chromium.org>
If a PCI device is hot plugged into a PCIe slot with pending hot unplug
events unhandled by the guest OS, the new device may not be discovered
by the guest. Therefore, crosvm shall not reuse the PCIe slots until
guest indicates the previous events are handled. This is achieved by
Prioritize vacant ports if available.
If all ports are busy, wait for command completion asynchornously
before sending hotplug signal.
An e2etest for the edge case is added.
BUG=b:325997618
TEST=./tools/dev_container ./tools/presubmit
TEST=tast run ${DUT} network.ARCIPv6Connectivity (downstream chromeOS on
a DUT with 2 ethernet adapters, ref: b:324979531)
Change-Id: I66d4ee9c88dd6c703491c1af440bc7160e8ff91b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5316598
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Currently the guest kernel does not properly support PCIe hotplug: when
a PCI device is hotplugged, PCI_EXP_SLTCTL_CCIE is not sent to notify
the hardware that hotplug is completed. This is solved by enabling the
kernel flags.
BUG=b:325997618
TEST=./tools/dev_container ./tools/presubmit
Change-Id: I6d22fbd94fb420dab3b21c87cedccccbe015d7df
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5332332
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Specify patch version explicitly to improve the reproducibility of
e2e_test image generation. This patch version is determined based on r11
of the prebuilt images, which is the currently used version at this
point.
BUG=b:295256641
TEST=./tools/dev_container ./tools/presubmit
Change-Id: I6e91ce88bec4827168a61c682c3de9f0e94e4c70
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5308635
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Hikaru Nishida <hikalium@chromium.org>
This is only used by the e2e_tests, so it should not affect most
downstream projects.
BUG=b:321994092
Change-Id: I42bc550c273d68960174bcf577ea0555cb22ef12
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5232209
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
https://crrev.com/c/5188024 bumped the version of anyhow and libc. That
broke ChromiumOS build, since we forgot to bump the versions on
ChromiumOS side. This CL fixes the build failure by reverting the
version bump. Although we also can upgrade the versions on the
ChromiumOS, they are not mandate version dump so we just revert them.
BUG=None
Test=./tools/dev_container ./tools/presubmit
Change-Id: Ie47b7219402d73493679cac3330fb958601086df
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5223988
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Takaya Saeki <takayas@chromium.org>
Some flakes are being observed, which could be calling drop on a newly
booting VM.
BUG=b:316594255
TEST=presubmit
Change-Id: I39deff15bb87a04baf5172a6d25b66ae1fabdc74
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5214785
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Instead of building up one big json value, we pass around a "writer"
object that allows writing out fragments of the snapshot and nested
namespacing. The snapshot fragments can use different serialize formats
if desired, e.g. the RAM snapshot uses a raw binary file.
Snapshot directory contents:
213 .../bus0/ACPIPMResource-0
299 .../bus0/cmos-0
2 .../bus0/i8042-0
542 .../bus0/pci-config-io-port-0
234 .../bus0/serial-0
234 .../bus0/serial-1
234 .../bus0/serial-2
235 .../bus0/serial-3
536 .../bus1/pci-config-mmio-0
3.5K .../bus1/pcivirtio-balloon-0
6.1K .../bus1/pcivirtio-block-0
1.7K .../bus1/pcivirtio-rng-0
536 .../bus1/pci-virtual-config-mmio-0
569 .../bus1/PvPanic-0
5.3K .../irqchip
8.0G .../mem
52 .../mem_metadata
6.5K .../vcpu/vcpu0
6.6K .../vcpu/vcpu1
6.5K .../vcpu/vcpu2
6.5K .../vcpu/vcpu3
For now, the new abstractions are not used in `BusDevice` or any layers
beyond `BusDevice`, so each device is still a monolithic JSON file.
`PciConfigIo::debug_label` was modified so that it can't change at
runtime.
Based on some light testing, this seems to reduce the snapshot time for
a particular ubuntu VM config from 14s to 13s.
BUG=b:268093674
Change-Id: Ic16980629ff9321bee19f56f6e8e50f214492a7d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4739910
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
The process only works with cargo test. Not with run_tests.
BUG=b:301351266
TEST=None
Change-Id: Iaf20c01e32746d263dab297b2f13adea568e1b98
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5123311
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
The current scsi integration test does not include test cases for the
block discard operation. Because of the lack of the test case, it could
not catch some bugs caused by other CLs (https://crrev.com/c/5019243).
This adds a test function in the e2e_tests crate for the discard
operation.
BUG=b:300042376
TEST=./tools/run_tests --dut=vm -E 'test(test_scsi)'
Change-Id: Ia7ec3850fdf493371fab8fc102d4bf7f978da696
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5075901
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Nigthly is enabled as part of https://crrev.com/c/4950268
This change contains the formatting changes resulting from the switch.
BUG=b:302055317
TEST=dev_container presubmit format --no-delta
Change-Id: Idaf2b8bae2e09c624b19d9cd3dd5fc8e4d099b3c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5067088
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Syscall frequency table is updated with real-world data collected
from typical use cases of crostini and arcvm combined with upstream
benchmark suite.
FIXED=b:258316090
BUG=b:258316090
Change-Id: I4d832a4fc1f9c78dfa753071eea1fe1fad16f096
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068402
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The validate_and_configure_tap() and virtio_features_to_tap_offload()
functions already effectively did nothing on Windows, since the
implementations of these for Slirp were not provided. These functions
are moved to sys so the Linux-specific TAP interfaces are no longer
needed in TapTCommon.
The get_ifreq() function is only called internally inside the
implementation of the Linux Tap struct; it does not need to be part of
the TapT trait at all.
The MacAddress <-> sockaddr interop is only needed on Linux, and the
conversion can be moved into the get_mac_address and set_mac_address
implementations for Linux.
With these changes, net_sys is used only on Linux, so it can be
conditionally compiled and not included in non-Linux builds at all.
BUG=None
TEST=tools/dev_container tools/presubmit
Change-Id: I3419a3bdb1470c4d72588fe19e43fabcdfe4e451
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Deprecate the existing --vhost-user-* device-specific frontend options
and replace them with a single --vhost-user option that takes the device
type as one of its arguments.
This simplifies the device setup code significantly; there is now a
single list of vhost_user frontend devices that can be created in one
loop instead of scattering device-type-specific creation all over the
create_virtio_devices() function.
The DeviceType names are normalized for this new --vhost-user option as
well - when relevant, they use the full name rather than abbreviating it
inconsistently (for example, "blk" is now known as "block", which
matches the option used with `crosvm devices`). A few special cases are
handled with serde renames (such as "p9" -> "9p"), but all other device
types use the default serde kebab-case naming.
BUG=b:262291811
TEST=connect to `crosvm devices` and virtiofsd with --vhost-user
Change-Id: I75e9442f73af122ccfda9731331cde5c238b88fb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5030974
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Also adds lld, which will be used in a follow-up to improve
linking performance.
Since debian has had a stable release since then, we also
need to upgrade a few library versions in the testvm.
Swap tests that require userfaultfd were able to run without
root before. In the latest version of debian we need to configure
for unprivileged access.
Since this is the case for glinux workstations as well, let's
mark those tests as root-only and let them execute via sudo.
BUG=b:304875018,b:256905223
TEST=presubmit
Change-Id: Ied0b34e248990378a7864b4a394aa21d8f824f71
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5013631
Reviewed-by: Zihan Chen <zihanchen@google.com>
Reviewed-by: Shin Kawamura <kawasin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Gimp plugin initializing, loading and file batch processing are
plausible real-world operations to run under crosvm, and can be
easily measured in an automated gui-less fasion. These operations
mainly stress small file disk performance.
BUG=b:181105093
TEST=./tools/bench gimp
Change-Id: I5891771a031f5843df4aebdfede8ae9b7ed53977
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4994843
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This fixes "unused return value of `std::result::Result::<T, E>::map_or`
that must be used" warnings with Rust 1.73 and also makes the code
easier to understand.
Change-Id: Id028a0859db6a7b6670e1ed6f9c9cc443a2e7c61
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5007729
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Currently crosvm allows only one SCSI device. This commit enables crosvm
to handle multiple SCSI devices. Each LogicalUnit contains a disk image,
and each controller contains all the LogicalUnits.
BUG=b:300042376
TEST=guest with multiple SCSI devices boots and FIO works on all
devices
TEST=./tools/run_tests2 --dut=vm -E 'test(test_scsi)'
Change-Id: I67653e9b7656e867277afbea24987cdefa9da0fb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4964673
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Currently crosvm's virtio-scsi implementation only handles requests from
the request queues. This commit handles requests in the controlq and
also implements a sub-action of MAINTENANCE IN command.
The control requests contain operations such as async task cancellation,
LUN reset, asynchronous notifications. The sub-action REPORT SUPPORTED
TASK MANAGEMENT FUNCTIONS reports the supported actions, and we
currently implement LOGICAL UNIT RESET and TARGET RESET.
BUG=b:300042376
TEST=sg_opcodes --tmf /dev/sda
TEST=sg_reset -d /dev/sda
TEST=cargo t -p devices
TEST=./tools/run_tests2 --dut=vm -E 'test(test_scsi)'
Change-Id: Ie1015d7e78c02cb46e5f20ac724838fc91dff4fe
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4958314
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Currently x86_64 is the only architecture with scsi seccomp policy
file. This commit introduces the policy for aarch64 and arm devices.
From this commit, vm.Fio.scsi_* tast tests should pass.
BUG=b:300042376
TEST=tools/presubmit
TEST=./tools/run_tests2 --dut=vm -E 'test(test_scsi_mount)'
TEST=tast run $DUT vm.Fio.scsi_*
Change-Id: Ia3071d6aebe2bd427ea75a448e6208185eecbb04
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4987210
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
`sg3-utils` is the package needed for `sg_reset`, `sg_opcodes`, and
other `sg_*` commands, which sends SCSI commands to devices. This commit
adds the package to the test rootfs so that `sg_*` commands can be used
in the e2e_tests in later commit (cf. https://crrev.com/c/4958314).
BUG=b:300042376
TEST=./run_guest.sh boots a guest with the `sg_*` commands installed.
Change-Id: I644d7bda3eab054ea8e88b1e78edcf6df659a259
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4974876
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
This commit implements an e2e test for virtio-scsi implementation. The
test checks if mounting a scsi device inside the guest shell succeeds.
BUG=b:300042376
TEST=tools/presubmit
Change-Id: Ib34d1e3aabcb941a3aec3dce8d6f0ac8a27d50dd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4876531
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
Updates are made to source and documentation.
This more accurately represents the currently supported platforms of
Android/Linux and Windows, without unexpectedly including other
unix-like operating systems.
Command to reproduce:
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {}
$ cargo fmt
md files manually updated to fix line lengths.
Renaming `unix` modules to `linux` will be done in a later CL.
Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Snapshot was doing a `from_slice`, which deserializes the result of
another snapshot. However, not all vhost-user devices live in crosvm
and, and those devices won't necessarily return a similar struct.
Switching to `to_value` will require a Vec<u8> as a return, and not a
`JSON`, which should be easier to adopt for other devices.
This error was encountered in AOSP when testing Mac80211_hwsim. Snapshot
returns a Vec<u8>, however the snapshot would fail, unable to snapshot
the slice. The fix was tested in AOSP and was confirmed working.
Encoutered as part of b/295028005
Bug: N/A
Test: Tested in AOSP && presubmit
Change-Id: I17dd0befa7ae95be5b014eed5ae27413ebf338b8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4897963
Reviewed-by: Richard Zhang <rizhang@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
Currently the guest kernel for the e2e test does not support virtio-scsi
driver. This commit changes the `common.config` file to make the guest
kernel support virtio-scsi driver so we'll be able to add scsi e2e tests.
BUG=b:300042376
TEST=virtio-scsi e2e test CL (CL:4876531) worked with the kernel locally
Change-Id: Ic38dd7744df59049ed6d17b346df974d1b34aa1e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4882199
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
I break the Makefile in crrev.com/c/4787727, this cl fixes it.
TEST=make clean && make
Change-Id: I931d2bfa8c6dfa2ce218a67a59e8cd52a682b259
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4883337
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add a preliminary version of pgbench running in e2e_tests
facilities. It currently does nothing with the benchmark result.
TEST=Can pass and produce results with `./tools/bench postgres`
BUG=b:257303497
Change-Id: If2f06cb0a9c91f5d7240094bacf86fc681062127
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4763144
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Delegate has been restructured to support this change, and sadly
Win64 compile exclusion has to be reintroduced to avoid compiling
this binary on Windows.
Now e2e_tests can explicitly obtain result (including stdout/stderr/
exit code/signal) from command ran in test guests.
BUG=b:257303497
Change-Id: Ibcd773b69cca9708a8dacb34cc870ca527fa32c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4787727
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Had to tweak the assert because the queue snapshot no longer has an
"activated" field.
The first `vm` created wasn't dropped until the very end of the test and
then the shutdown would hang (didn't debug why). Added a scope so that
everything from the first VM is dropped before we attempt the restore.
Change-Id: I9e3a10dbe08045d581742645d8305ba1951530cf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4875223
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
For more coverage.
BUG=b:266514902
Change-Id: I9ec4e391d3012b733d6809f6b219b96e0699635b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4868581
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>