Commit graph

6062 commits

Author SHA1 Message Date
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
Dennis Kempin
87382d6787 Uprev codespace devcontainer.json
The list of extensions was moved in the latest specs of devcontainer.json

BUG=b:273332464
TEST=This CL is submitted from a codespace

Change-Id: Icae494f8dc4e588f7b642de39f42e8923e245d46
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4338039
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2023-03-14 18:59:59 +00:00
Noah Gold
7e22d900e0 base: fix unsafe overlapped read/write marked safe.
The overlapped wrappers on PipeConnection are unsafe, but they were
marked as safe. There are no actual unsafe production uses of them
because the conventions for overlapped IO generally make that hard to
do. That being said, these wrappers MUST be marked unsafe. This CL does
so and updates the callers with safety statements.

BUG=b:272812234
TEST=presubmit

Change-Id: I0def7056431d5b3b70eb4ce7c6ac8b44aef0a4cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4330490
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-03-14 18:42:38 +00:00
Noah Gold
1806805c06 cros_async: add experimental OverlappedSource.
Following the addition of an overlapped capable executor, here is the
experimental overlapped IO source. This is how we'll request overlapped
IO that runs on the overlapped executor. This isn't ready for production use
quite yet, but it's something we'll want in the future.

BUG=b:272614458
TEST=presubmit

Change-Id: Iaa97cf70924334dbe82d4562f43c0daf8888cb35
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4328234
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-03-14 18:32:52 +00:00
Noah Gold
c15ad34453 cros_async: convert HandleExecutor to use IOCP.
This is a first step towards using overlapped IO (truly async IO) on
Windows. Dead code allows are removed in the next CL, which adds the
OverlappedSource.

BUG=b:272614458
TEST=presubmit

Change-Id: I19e20e957462357cecdabc08757ed44ea662767e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326943
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-03-14 18:24:44 +00:00
Noah Gold
29e018652f base: move read/write wrappers to their own module.
In the future we'll be using read/write wrappers in multiple places,
but the wrapping code currently lives in the named pipe implementation.
This CL pulls it out to its own module. It also brings in some other
code in win_util that wasn't upstreamed.

BUG=b:272614458
TEST=presubmit

Change-Id: I6871f3db6991336f42706652b69935755bf2fbc3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326942
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 18:24:44 +00:00
Frederick Mayle
341a4a6f4f hypervisor: add contact for windows hypervisors
Change-Id: I9288e2cf73996dd7c02e0e870a9c9265acba1dfd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4335694
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
Auto-Submit: Frederick Mayle <fmayle@google.com>
2023-03-14 18:22:46 +00:00
Dennis Kempin
050bc63556 dev_container: Install g++
Required by https://crrev.com/c/4333206

BUG=None
TEST=make -D tools/impl/dev_container

Change-Id: I82c07141bc4b103f66a984edd91abc1631d39c9d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4337397
Auto-Submit: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 18:20:36 +00:00
Peter Collingbourne
bb33d5ef4a aarch64: Forbid --mte with --pstore
--pstore is another flag that creates a shared mapping in the IPA space,
so forbid using it with MTE.

Bug: b:234779841
Change-Id: I2d440e7747eabeeb75a51ec6a2098d9ba6c22765
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4337396
Auto-Submit: Peter Collingbourne <pcc@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 18:19:53 +00:00
Shintaro Kawamura
4fe7944e35 swap: use Lazy::force instead of dereference
As you can see in the doc comment of `Lazy::force()`, `Lazy::force()`
"is equivalent to the `Deref` impl, but is explicit".

BUG=none
TEST=manual test

Change-Id: I77b5e6ab1985e7efe1bdb86eefb5271438c451fa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4333208
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2023-03-14 02:12:16 +00:00
Frederick Mayle
c0e2630d69 docs: add instructions for using the --hypervisor flag
Change-Id: I254603b04b8d05b9410715e52bd7afe2db113458
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4335142
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-03-14 02:00:04 +00:00
Frederick Mayle
35ad1df0c6 hypervisor: add README.md detailing hypervisor support
Change-Id: Ia906b551f0859294670bef340610575328fe36a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326988
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-03-14 02:00:04 +00:00
Wang Ningyuan
3d67441192 Devices: Renaming for BAR reprogram
This CL renames some functions and variables introduced for PCI BAR
reprogramming to avoid confusion.

Test: presubmit tests.
Bug: b:271204121
Change-Id: I77aaca123a677b56da0b45ce78a54e84bec64a59
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4332623
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 01:14:39 +00:00
Daniel Verkamp
afbab80855 book: seccomp: update seccomp policy directory
The seccomp policies are located in the `jail` crate now. Fix the
include path.

BUG=None
TEST=mdbook build

Change-Id: I40049248c83c060c98925b61991d6a83c379b9c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4335147
Reviewed-by: Shin Kawamura <kawasin@google.com>
Commit-Queue: Shin Kawamura <kawasin@google.com>
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
2023-03-14 00:48:33 +00:00
Alexandre Courbot
d0ccdc38b3 devices: vhost: user: make run_with_handler take a request handler trait object
This will be necessary for the next CL, which introduces a closure that
cannot be make generic. Additionally the handler is used at a low
frequency and this limits the amount of generated code (2 generic
parameter leads to a potential explosion of monomorphized methods).

BUG=b:217480043
TEST=send data between the host and a VM connected to a vhost-user vsock device using socat.
TEST=send data between a VVU vsock device inside a device VM and another guest using socat.

Change-Id: Ie5946772a5f21f2c0dd289875a562abbccff6db4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4222843
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-03-13 09:36:51 +00:00
Daniel Verkamp
7784d7dbad devices: vvu proxy: move worker thread out of State
The worker thread handle was part of the State object, and when the
worker thread was exiting, it would change the state from State::Running
(which contained the WorkerThread) to another state, causing that
WorkerThread instance to be dropped. The Drop handler of WorkerThread
joins the thread, which is illegal when called from within the thread
itself, so this caused an EDEADLK error and a panic.

Move the WorkerThread to the top-level VirtioVhostUser structure, which
is only accessible from the main thread, to avoid this problem.

BUG=b:267980534
TEST=Shut down Crostini on brya-manatee

Change-Id: I7dfca3e0a92c97bbd5aad2c48da191b0b1b30461
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4330489
Reviewed-by: Tomasz Nowicki <tnowicki@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
2023-03-12 12:54:03 +00:00
recipe-roller
cf15e2bd27 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/8786956944961432433

depot_tools:
8daa8c5a94~..a9a050c879ef9ff234e9db332569f0c5f9a01715
  8daa8c5 (sokcevic@chromium.org)
      Update repo_launcher to 2.32
  a9a7eec (sokcevic@chromium.org)
      Revert "Extract searching relevat files in utils function"
  e564ebf (yiwzhang@google.com)
      roll lucicfg to 1.38.2
  a9a050c (aravindvasudev@google.com)
      Update banned words flag

recipe_engine:
b12b29b151
  b12b29b (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from 0a1b43bf5869 to 320bf3ed60cd

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: I256127a2bffe5ffaa2e347d268486705da1127b3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4328472
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-11 02:44:15 +00:00
Frederick Mayle
ff42de0098 vm_control: simplify VcpuControl::GetStates plumbing
Instead of wiring up a channel ahead of time, set one up on demand. This
significantly reduces the amount of plumbing required. We'll need more
VcpuControl cases in the near future that require responses like this
(e.g. vcpu snapshotting and restoring) and the extra plumbing for each
in unpalatable.

It isn't obvious what the performance difference is and we don't have a
relevant benchmark. None of the use cases are particularly performance
sensitive yet.

BUG=b:232437513

Change-Id: I96e720065275894ac0eb2965d5f707ec57b19c64
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326945
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
2023-03-10 23:14:41 +00:00
Vikram Auradkar
948735a289 base: upstream overlapped send recv message functions
Upstreams blocking overlapped read/write commmands to base.
These funtions will be used by the broker to forward messages exchanged
between main and service.

Bug: 269191436
Test: none
Change-Id: I029e8c440bb6b8234fe2d1ca3b1dd5ddb408d814
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4329913
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-03-10 23:01:40 +00:00
Daniel Verkamp
98b82e17d7 devices: virtio-input: implement stop
The logic is the same as the existing reset() implementation, but it
also returns the queues with the spec-defined queue indexes.

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

Change-Id: I242ec24fe0fb2207ab097888495e5a92697571e5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4262518
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-03-10 21:47:08 +00:00
Maciek Swiech
d7bfa2dc54 crosvm: reland socket control mechanism
crrev.com/v/4237140 was reverted in crrev.com/c/4310064 due to the
generated header file not defining the RegisteredEvent type. along with
re-reverting the original cl (and corresponding bugfix cl) this patch
introduces a RegisteredEventFfi type which mirrors the original
RegisteredEvent type but should be exposed in the generated header file.

BUG=b:269609274
TEST=sidecar process (patch: crrev.com/c/4276642)
TEST=cargo build, header file inspection

Change-Id: I4a17163e36eb466a540a72d2bb4356419739c974
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4311831
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Maciek Swiech <drmasquatch@google.com>
2023-03-10 18:49:13 +00:00
Dennis Kempin
6d5d075448 Revert "devices: cmos: implement rtc alarm"
This reverts commit 42a437de5e.

Reason for revert: This is crashing if no_rtc is set (http://go/bbid/8787052669966742145/test-results)

Original change's description:
> devices: cmos: implement rtc alarm
>
> Implement CMOS alarm functionality. This allows guests to set rtc
> alarms, which is useful when putting a Linux guest into s2idle.
>
> This change allocates a dedicated interrupt for the goldfish battery,
> instead of reusing the sci irq. Sharing an irq line between a wakeup
> interrupt and a non-wakeup interrupt doesn't work well because the
> non-wakeup interrupt won't be delivered to its driver while the driver
> is suspended, which results in the irq being permanently asserted.
> Simply using a dedicated interrupt for the goldfish battery is much
> easier than adding suspend/resume support to the Linux driver.
>
> BUG=None
> TEST=cargo test -p devices cmos, manual tests w/rtcwake
>
> Change-Id: I757acc64b61e414d5d9df5a1fb4770943ef985bf
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4314184
> Reviewed-by: Elie Kheirallah <khei@google.com>
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: David Stevens <stevensd@chromium.org>

Bug: None
Change-Id: I25737095f84ca0b56d94924a9d8ccb5fd42ff51c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4329909
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-03-10 15:16:27 +00:00
Wang Ningyuan
dda04eda47 Devices: trait implementation for BAR reprogram
This CL adds trait implementation for PciDevice to handle BAR
reprogramming. When BAR reprogramming is detected, the PciDevice checks
all ioevents needed, and requests ioevent registeration for events that
are in the changed domain. The requests are handled by instances of
PciDevice via the trait function ioevent_register_request.
Before the CL, ioevent re-registering is unhandled, and PciDevice is
broken without notification. After CL, an error message will appear, but
device still would not function as the added trait is not implemented.

Test: Presubmit Tests. Hotplugged virtio device triggers error
IoEventNotSupported as expected.
Bug: 271204121

Change-Id: Ibf4bc00cfdce24e508cd50b5009f148c5a49db30
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4310071
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
2023-03-10 04:17:52 +00:00
Norman Bintang
81d02939b1 devices: virtio: snd: Make StreamSourceGenerator as an attribute
Make StreamSourceGenerator as an attribute of VirtioSnd struct. It can
be used to hide backend related field from VirtioSnd. For example when
we have File Backend, we can put the file descriptor in
StreamSourceGenerator, instead of VirtioSnd.

This commit also removes params field from VirtioSnd as it is no longer
used. Test code that still uses params field, like test_virtio_snd_new
is refactored.

BUG=b:233542268
TEST=emerge and call aplay from the vm

Change-Id: I0720c8430f5fbe26830ef141db6dd06b047494eb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4306258
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Commit-Queue: Norman Bintang <normanbt@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-03-10 03:21:11 +00:00
Frederick Mayle
b31f613dbe cros_async: optimize and fix race in drop_detached_blocking_pool
Sometimes the blocking pool worker thread wouldn't start the blocking
task in time before the shutdown sequence. Now it uses a channel to wait
for it to start.

Also, the test took 10 seconds (BlockingPool::shutdown timeout) and
leaked a thread. Now it uses a channel to cleanly shutdown the thread.
Takes 20 ms on my machine. I've verified that the test still fails for
the old, leaky detach implementation.

BUG=b:272587712,b:270986145

Change-Id: Ibcc39a7129deaabbfed8023276da8c6dc48605bc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4327466
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-10 03:06:56 +00:00
Federico 'Morg' Pareschi
8405abf7f5 devices: Add trace points for passthroughfs
This CL adds an initial implementation of trace points for
passthroughfs and also adds an initial stub for tracing our fuse server
implementation too.

BUG=b:261641906
TEST=ran crosvm with virtiofs and saw trace points being hit

Change-Id: I88502f33997db0030c53405b5f9fbed84aabc773
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4110129
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Morg <morg@chromium.org>
2023-03-10 02:20:14 +00:00
Gurchetan Singh
a2b3fcd92b rutabaga_gfx/ffi: patch minijail in FFI build
Fixes build.

BUG=b:173630595
TEST=compile FFI bindings

Change-Id: I24ae363edb1ce46d6f9ae45688d2cb8e78fe31cd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326897
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-10 01:32:15 +00:00
Zihan Chen
6cb96e264b x86_64: fixup: Calibrate TSC when forced to do so
TEST=CQ

Change-Id: I762a33ec8eebb4fb465e008949dbf870e25206c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4327465
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Zihan Chen <zihanchen@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-10 01:17:59 +00:00
Zihan Chen
53c095c75b x86_64: Don't calibrate TSC when unnecessary
Currently crosvm's boot time on x86 is heavily impacted by TSC
calibration, especially on nested-virtualization environment.

TEST=pending

Change-Id: Iadb0b35185172a3e10d5435ff0c8030cf18004d2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4326893
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2023-03-10 00:52:47 +00:00
Dennis Kempin
327fd410d1 prebuilds/testvm: Retry downloads
We occasionally see CI jobs fail due to network flakiness when
downloading prebuilts or the test vm image.
Retry both. This covers:
- Test VM images (i.e. the aarch64 vm image for testing)
- e2e_test guest images
- prebuilt libraries for win64 builds

BUG=b:248568518
TEST=dev_container tools/presubmit
TEST=dev_container --clean tools/presubmit

Change-Id: I8e5e185b17738182738bfcc4420890b925871fde
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4322030
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Zihan Chen <zihanchen@google.com>
2023-03-09 23:04:20 +00:00
Vaibhav Nagarnaik
7e848f215c haxm: fix future incompatibility warning
use of `unaligned_references` will be blocked soon and spits out a
warning during compiling. fix it in haxm.

Test: Compiled and ran with haxm enabled.
Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com>
Change-Id: Ia887cff1ce01e6c14a9cf4978bf49835e996dd5a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4324279
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-03-09 22:01:54 +00:00
recipe-roller
8f37808af7 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/8787134993177817265

depot_tools:
48d8e90bd4
  48d8e90 (sokcevic@chromium.org)
      Revert "Reland "Remove Python 2 support for PRESUBMIT.py""

recipe_engine:
8c7fd431c0
  8c7fd43 (catduncan@google.com)
      [archive] do not create symlinks on windows when unzipping

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: I885d44bb544d0a6cd7b0a3b947e3608ce61834f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4322812
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-09 03:34:38 +00:00