Commit graph

6093 commits

Author SHA1 Message Date
Daniel Verkamp
875a1d7d30 base: net: use tempfile::tempdir() in tests
Avoid the possibility of tests reusing the same socket path by using a
known unique directory from tempfile::tempdir().

BUG=b:274145919
TEST=tools/dev_container tools/presubmit

Change-Id: I883e223617fb465cdfbff5a45509098487b62b3b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4348699
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-17 20:02:44 +00:00
Daniel Verkamp
cddc85e857 cros_asyncv2: use tempfile::tempdir in tests
Replace use of env::temp_dir() with tempfile::tempdir() to ensure each
test gets a unique temporary directory name. This avoids test failures
when running multiple tests simultaneously.

BUG=b:274145919
TEST=tools/dev_container tools/presubmit

Change-Id: Iac3a248d52830f3efafd8a954d1cc9633f71f301
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4350606
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-17 20:02:41 +00:00
Dennis Kempin
0ccd4f3045 presubmit: Run x86 tests on vm by default
This changes the default for tools/presubmit, which will also change
the default for Luci.

Added a few tips into tools/run_tests to clarify that --dut=vm is
the default and how to manage the vm.

BUG=b:273335986
TEST=dev_container --podman presubmit --no-delta

Change-Id: I0b4f5026838c10585342efa935e10dca070aa131
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346976
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-17 19:56:13 +00:00
Daniel Verkamp
7e803c87ca base: use SafeDescriptor in unix socket wrappers
The SafeDescriptor type manages the lifetime of the file descriptor,
which simplifies the socket wrappers (each wrapper no longer needs to
manually implement Drop to close the descriptor, for example).

Also remove unneeded RawFd-related functions, replacing them with
RawDescriptor and SafeDescriptor equivalents.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I634a19922ec24d06071b21247c79761cfc21a79a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4322266
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2023-03-17 18:12:49 +00:00
Max Lee
e6719f4ed5 crosvm: support new parameter - precompiled cache
A new mount is required by borealis VM to store precompiled cache
downloaded by the guest to store in the host. Note that the
downloaded caches will be validated before usage.

Further details at go/borealis-shaders-stable.

BUG=b:267113203
TEST=`vmc launch borealis`

Change-Id: Id6c13765d9d1522962824eeb1f26044db0e8edf3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4306415
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Max Lee <endlesspring@google.com>
2023-03-17 02:34:29 +00:00
recipe-roller
d5c5ffbf03 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786420913885852801

depot_tools:
c5b38329e6~..3f3e2f789e27d41d3c20a555fd60a39ebd631e15
  c5b3832 (jojwang@chromium.org)
      Don't raise 'not a git repo' error in metrics collection.
  71b606e (sokcevic@chromium.org)
      Fix use_relative_path on Windows
  3f3e2f7 (sokcevic@chromium.org)
      Trigger recipe autoroller

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I5842e8c5c477b597a89bdf1d7f0f3d9d42bc2f42
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4348045
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-17 00:43:03 +00:00
Frederick Mayle
ab72f2ca9e crosvm: improve cold restore
This change tweaks the `--restore` flag to be compatible with the
(upcoming) vCPU restore code. Restoring the vCPUs requires them to have
been started (otherwise we'll essentially deadlock), so now we do the
following:

* Tell the vCPUs to start in a suspended state.
* Wait for vCPU init to finish.
* Perform the restore.
* Tell the vCPUs to start running.

I've left the Windows half unimplemented because there are some missing
pieces + I expect a lot of churn in this area and so it will probably be
less work overall to port the restore code once the Linux half is
actually working.

BUG=b:269174485

Change-Id: I07588e887789498a951d9427391415afcb646e96
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4343614
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
2023-03-16 21:03:26 +00:00
Elliot Berman
c8a638fae1 crosvm: fdt: Add option to dump generated devicetree blob
Add an option to dump the crosvm-generated devicetree blob. This option
can be helpful in understanding what devices are reported to the guest
VM and help diagnose issues related to improper devicetree.

Bug: 249043819
Change-Id: Id18ddf0838520c84f648ed8584db2ef8235ed636
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
(cherry picked from commit 7acecab0b1d4f0428b71823f0e2982d385213279)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346951
Commit-Queue: Steven Moreland <smoreland@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Elliot Berman
d88d67c39b base: Move BlockedSignal to base sys
Move generic implementation of BlockedSignal to base sys.

Change-Id: I459ca424a633dc3fc2a5dec625dde8e5878132c0
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
(cherry picked from commit 5f51fa4ae3b979972d273dff4c224c1999b6e641)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346950
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Elliot Berman
e3d71786c2 sys_util: Cast ioctl_expr inputs to IoctlNr
If the input to ioctl_expr is a u8, it cannot be implicitly upcast to
u32. Cast the inputs, not the output, to IoctlNr.

Change-Id: I2bce639bd13f49c92fadedb146ef09171b7128ef
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
(cherry picked from commit 585dbff782e96d0531734d37ec2dae958f6ff6c1)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346949
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Sahitya Tummala
76ac8b936f aarch64: load ELF image based on its class detection
Today, it supports only loading ELF64 images. This change
allows to accept both ELF32 and ELF64 images.

BUG=b:261538125
TEST=cargo test -p kernel_loader -p aarch64

Change-Id: I54d125226abdfa21047f5590006e69e83a1b3fc5
Signed-off-by: Sahitya Tummala <quic_stummala@quicinc.com>
(cherry picked from commit 1abc72e6fea6d00d9e025251e354aa862f9e12e9)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346948
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Sreenad Menon
8d663c8bb2 devices: virtio: Determine block queue size and number of queues at runtime
Qualcomm has developed a wrapper program which uses CrosVM's libdevices
crate. Some Qualcomm products use 128 as virtio block queue size and
some of them use 256 depending on the memory constraints.
Number of virtqueues per device may also vary on different products.

This change lets virtio block new() function accept arguments that
specifies virt queue size and number of virt queues.
Qualcomm's wrapper program calls new() method with required number of
queues and queue size at runtime.

When they are not provided at runtime, they get their default values.

(cherry picked from commit 777d6aeeb07b505d0d76dcab881bd25b09796547)
Change-Id: I8613633630fd1d0e285a117d2778db26c97e651f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346947
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Sreenad Menon
cc155803e6 devices: virtio: Always inject interrupts if hypervisor can handle
Gunyah hypervisor supports virtio-mmio transport only in some
products on which CrosVM is also used. Qualcomm has developed
a wrapper program which uses CrosVM's libdevices crate.

Gunyah hypervisor has some optimizations for how virtio-mmio
register access are handled. Normally they are synchronous access -
meaning any access of virtio-mmio register by a guest will cause
a fault, which requires blocking the guest VCPU until the access
can be served by CrosVM running in a different VM. Since that could
induce long delays for guest (esp since the OS in which CrosVM is
hosted is considered untrusted), Gunyah hypervisor caches all
virtio-mmio registers in its address space.
Any read access is handled without requiring intervention from CrosVM.
Write access is handled asynchronously - i,e a write will cause
hypervisor to updates its copy of the register, unblock the guest vcpu
and simultaneously notify CrosVM about the update.
By the time CrosVM gets to notice the update, guest could have
progressed lot more.

This works reasonably well for many devices and registers.
One problem case is writes to VIRTIO_MMIO_INTERRUPT_ACK, which signals
the guest having seen an interrupt. CrosVM seems to rely on synchronous
handling of this register write. Any attempts to kick guest via signal
method of 'struct Interrupt' (devices/src/virtio/interrupt.rs) skips
sending a kick if prior kick is "not yet" acknowledged, which fails
if writes to VIRTIO_MMIO_INTERRUPT_ACK is asynchronous.

This patch introduces a 'async_intr_status' flag in signal method which allows
the kick to be always delivered to guest independent of the status of
acknowledgement of prior kicks. Hypervisor will queue kick requests and
deliver another kick after current kick is processed.

Its expected that only the Qualcomm wrapper program will initialize the
interrupt object with 'async_intr_status' flag set and hence the upstream
CrosVM should not be affected because of this change.

BUG=b:243368499

(cherry picked from commit 7069619ef727acc93c81f72ef390c465e63b3b70)
Change-Id: I691a12ed92af81533b792243c1a7fd06f6b8e281
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346946
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Sahitya Tummala
5b3761a29a aarch64: Add support for loading kernel image formatted as ELF
This is done similar to x86 platform to check if a kernel image have
ELF signature first and if it doesn't, then it is passed to the Image
loader as a fallback.

BUG=b:232360323

(cherry picked from commit f319faf8a070e5e5a7744ad0f64206d3a2704811)
Change-Id: I4604c7fc527c0fdf49971233ddba08fee5be4a8f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346945
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Elliot Berman
ae0c1d8341 aarch64: Abstract KVM register read/writes
Remove KVM-specific code from the generic aarch64 module by providing a
generic enum for hypervisor-specific vCpus to use instead:
VCpuRegAArch64.

(cherry picked from commit cfd5acd14f924fe17f09c007fb20bf2abc632a79)
Change-Id: I486ea24993493c314ed6dacd5cedeeb135225135
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346944
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Elliot Berman
9b3061ddb1 linux: Prepare to run with multiple hypervisors
Move KVM-specific code to "run_kvm" function in preparation for
supporting different hypervisors.

(cherry picked from commit c66faccc3c663a2e8da356d24f6dffcbe2b32b4b)
Change-Id: Iaf7136bf12332672b0a67ca5dac5b654115fe2cf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346943
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Elliot Berman
02e5e9708b linux: Drop kvm_ prefix from vcpu_ids
Simple rename to emphasize that vcpu_ids are not KVM-specific.

(cherry picked from commit 4450ecc21609191210065c5acb5fa1c6f1ad1daf)
Change-Id: I4e702338d8aa1260f9205b19db3eced48661be01
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346942
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
112df7392c Revert "linux: Drop kvm_ prefix from vcpu_ids"
This reverts commit 53d9530f36.

Change-Id: I943763c5dbf6b73e7598c364b205c944d73594b7
(cherry picked from commit 61f76ea66d82c7998244a31528f2bf3c087ce887)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346941
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
c7d1b51eeb Revert "linux: Prepare to run with multiple hypervisors"
This reverts commit d28ce639c6.

Change-Id: If95eff5f0fee7251846504203d7199869e7fd0c5
(cherry picked from commit f7fc42c08e9f75c9105f7a6320417304c48226fa)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346940
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
c623af3c8a Revert "aarch64: Abstract KVM register read/writes"
This reverts commit c903a58f86.

Change-Id: Iea45955089bf7285232ada096b122a08e755f7c8
(cherry picked from commit 28e9e7350931c3c7c7307d777f83b3225eb3761c)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346939
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
e0f14ea520 Revert "aarch64: Add support for loading kernel image formatted as ELF"
This reverts commit a6945f4a49.

Change-Id: Ia6a908079e05e72b1d1f1850880c738fb858e3fb
(cherry picked from commit 52ef81c70cba60080897d1d10798a3dea8201a17)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346938
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
ffc9454041 Revert "devices: virtio: Always inject interrupts if hypervisor can handle"
This reverts commit 5ad8b5afc5.

Change-Id: I61f2fa3d63b7f64dc6dec277870d100385c16857
(cherry picked from commit eebfac71d38705d1a86084259752ee8f5b743f6a)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346937
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
4fec47b427 Revert "devices: virtio: Determine block queue size and number of queues at runtime"
This reverts commit 877b350c4b.

Change-Id: I380b9f6e4918dde7f003c99e517882da294c11e3
(cherry picked from commit 1277fe375839316a4a446d76dd2a3d39c7109439)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346936
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
e52809e187 Revert "aarch64: load ELF image based on its class detection"
This reverts commit 750e821e57.

Change-Id: I632d5cf90b67258b9ae4b58a2398774006bb24e5
(cherry picked from commit d96e49f35bf035805a6a087e62f3f10efa7063ae)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346935
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
d86a1ff9c7 Revert "base: Cast ioctl_expr inputs to IoctlNr"
This reverts commit 3216994fd6.

Change-Id: I0109a3270e492be0feb6dd1430c159be2bbeb4ff
(cherry picked from commit deb06d8a71b17b83e382e998c77674cfd0d7428f)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
6a524c08b0 Revert "base: Move BlockedSignal to base sys"
This reverts commit 92ffa564c4.

Change-Id: I98ce7763a5dba804ebbe17a78a9a0af35daca52e
(cherry picked from commit 8558a5dfaee0ef5f683cf932f5abcb197afd730d)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346933
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Steven Moreland
e8bebb22e1 Revert "crosvm: fdt: Add option to dump generated devicetree blob"
This reverts commit 77f6d72395.

Change-Id: I95aef3fd289af0ec748e85faa84151582d43a963
(cherry picked from commit 46e133a9bf823cafacb9511eba5c9c4ae8630185)
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4346932
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-16 18:16:28 +00:00
Lihua Zhao
2b7478aef4 devices: serial: trigger interrupt when set IER
When IER.THRE is set, the hardware should trigger interrupt (the better
way should also examine the LSR.THRE bit, but crosvm always enables
LSR.TRHE, so it doesn't need to check it).

When IER.DRI is set and there is data received that hasn't been read by
a guest, the hardware should trigger a receive interrupt too.

BUG=None
TEST=Run VxWorks operating system on crosvm.

Change-Id: I7b59a7dd84980c0c7b353e346e4c81a02dec4057
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4329111
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-16 08:15:36 +00:00
Alexandre Courbot
e03fcd0bef e2e_tests: add vhost-user vsock tests
Since we are going to refactor the vhost-user vsock device, add some
integration tests to make sure we don't break anything.

BUG=b:217480043
TEST=cargo test -p e2e_tests --test vsock

Change-Id: I2a8eaa6c74f8d86aa164ebd92543fe280bc7906c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4337340
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
2023-03-16 05:14:34 +00:00
Kameron Lutes
6c6966ecfc crosvm_control: Add Build Time C Compilation Check
Adds a build time compilation check for the generated crosvm_control.h

BUG=b:271789981
TEST=CQ, apply crrev/4237140 and observe build failure due to C compile
error

Change-Id: I57867894a975aa0a48f989051bb4243bf97f57e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4333206
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-03-16 00:01:44 +00:00
Daniel Verkamp
4257db1489 hypervisor: remove nmi.pad field from VcpuEvents
This seems to be purely reserved for alignment reasons; the kernel
never touches it, so we don't need to serialize/deserialize it.

BUG=b:266515147
TEST=tools/presubmit

Change-Id: I3074d24f50a8e0e86340c398885c2fbef1410a88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4342173
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2023-03-15 21:43:14 +00:00
Dennis Kempin
b96ba4c8be e2e_tests: Switch to custom kernel config and debian rootfs
We switch from the chromeos-5.10 kernel with crostini configs
to a stripped down config building the mainline 6.1 branch.

This allows us more control over the guest kernel for testing
and significantly speeds up e2e tests (~4s -> 1.2s for all
tests run with nextest).

The rootfs is switched to Debian as that's what we use elsewhere
which makes this easier to maintain.

BUG=b:256652981
TEST=presubmit

Change-Id: Ib3897b8dbf3391eefdb1eedb69ec7555f4c77344
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326888
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2023-03-15 21:09:39 +00:00
Dennis Kempin
9178c0e737 dev_container: Allow kvm access in podman
Most users are not the owner of /dev/kvm, but have access to it
via group permissions.
To ensure that we get the same group permissions on the mounted
/dev/kvm device inside the container, we need to preserve groups
in the container namespace.

BUG=b:273335986
TEST=tools/dev_container --podman x86vm run

Change-Id: Ifb61e6e1ab9af9d237b3e17b9bda7535d16082b2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4341239
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2023-03-15 21:02:37 +00:00
Dennis Kempin
20f0604494 dev_container: Add latest tag when pushing images
This will allow devcontainer.json files to always use the latest
container without manually upreving the version.

BUG=b:273529589
TEST=open dev container in vscode

Change-Id: I71d58eb2936097bd81dfcc0872d362b2c6b9e388
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4341238
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2023-03-15 21:02:13 +00:00
Elie Kheirallah
6abac76996 hypervisor: x86_64: add VCPU_EVENTS support
Add get/set VCPU_EVENTS as required to snapshot the full state of the
VCPUs for suspend/resume.

BUG=b:266515147
TEST=build and run VM

Change-Id: Iabca21b67a0eb9906d2e639a616e3f0826dfa659
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4327459
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Elie Kheirallah <khei@google.com>
2023-03-15 20:15:03 +00:00
recipe-roller
d2015c0d96 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786531012864878401

recipe_engine:
884865acb5
  884865a (olivernewman@google.com)
      [unittests] Remove hack to skip proto compilation

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I321c21888486aad45be24fa9785e88be647aaeb5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4343549
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-15 19:33:48 +00:00
recipe-roller
d523cb9e20 Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786532901934881761

depot_tools:
3971323b1d
  3971323 (bsheedy@chromium.org)
      Remove get_footers patch_text TODO

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Ibd200b13456601c4840497d158df10e4a8844f26
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4342936
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-15 19:04:10 +00:00
recipe-roller
1d58eaa97d Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786534157841021201

recipe_engine:
5da09b3deb
  5da09b3 (yuanjunh@google.com)
      [file] add comments on fileutil listdir method

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: Ibeccd31beded2e13114bea5ed96c094bbe5cdaac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4342933
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-15 18:45:35 +00:00
Daniel Verkamp
4db1316107 devices: virtio-net: use features in queue count calculation
The virtio specification for the network device allows the driver to
negotiate two features related to queue counts:
- VIRTIO_NET_F_MQ enables use of more than one rx/tx pair
- VIRTIO_NET_F_CTRL_VQ enables an additional control queue

The crosvm implementation of virtio-net assumed that the driver would
support both of these features and neglected to check the result of the
feature negotiation process; this would result in the net device failing
to start if a driver did not enable the CTRL_VQ feature and did not
provide the extra queue required when that feature is enabled.
Additionally, if the driver did not negotiate the MQ feature, the device
would fail to start up if the maximum supported number of queue pairs
was greater than one.

Fix both of these issues by checking the features acknowledged by the
driver at activate() time and adjusting the expected number of queues
accordingly. As part of this change, the control queue becomes optional,
and the previous code used the presence of the control queue on a worker
thread to indicate whether to perform interrupt resampling work; this
change splits that into a separate handle_interrupt_resample flag passed
to the worker run() function so that the interrupt is resampled even
when the CTRL_VQ flag is not negotiated.

BUG=b:272536271
BUG=b:164505993
TEST=tools/dev_container tools/presubmit

Change-Id: I3dd65c7b134c75f5fc6881ed33c7b8df83c48c36
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326887
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dmitrii Merkurev <dimorinny@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-15 18:00:07 +00:00
recipe-roller
3fe4fb01ea Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (depot_tools, recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786537305677855729

depot_tools:
892f2ceea5~..3408652be0f95743987e9bbd0cdb033ebfcf8642
  892f2ce (jojwang@chromium.org)
      Fix git_cl tests for DOGFOOD_STACKED_CHANGES=1
  3408652 (jojwang@chromium.org)
      Add push_options to dogfood stacked changes.

recipe_engine:
89ec26cdae
  89ec26c (waffles@chromium.org)
      Reland "3pp: Fix archive extractor to tolerate symlinks."

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I2de6bd15fe96d4483a42bbff643d1b6438b9ac71
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4342929
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-15 17:55:08 +00:00
Isaac Bosompem
59ee40f04c crosvm: Add vGPU/vGPUserver cgroup support
Adds command line options to move the vGPU threads housed within crosvm
and the vGPUserver threads housed externally into separate cgroups.

This will give us the ability to perform some tweaks/experiments
with the affinity masks of these threads as a group.

BUG=b:269139377
TEST=Launch Borealis VM, ensure command line options work as expected.

Change-Id: I558673e616e0344bae2407db1ff693902816daac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4304743
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Isaac Bosompem <mrisaacb@google.com>
2023-03-15 16:25:49 +00:00
Kameron Lutes
8e31d2d5c3 docs: Fix usage of --reset flag for dev_container
The dev_container no longer has a --reset flag and instead uses --clean.
Updates docs to reflect this.

BUG=b:273389824
TEST=cq

Change-Id: Ic8bdf1900a19e525d1150ebc623ab9d6bd2eec09
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4337296
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2023-03-15 00:48:46 +00:00
Zihan Chen
abd53b6a1f crosvm: Trace seccomp filter usage precisely by filename
Add multiple log points to dump minijail's internal data structure
address, this allowes precise tracking of which minijail seccomp
filter is applied to which process/pid.

TESTED=CROSVM_CARGO_TEST_E2E_WRAPPER_CMD="strace -ff --output=/workspace/stracetest" CROSVM_CARGO_TEST_LOG_LEVEL_DEBUG=1 CROSVM_CARGO_TEST_LOG_FILE=/workspace/logtest.log ./tools/bench boot

BUG=b:258316090

Change-Id: Ibc2b66bf18b8af004bb30fd53523161bc9ca1ec4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4316958
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 23:18:39 +00:00
Maciek Swiech
99665d3720 crosvm: remove registered listeners on errors
if a sidecar process does not gracefully unregister their listening
socket we should not keep it around forever.

BUG=b:269609274
TEST=crosvm run example-ubuntu-image
TEST=deploy to dut and launch crostini/arcvm

Change-Id: I2e620d97da8f63dc73c2432146273b112770ca84
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4308039
Commit-Queue: Maciek Swiech <drmasquatch@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 21:59:03 +00:00
Maciek Swiech
be49d27ee7 crosvm: store tubes for registered listeners
we currently store UnixSeqpacket sockets for registered event listeners
- this causes us to clone (and dup) each time we want to send info on
said packets. instead, store the tubes.

BUG=b:269609274
TEST=crosvm run example-ubuntu-image
TEST=deploy to dut and launch crostini/arcvm

Change-Id: Ifeab6d6beeebc8f9171f233e5e8d21aae6d6b9ab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4308038
Commit-Queue: Maciek Swiech <drmasquatch@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 21:14:52 +00:00
Gurchetan Singh
f63214bda1 rutabaga_gfx/ffi: Makefile for rutabaga_gfx/ffi
This creates a makefile for rutabaga_gfx.  Most package managers
seem to still use Cargo to compile, but not packagement.  We need
to install headers and the library.

I looked into to cargo-c, but it was just easier to open code it.

BUG=b:173630595
TEST=sudo make install
     export LD_LIBRARY_PATH=/usr/local/lib
     make and run rutabaga_test

Change-Id: Ibd68ecd0c6215cc36bc104d843847ee47d02123e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4335238
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
2023-03-14 20:21:47 +00:00
Noah Gold
8de14602fe cros_async: document IO completion ports.
BUG=b:272614458
TEST=presubmit

Change-Id: I86ebf2e718378a2efcee4a7dd4eb9813eca20fcd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4335239
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
2023-03-14 20:21:35 +00:00
Daniel Verkamp
0d069fc1e6 base: remove unsafe Tube FromRawDescriptor impl
Nothing calls this code, so it should be okay to remove it.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I5f079dc9e6e15178506b801b7266d8bd0351ddbb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4321329
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-03-14 20:17:25 +00:00
Frederick Mayle
c842b3ee2d cros_async: block_on: simplify errno handling
Change-Id: I9971911239a0c2e1cc0bbebeabc687025d3c2212
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4328233
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 20:09:58 +00:00
recipe-roller
6631cdbd7d Roll recipe dependencies (trivial).
This is an automated CL created by the recipe roller. This CL rolls
recipe changes from upstream projects (recipe_engine) into this repository.

The build that created this CL was
https://ci.chromium.org/b/8786622239459386337

recipe_engine:
e825a80df4
  e825a80 (hypan@google.com)
      Add a new API "list_bots" to swarming recipe module.

Please check the following references for more information:
- autoroller, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#autoroller
- rollback, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/workflow.md#rollback
- cross-repo dependencies, https://chromium.googlesource.com/infra/luci/recipes-py/+/main/doc/cross_repo.md

Use https://goo.gl/noib3a to file a bug.

R=denniskempin@google.com

Recipe-Tryjob-Bypass-Reason: Autoroller
Ignore-Freeze: Autoroller
Bugdroid-Send-Email: False
Change-Id: I1af65549b69bb7f73bcaa4f21a82afaea4cd8307
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4338043
Commit-Queue: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
Bot-Commit: Recipe Roller <recipe-mega-autoroller@chops-service-accounts.iam.gserviceaccount.com>
2023-03-14 19:23:32 +00:00