Commit graph

7885 commits

Author SHA1 Message Date
Federico 'Morg' Pareschi
f1829e78f4 usb: refactor transfer structs for multi backends
The original usb transfer implementation assumes usbdevfs semantics and
relies on the usb_util crate. With this refactor we abstract the
semantics so we can support different backends and more generic
transfers that only care about allocating transfer buffers and passing
around generic callbacks.

BUG=b:307660802
TEST=built and tested USB functionality on a DUT is unchanged

Change-Id: If31beac94642d4fc63a51f2ac39514998abef536
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065368
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Commit-Queue: Ryuichiro Chiba <chibar@chromium.org>
Auto-Submit: Morg <morg@google.com>
2023-11-30 10:17:44 +00:00
Joe Hattori
e68276c609 devices: virtio: scsi: Change the queue size.
Currently the queue size of virtio-scsi device is set to 256, but the
FIO performance result improved on a larger size 1024. This commit
changes the queue size to 1024 given the performance increase.

BUG=b:300042376
TEST=tools/presubmit

Change-Id: Iad29541436e9a0c2f9acd2587e3bb9ae5e4110cf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5067394
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-11-30 06:55:53 +00:00
Daniel Verkamp
9d054ab7b1 devices: vhost-user: console: clean up arg parsing
SerialParameters implements FromKeyValues, so it does not need a custom
from_str_fn to be parsed.

Additionally, fix a typo in the multi-port error message.

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

Change-Id: If72b325c0ab4422dfce9381e78e06fbd25943e5d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5053920
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-30 01:33:28 +00:00
Frederick Mayle
0ec42b028f hypervisor/README.md: add qualcomm contacts for gunyah
BUG=b:308979341

Change-Id: I3e75e3a7e69d07cefa756403286acecd10f239e2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5072116
Reviewed-by: Elliot Berman <quic_eberman@quicinc.com>
Reviewed-by: Steven Moreland <smoreland@google.com>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Commit-Queue: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Frederick Mayle <fmayle@google.com>
2023-11-29 19:20:17 +00:00
Frederick Mayle
2db5f6e4c0 vmm_vhost: remove type parameter from PlatformConnection
It only handles bytes and FDs now.

Change-Id: Ie28ee94c04d9fcd34b9803581ff0e0f087555fce
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5073072
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-29 19:11:59 +00:00
Frederick Mayle
e71368498f vmm_vhost: simplify backend request connection creation
The connection type is no longer polymorphic, so there is no need to
thread the file descriptors through an existing connection instance.

The SAFETY comment isn't very satifying, but at least it is closer to
the code that makes the assumption now.

Change-Id: I2b040c2d56c17bddec856fa91da15b9b8cdd62eb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5069045
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-29 18:51:27 +00:00
Dennis Kempin
73aed77b49 Run rustfmt on whole codebase with nightly enabled
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>
2023-11-29 18:41:29 +00:00
Dennis Kempin
a5b5e4b9a6 Enable rustfmt nightly in container and CI
This enables nightly rustfmt features in CI so we can keep a consistent
imports style.

The resulting formatting changes are in the follow-up CL and will
need to submit together.

This change also uncovered a bug from a previous commit that caused only
the first command in a series to be waited for. Formatting issues would
not be reported by the tool. The bug is fixed as part of this CL.

BUG=b:302055317
TEST=dev_container presubmit format --no-delta

Change-Id: I5d50609cc89d7e78bce66db120737a302f5c57e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4950268
Reviewed-by: Zihan Chen <zihanchen@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-29 18:41:29 +00:00
Andrew Walbran
f3dbf20eed rutabaga_gfx: Uprev nix to 0.27.1
The new version of nix uses OwnedFd in various places, which allows us
to have less unsafe code.

TEST=CQ
BUG=b:293289578

Change-Id: I61aa80c4105eaf1182c5c325109b5aba11cf60de
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5072293
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-29 18:36:53 +00:00
Zihan Chen
8821e8f414 jail: Generate fresh syscall frequency table
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>
2023-11-29 00:45:52 +00:00
Frederick Mayle
862d4709c9 vmm_vhost: rename Endpoint to Connection
Change-Id: If7e8a845a50d09c5ee2bdfe1e807121d835b1431
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068400
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-29 00:02:34 +00:00
Frederick Mayle
78a0f3d042 vmm_vhost: mark Endpoint as !Sync
It isn't safe to send or recv messages concurrently. The byte stream
could get mixed up.

Change-Id: I27039d3f44d5d8ec609ce7974c6f2f3fcbd9768c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068397
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 23:26:47 +00:00
Frederick Mayle
6bfa3f6ce9 vmm_vhost: simplify header reads in Endpoint
Change-Id: Ic287525c91d5890bb5a09fcbe6c872ea427cb677
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066132
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 23:26:47 +00:00
Frederick Mayle
e44284f9de vmm_vhost: tidy up Endpoint API
`Endpoint` has mixture of raw socket methods and vhost-user message
framing methods. This CL hides all of the raw socket methods so that the
type is focused on message framing.

The recv methods' names were changed to more closely match the send
method names. The documentation for returned errors has been deleted
because much of it was out of date.

Change-Id: I55a4f8bea5902fafd8b52468e140de5aa61c5539
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066131
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 23:26:47 +00:00
Frederick Mayle
620687c9dc vmm_vhost: remove more unnecessary &mut self
Follow up to https://crrev.com/c/5064382.

Change-Id: I0d723f765be4b846b0feb679d8e86d423d56345a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068396
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-28 23:26:47 +00:00
Daniel Verkamp
93bb2d9058 vmm_vhost: remove unused SystemListenerExt
This was only implemented for unix and is never called anywhere. The
listener code just calls SocketListener.accept() directly, and Windows
does not implement a Listener anyway, so this doesn't help abstract
anything.

Change-Id: I44503e37bccfd180101a91879abc592242187979
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068395
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 23:08:33 +00:00
Frederick Mayle
d63f9eea7c vmm_vhost: fix type complexity clippy warning
Change-Id: I0522ac1143f35f9045af6f9489d77ca6e47a19b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066130
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-28 22:30:56 +00:00
Frederick Mayle
50cbe0cade vmm_vhost: inline Endpoint::recv_data
Convenience methods like this aren't worth the mental overhead IMO.

Change-Id: I2c08cf64b781328f515b88373170c4506058814c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066129
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 22:30:56 +00:00
Frederick Mayle
98e465673b vmm_vhost: inline Endpoint::recv_body_into_buf
It isn't well differentiate from the other methods and inlining it is a
net win in lines-of-code.

Change-Id: I829a96dc4de5f4ee579b1a5beb9b09efddfdcd53
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066128
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 22:30:56 +00:00
Frederick Mayle
bc9058e05f vmm_vhost: move unexpected EOF check into Endpoint::recv_into_bufs_all
This changes the behavior of `Endpoint::recv_body_into_buf` a bit, but
it is only used by a test and the new behavior within the test is
equivalent (if something goes wrong, the `Result::unwrap` will fail
instead of an `assert_eq!`). I'll try to delete that method in a follow
up.

Change-Id: I6a25fb1329575fb641720a43bbb29b53f0996a6d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065427
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 22:30:56 +00:00
Frederick Mayle
f7d5f0b401 vmm_vhost: move unexpected EOF check into Endpoint::send_iovec_all
Change-Id: I53fa9af5c2ff7c5515092c467943688aaaba5230
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065426
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
2023-11-28 22:30:56 +00:00
recipe-roller
0d66d9aaaa 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/8763150702986682577

recipe_engine:
f91d29f252
  f91d29f (iannucci@chromium.org)
      [recipe_modules/buildbucket] Remove futures/six/past usage.

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: I049bd1525de3dfb0315852ee2435dd9d888c4da9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5067090
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-11-28 21:19:27 +00:00
Pujun Lun
165acb2e03 gpu_display: add Surface implementation for Windows.
This is where we process host display events, such as window size
change and mouse input events. MouseInputManager etc are currently
no-op. Their implementation will be added later.

BUG=b:306024335

Change-Id: Ib67fd64894bd8c9f47cf2ee3cdf2a20901defe3b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5053935
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Pujun Lun <lunpujun@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-11-28 20:04:06 +00:00
Daniel Verkamp
cc6191d72c vmm_vhost: remove dead code in frontend
protocol_features and protocol_features_ready were set but never read.

hdr_flags could only be set via set_hdr_flags(), which was never called.

as_raw_descriptor() was only needed for a unit test, which can peek into
the innards of the struct instead, resolving a TODO about its purpose.

BUG=b:221882601

Change-Id: Ic5fbe9353aa3de92b8413b04bfbe16fdc7e5dd0a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065409
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 19:38:11 +00:00
Daniel Verkamp
eab655cc92 vmm_vhost: remove Master lock
The Master struct previously contained an Arc<Mutex<MasterInner>>, but
the only user (VhostUserVirtioDevice) did not need the thread safety
guarantees of a mutex (neither Sync nor Send is necessary). A few
functions on Master used the mutex for inner mutability, but these can
be fixed by just making the functions in question take &mut self instead
of only &self.

Change-Id: I09f344b15c172f4bb671ab3bbd76b2be4614de6d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5064382
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2023-11-28 19:33:29 +00:00
recipe-roller
917c98ab89 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/8763162029948647953

depot_tools:
f2f8be1ca8
  f2f8be1 (sokcevic@chromium.org)
      [pylint] Use correct variable name

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: I205da7b7b725c7151841858f347482301150c9b7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5068393
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-11-28 18:19:23 +00:00
Zihan Chen
a6963fa305 fixup: tools: Fixing merge bot no dir found error
For some reason, when running in production CI the merge bot
script can't find directories created inside the container. This
is the best explanation I can think of for the error I see in CI
log. This CL moves `mkdir` for all directories host need to access
to run from host.

BUG=b:181105093
TEST=untested, as led can't reproduce this issue

Change-Id: I9b10838c06c32ff607b98e21616f09c4b96392f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5064383
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2023-11-28 14:56:38 +00:00
recipe-roller
f53d54d6ef 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/8763189082673309217

recipe_engine:
2c98ffa51c
  2c98ffa (chromium-autoroll@skia-public.iam.gserviceaccount.com)
      Roll CAS Client from e3def72641fe to 1ea45c182951

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: Ifc9686560f6711eb349b9fceb93f75b8cafb258c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5066142
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-11-28 11:12:04 +00:00
recipe-roller
1a3e15e253 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/8763202924944203985

recipe_engine:
3586c437a4~..49696b810942f00f7ad460fb21cc37bb95c37bdc
  3586c43 (bryner@google.com)
      Use packaging_legacy to preserve the behavior of the version mo...
  49696b8 (mwarton@google.com)
      resultdb: roll recipe protos to latest version

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: Ib889505bda62b46c0e3903687922017d00135fc0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5064385
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-11-28 07:26:32 +00:00
recipe-roller
2773efa2bd 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/8763206054960073105

depot_tools:
ed596dadf9
  ed596da (tikuta@chromium.org)
      Revert "autoninja.py: disallow external account from corp machine"

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: I6cebefa28ed5c9486a9eb04b9ade515e4fbfb272
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065419
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-11-28 06:43:46 +00:00
recipe-roller
6a29a93f89 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/8763207954384216481

depot_tools:
0d0f28a4fc
  0d0f28a (tikuta@chromium.org)
      autoninja.py: disallow external account from corp machine

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: I3f2a83aea4e10ec41f76d436b9eaa623ec24eefd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065418
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-11-28 06:16:17 +00:00
Shintaro Kawamura
a32edfdedb swap: pack page states into 32 bit integer
Option<(usize, bool)> is 16 bytes per item and FilePageState was 16
bytes.

Since we can assume that guest memory size is not that big, page id can
fit in 31 bits.

The metadata size for the swap file is 1MB per 1GB of maximum guest
memory, plus 1MB per 1GB of swapped data.

BUG=b:312072150
TEST=tast run -buildbundle=crosint $DUT arc.SwapAppLatency

Change-Id: I35937fca7800adc14a18720d2722b738bafe2290
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5048213
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
2023-11-28 04:55:21 +00:00
Shintaro Kawamura
786a4deb64 swap: store pages into compacted swap file
This commit fixes a bug that causes a significant delay when logging out
of an account. The bug occurs because:

* Simple file formats can have many holes, which results in a large
  number of discard commands being issued when the file is deleted.
* crosvm implements a mitigation to slow down file size reduction, but
  the crosvm process terminates when logging out, causing the swap file
  to be deleted simultaneously.

To fix this issue, we compact the data and store it at the beginning of
the file.

BUG=b:312072150
TEST=tast run -buildbundle=crosint $DUT arc.SwapAppLatency

Change-Id: If29611daa1a1eda49a87fdad13541a23a8dcdcf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5043882
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
2023-11-28 04:55:21 +00:00
Shintaro Kawamura
bcfe0fe56b swap: use single SwapFile for multiple regions
Calculate the page index in a file at page handler layer instead of swap
file layer.

This helps to migrate the swap file to be compacted in the next CL.

BUG=b:312072150
TEST=tast run -buildbundle=crosint $DUT arc.SwapAppLatency

Change-Id: If895f943e2bfe8072e46c3172974ea3edb0f7853
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5040208
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
2023-11-28 04:55:21 +00:00
Tiffany Yang
345f0cb854 fuse: Update SAFETY comments
BUG=none
TEST=none

Change-Id: Ie09967e8eb51f9479ed5dc299a104f87a8d21180
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5064108
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Tiffany Yang <ynaffit@chromium.org>
2023-11-28 02:32:25 +00:00
recipe-roller
deabbd875e 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/8763223685668044065

depot_tools:
0acc468d8b
  0acc468 (sokcevic@chromium.org)
      Trigger recipe roller

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: Ia8bf8721149d21f4e108f0cf432c579423aac13c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5065388
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-11-28 02:04:42 +00:00
recipe-roller
b9761d7d0c 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/8763226202377373393

depot_tools:
a52cc055e4
  a52cc05 (sokcevic@chromium.org)
      pylint: Add pylint 2.17

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: Ib1ea6cf16c5dcbcffab459ae97a3338bdcc8893b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5064381
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-11-28 01:40:07 +00:00
Daniel Verkamp
d34b36c693 vmm_vhost: VhostUserMemoryRegionInfo cleanup
The mmap_handle and mmap_offset fields are not optional, so the comments
are adjusted to match reality.

Only one test function needed the Copy, Clone, and Default impls, which
can be avoided by tweaking the test (while also making it more useful,
since it tests exactly one failure instead of multiple).

BUG=b:221882601

Change-Id: Icc45577435aa27b18384cd10cb273c5152ad55ac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5063681
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2023-11-28 01:26:48 +00:00
Daniel Verkamp
f28c1d3bc8 vmm_vhost: rename linux modules back to unix
The "Linux" code depends only on AF_UNIX sockets, which should be
available on any unix-like platform.

Change-Id: Icced9594bf61215fce39e2702cf2aeed86ea42a4
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5063680
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 01:26:48 +00:00
Daniel Verkamp
fca49a3980 vmm_vhost: remove vmm and device features
crosvm always enables both of these features, and the crate doesn't
build properly without them enabled anymore due to our local changes, so
just drop the features and all cfg checks for them.

TEST=(cd third_party/vmm_vhost/; cargo test)

Change-Id: I02f9caca387846dd24d9486284b064897f275205
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5063679
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 01:21:42 +00:00
Noah Gold
a893d98c17 devices: snd: implement vhost-user snap/restore.
Ports the implementation of snapshotting from virtio-snd to vhost-user's
virtio-snd. As part of getting things working, a few bugs were
identified and fixed:
* start_queue was throwing away the event queue. This means we can't
  then return that queue back in stop_queue, which is critical for
  snapshotting. Now we retain the queue.
* stop_queue removed each worker twice, which was guaranteed to fail.
  Now we just remove the worker once.

BUG=b:308890529
TEST=verified audio works across a snapshot/restore.

Change-Id: I661b69327c6630d49700ccf37bb8944c95153380
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5054421
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 01:15:10 +00:00
Noah Gold
4a994d90ba devices: virtio: vhost-user: add stop failure logs.
In a recent CL, we found that errors from stopping a queue were being
swallowed by the vhost-user middleware. This CL adds some logging to
cover this case.

BUG=b:308890529
TEST=used new logging to debug an issue.

Change-Id: I83a89e542d79ae0fcc4ff430c90edb5fc4335497
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5054420
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-28 01:11:44 +00:00
Zihan Chen
fda3cfc61f tools/merge_bot: Generate PGO profile at merge
Merge bot will now automatically run crosvm benchmark suite and
produce merged profile data file for PGO use at each merge commit
generated on Monday.

As profile data functions with snapshot of code and generating
them requires a non-trivial amount of compute, we decided on
generate profiles at each "natural" snapshot point (cros merges)
instead of each commit, and thus `merged.profdata` will not be
available in upstream repository.

We decided against generating profile at every merge to avoid
bloating cros repository. The profile is also compressed
with xz to reduce its footprint.

TEST=./tools/chromeos/merge_bot --verbose update-dry-runs origin/main
TEST=https://luci-milo.appspot.com/swarming/task/662c0e8432332c11

Change-Id: I0787f3e01b9a83e9e53f36c36cda1a043ceee0d8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5038001
Commit-Queue: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-11-28 00:52:26 +00:00
Keiichi Watanabe
6b6edff308 cros_tracing_analyser: Change the "list" output format to CSV
The current output of the "list" subcommand is like:
```
\#1: create: 1234 usec
\#2: mkdir: 567 usec
```

This output format is not so easy for futher processing.
Also, it doesn't contain how many times a result is sent.
So, this CL update the format to the following one:
```
name,total (us), count
create, 1234, 400
mkdir, 567, 89
```

BUG=none
TEST=cros_trace_analyser list --input trace.dat

Change-Id: Ia0e0d2d9777e8ba7431a8b90e8ec54e65d242166
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5061774
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Morg <morg@google.com>
Reviewed-by: Morg <morg@google.com>
2023-11-28 00:50:26 +00:00
Frederick Mayle
24bfd9a07b vmm_vhost: delete unused associated type Listener::Connection
Change-Id: Icb5e24959d0ed12fe8c06072b20d8b72ebd11a25
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4844143
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 23:04:14 +00:00
Frederick Mayle
526e886f98 vmm_vhost: rename unix Listener impl to SocketListener
Also, switch `run_with_handler` to use the concrete type since it is in
a unix only file already.

Change-Id: I512d582ee5407f2e3b830ac8c5caaae12c714c15
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4844142
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 23:04:14 +00:00
Frederick Mayle
4fa985cf0a vmm_vhost: turn Endpoint into a concrete type
Since VVU support was dropped, there is now only one Endpoint
implementation (per platform) and so we can remove the related
generics.

Change-Id: Ica35a93dc43326ecb182e0ddeb80cba98f68fb2d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4844141
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 23:04:14 +00:00
Frederick Mayle
0419cd9401 vmm_vhost: rename unix Endpoint impl to SocketEndpoint
This matches the Windows Endpoint naming (TubeEndpoint) and helps avoid
confusion with `trait Endpoint`.

Change-Id: Idd3d8c84e995e38dad68848c8bd5b2188f619485
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4844140
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 23:04:14 +00:00
recipe-roller
0bf7df47ec 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/8763238785707095633

recipe_engine:
c12bd68609
  c12bd68 (mohrr@google.com)
      [path] Use os.makedirs(exist_ok=True)

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: Ieead4c877590e60767ced58b27ba5bea1f4a4615
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5063674
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-11-27 22:00:02 +00:00
Daniel Verkamp
fcc28f5573 data_model: move IoBuf and VolatileMemory to base
IoBuf is defined in a platform-specific way (it is either iovec on unix
or WSABUF for windows), so it fits into the mission statement of the
base crate, which is meant to be *the* platform abstraction layer in
crosvm.

IoBufMut and VolatileMemory/VolatileSlice are defined in terms of IoBuf,
so they are also moved into base for consistency. Every crate that uses
these types already depended on base, so no extra dependencies are
added, and a few can be removed.

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

Change-Id: I4dddc55d46906dfc55b88e8e6a967d7e1c1922dd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5046605
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-27 21:42:49 +00:00