Commit graph

43 commits

Author SHA1 Message Date
Daniel Verkamp
5b5867a2ac metrics: add missing features in Cargo.toml
There are cfg(feature = "...") checks testing "experimental" and
"collect" features, but those aren't declared in Cargo.toml; cargo warns
of this in newer versions, so declare them, even though they're never
enabled in upstream crosvm.

BUG=None
TEST=cargo +nightly build

Change-Id: I9893ec56f6f3362cc73b5e128c836b2a0f0e8e9e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5672327
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-07-03 00:33:08 +00:00
Daniel Verkamp
858c496b09 metrics: fix dead_code warning in test
BUG=b:344974550
TEST=tools/clippy

Change-Id: I73016330a52cdee7d518892d33012c0eb99f4f79
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5609073
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2024-06-10 20:01:23 +00:00
Daniel Verkamp
642f9640b8 metrics: tests: replace .get(N).unwrap() with array indexing
This is more concise and accomplishes the same thing. It also
incidentally avoids a clippy warning about using .get(0) instead of
.first().

BUG=b:344974550
TEST=tools/clippy

Change-Id: Ie8575f63ca7aacd91123c81a6f533b4a2d1408d2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5598299
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2024-06-04 23:47:08 +00:00
Daniel Verkamp
52b8e42869 Cargo.toml: avoid "*" versions for external crates
Ensure that every Cargo.toml dependency on a third-party crates.io crate
specifies at least a major version, or a minor version for 0.x crates,
to ensure that if a new major version is published, it cannot cause API
breaks.

The versions are selected to match the ones already in Cargo.lock, so
this should have no functional change, but it will help prevent new "*"
versions from being introduced via copy-and-paste.

For rationale, see the Cargo FAQ:
<https://doc.rust-lang.org/cargo/faq.html#can-libraries-use--as-a-version-for-their-dependencies>

`minijail`, `audio_streams`, and `cras` are left as "*" for now, since
they have unusual situations (imported from a submodule and/or replaced
at build time with ebuild magic).

BUG=None
TEST=tools/dev_container tools/presubmit
TEST=verify Cargo.lock is unchanged

Change-Id: Ifa18199f812f01d2d10bfb4146b3353c1a76527c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5555656
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-05-22 01:01:42 +00:00
David Stevens
c552254625 metrics: Remove MetricsRequest from vendor API
Instead of deserializing from the metrics tube in the generic
MetricsController code, we can directly pass the readable tube to the
vendor RequestHandler implementation. This allows us to shrink the size
of the vendor metrics API by removing RequestHandler.

This change also makes MetricsController use RecvTubes instead of Tubes.

BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all

Change-Id: Ia1507d5e1c0cdd346d165c968184e9d2bd70314e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400362
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-04-09 01:43:33 +00:00
David Stevens
1dd411950b metrics: Remove downstream metrics dependencies
Add a metrics_event package instead of relying on metric events provided
out of a vendor/ crate. The new API defines the same events as the
existing vendor API, except it removes any dependencies on downstream
details. To allow downstream projects to define their own events, the
new API adds a vendor metrics_event package to support downstream-only
event types.

BUG=b:332466813
TEST=./tools/dev_container ./tools/presubmit all

Change-Id: I766ad6ca2a0a437bb487e27fb84a4984f66c9770
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5400361
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
2024-04-09 01:36:24 +00:00
Andrew Walbran
b9f43931eb Use UTC rather than local timezone for Windows metrics.
BUG=b:326256145

Change-Id: Ifabb377a258c8bb8d492ace505341f8f419af9cb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5340449
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-03-11 11:16:18 +00:00
Andrew Walbran
33c385a24d Update chrono.
BUG=b:326256145

Change-Id: Ia16b88151efa8ad0103324bde6c555c8650ebbab
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5314562
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
2024-03-11 11:16:18 +00:00
Vikram Auradkar
8798b9cd6b metrics: move noop metrics under generic
downstreams will override metrics_product crate

BUG=b:286107739
TEST=none

Change-Id: I90e05289d509c3f3ff85cc3441c89aad3507f0b0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5356287
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2024-03-08 17:45:25 +00:00
Andrew Walbran
3009bf2722 Only use required features of chrono.
BUG=b:326256145

Change-Id: I3c1b5b7bc39ebd190ca9ff74e41efbdc312bde67
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5313721
Commit-Queue: Andrew Walbran <qwandor@google.com>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-02-23 09:51:09 +00:00
Greg Schlomoff
d87e4783d3 Use Duration instead of i64 for the metrics upload interval constant + use Instant instead of DateTime.
`Instant` is monotonically non-decreasing, which makes it a better candidate for this (e.g. avoid bugs when the time changes)

Change-Id: I524991808e852809df28b882373452769504c3de
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5277561
Auto-Submit: Greg Schlomoff <gregschlom@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Kaiyi Li <kaiyili@google.com>
2024-02-07 22:35:14 +00:00
Vikram Auradkar
2768f223ee clippy: enforce safety block comments
BUG=b:316174930
TEST=none

Change-Id: I5c7811b2c548155aa003e4b71a54bbc16e2f2588
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5120567
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-12-14 18:21:54 +00:00
Daniel Verkamp
673a730638 Tweaks to placate clippy single_range_in_vec_init
<https://rust-lang.github.io/rust-clippy/master/index.html#single_range_in_vec_init>

Change-Id: I97cfe03c602630bcdb6c8b270f553c7c62e794d5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5007727
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-11-06 23:36:11 +00:00
A. Cody Schuffelen
4748c54b95 Rename "unix" to "linux" in code and docs
$ for DIR in $(find . -name "unix"); do mv $DIR $(echo $DIR | sed "s/unix/linux/"); done
$ for FILE in $(find . -name "unix.rs"); do mv $FILE $(echo $FILE | sed "s/unix/linux/"); done
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -E -i "s/mod unix/mod linux/g" {}
$ find . -type f -not -path '*/\.git/*' -not -path '*/third_party/perfetto/*' | xargs -I {} sed -E -i "s/([^o][^s])::unix/\1::linux/g" {}
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -E -i "s/use unix::/use linux::/g" {}
$ find . -type f -not -path '*/\.git/*' -not -path '*/third_party/perfetto/*' | xargs -I {} sed -E -i "s/sys::unix/sys::linux/g" {}
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -E -i "s/use unix as platform/use linux as platform/g" {}

Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I2c8acb14d77a5588dab4eae124f4a9afbb9025f5
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909060
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
2023-10-11 01:15:07 +00:00
A. Cody Schuffelen
97dff044f8 Replace #[cfg(unix)] with #[cfg(any(target_os = "android", target_os = "linux"))]
Updates are made to source and documentation.

This more accurately represents the currently supported platforms of
Android/Linux and Windows, without unexpectedly including other
unix-like operating systems.

Command to reproduce:
$ find . -type f -not -path '*/\.git/*' | xargs -I {} sed -i 's/cfg(unix)/cfg(any(target_os = "android", target_os = "linux"))/g' {}
$ cargo fmt

md files manually updated to fix line lengths.

Renaming `unix` modules to `linux` will be done in a later CL.

Test: ./tools/dev_container ./tools/presubmit
Bug: b/298269162
Change-Id: I42c1bf0abf80b9a0df25551613910293217c7295
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4909059
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-10-11 00:43:29 +00:00
Richard Zhang
f10db53402 win_audio: Upstream changes
This includes:
* Audio capture support
* Device listener when no devices are connected
* Various refactors

BUG=b:275406212
TEST=ran tests, presubmits

Change-Id: I2c12ea9e042bc9a966702bb37158b32b1af811b1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4878756
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-10-02 21:13:40 +00:00
Daniel Verkamp
045a3074ef Cargo.toml: add version to chrono dependencies
The newest chrono version is currently on the 0.4.x branch, but there
are preparations to release a 0.5.x version. Explicitly specify a 0.4.x
version in our dependencies since there will be backwards-incompatible
API breakages in 0.5.x.
<https://github.com/chronotope/chrono/issues/970>

The exact version chosen (chrono 0.4.19) matches the version we have
pinned in Cargo.lock currently and will match any newer 0.4.x releases,
so there should be no functional change.

BUG=None
TEST=cargo build

Change-Id: Ifa24a547e435ab4987be9358343e6b25c1385c66
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4774870
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-08-11 21:02:25 +00:00
Vikram Auradkar
373aaa6edb metrics: upstream local metrics related changes
These metrics allows to measure io related performance.

BUG=b:286107739
TEST=none

Change-Id: Ieb0920a239e0e5d952ef51210393350ca34ee611
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4601851
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2023-06-13 21:57:14 +00:00
Dennis Kempin
4cd4043fd1 Upgrade to 1.68.2: Fix clippy nits
The new rust toolchain comes with improved clippy warnings that
catch more unnecessary casts than before.
Some cases have to be whitelisted since libc types have varying size
based on the architecture we are compiling for.

BUG=None
TEST=presubmit

Change-Id: Ia473b0bfe6e74bdb7b0d4ca15d2c9fb410fc353e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4568144
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-05-25 18:28:14 +00:00
Daniel Verkamp
a360baa819 Cargo.toml: upgrade protobuf 2.x -> 3.x
system_api bindings have been regenerated with protobuf 3.2; this should
be okay to land before the full ChromeOS system_api migration, since
crosvm always uses its own copy of the bindings rather than the ones
provided by the dev-rust/system_api package.

The protoc-rust crate is replaced with protobuf_codegen in 3.x.

BUG=b:277243607
BUG=b:279834784
TEST=tools/dev_container tools/presubmit

Change-Id: I6aad45ded2639d7506a7238800584bebab196455
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4405309
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2023-04-28 19:32:01 +00:00
Idan Raiter
f1c283e4b6 metrics: Add missing process types
Downstream we've added the SPU + Broker process types, this should be
reflected here to avoid numbers going out of sync.

Also adds sound type.

BUG=b:269313507
TEST=presubmit

Change-Id: I5e3e269c9aca7bc9504e3e822302bcccf3bf377f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4246713
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
2023-02-22 20:01:38 +00:00
Vikram Auradkar
cfcd16f94c kiwi: clean anti_tamper and metrics related code
BUG=b:260601120
TEST=NONE

Change-Id: If356c731ea9b03b6266f1263b660bc75db452511
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4133828
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-01-04 00:08:27 +00:00
Daniel Verkamp
ac0fc378a3 Fix remaining Chrome/Chromium OS instances
These should be written as ChromeOS and ChromiumOS (without the space)
to match the updated branding. The copyright headers were already
migrated to the new style (https://crrev.com/c/3894243), but there were
some more instances left over.

BUG=None
TEST=tools/cargo-doc

Change-Id: I8c76aea2eb33b2e370ab71ee9b5cc0a4cfd00585
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4129934
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-01-03 22:14:30 +00:00
Idan Raiter
21e083a108 device: vhost-user: Bring up Windows GPU
Brings up the Windows vhost-user GPU, when there is a vhost-user flag.
Otherwise, uses the original worker in the main process.

- Creates backend and VMM configs in broker.

- Always passes the VMM config to the main process.

- Passes backend config either to main or the vhost-user process.

- Create exit read / write event pair in broker, so GPU can request it
  from its process (on Windows, when we close the rendering window).

BUG=b:243061269
TEST=downstream / presubmit

Change-Id: I373e59e936bc21580e7962942742750444807093
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3968458
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-11-21 20:05:59 +00:00
Noah Gold
ea5ffed771 metrics: migrate to proto_build_tools.
BUG=b:256951877
TEST=builds

Change-Id: Iea6ab37489e87b1c8ca3c33fbf4a0d974a9b59ca
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4021591
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-11-12 01:02:23 +00:00
Vikram Auradkar
afcaa35ab8 crosvm: Fix windows clippy warnings
BUG=b:257249038
TEST=CQ

Change-Id: Iffb53295fbe64b31b4f68e217f6b522e4231e61c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3993933
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-11-03 18:36:29 +00:00
Dennis Kempin
278e5ffeba test_runner: Add separate cargo target dir for each platform
Using the same CARGO_TARGET_DIR for all builds prevents us from
building for platforms in parallel, since cargo will lock the
directory to only run one build at a time.

Use the same directory for clippy as well, and ensure that
clippy won't invalidate caches created by run_tests.

This reduces the build time for tools/presubmit by about 50%.

Another advantage is that rust_analyzer and run_tests will no longer
block each other or invalidate the cache when run with different
feature flags.

Note: This introduces two subtle changes to the build that required nit
fixes:
- build.rs files are now run through clippy as well
- common/* crates are now also built for the target architecture instead
  the host.

BUG=None
TEST=tools/presubmit

Change-Id: I8da9ef53418c0b15827d512a04e77828621aef88
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3984416
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-10-31 21:33:33 +00:00
Frederick Mayle
3d4b4809ba base: cross platform Event API
Trying to reconcile the difference between the linux and windows
implementations.

Code relying on the eventfd count must now use the linux specific
`EventExt` interface.

BUG=b:231344063
TEST=presubmits

Change-Id: I14eb50f7a02d766a00f27aca388823309633e193
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864030
Commit-Queue: Frederick Mayle <fmayle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-10-19 20:17:42 +00:00
Daniel Verkamp
b60140b37e tree-wide: use "crosvm" capitalization everywhere
Fix a few stray references to "CrosVM" and "CrosVm" so that we refer to
the crosvm project with consistent capitalization.

BUG=None
TEST=None

Change-Id: If5c3c131774d6e5da1d27466810642aec3cb42ac
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3938640
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2022-10-07 01:10:12 +00:00
Pujun Lun
dd2c0a932a crosvm: move enum ProcessType to win_util.
This is to keep consistency with Windows downstream code.
The conversion from ProcessType to EmulatorProcessType is moved to
the metrics crate as it is only used for generating metrics.

BUG=b:213146388
TEST=presubmit

Change-Id: Ia62f76835a1f162dd8bbc9e53fd671968c368473
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3908370
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Pujun Lun <lunpujun@google.com>
2022-09-21 19:28:49 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +00:00
Dennis Kempin
78f62a44e7 Update copyright header check to cover all files
generated files and a list of excluded files are skipped.
Others are fixed to include the missing header.

BUG=b:246579983
TEST=./tools/health-check --all copyright_header

Change-Id: I13e9bf79df18789f1ed4b83fc47c0c2e080d70a8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894240
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-09-13 18:41:29 +00:00
Vikram Auradkar
5d264785c8 crosvm: resync with downstream after running clippy
BUG=b:243099012
TEST=presubmit

Change-Id: Ia910932344c58979c6735776797139e3a1ee9428
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3846056
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Tested-by: Vikram Auradkar <auradkar@google.com>
2022-08-25 20:45:12 +00:00
Dennis Kempin
7a4d4d6b2a health-check: Add check for newline at ends of files
Fixes a couple of files that were missing them.

BUG=b:242605601
TEST=./tools/health-check --fix

Change-Id: I620d6a939cb824e014002152584aacfc5dfdf7e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3835648
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-08-18 00:17:04 +00:00
Vikram Auradkar
dd7ef550dc crosvm: resync crosvm windows
Brings in changes from downstream.

- Reintroduce generate_catchall_args.
  - This code will be deleted soon
- Fix clippy warnings.
- Conditionally compile feature specific changes.

BUG=b:213146388
TEST=The code compiles downstream.

Change-Id: Ic8192b84f5677d1b5f9b2a2c80df20645b1dfab3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3794523
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-07-29 20:56:41 +00:00
Dennis Kempin
4fea399df9 Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.

Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.

BUG=b:239937122
TEST=CQ

Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-28 00:15:50 +00:00
Vikram Auradkar
2314c4701b crosvm: Fix drift
BUG=b:213146388
TEST=presubmit

Change-Id: I59e6b7ad7aff8d4659c62e310a7955146a10d743
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777405
Tested-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Auto-Submit: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-07-21 23:13:18 +00:00
Daniel Verkamp
000cee6a9e metrics: add is_initialized() stub
This is used in src/sys/windows/main.rs.

BUG=b:213152497
TEST=Attempt to build crosvm bin crate for Windows

Change-Id: Ia49b9925a85ed738bcc6a229efd79840e9fd6c72
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3777069
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-21 17:11:00 +00:00
Daniel Verkamp
19fc097eb8 crosvm: replace lazy_static with once_cell
We depend on both lazy_static and once_cell, which do basically the same
thing.

The once_cell crate has a few advantages:
- once_cell is on track to be included into libstd.
  (https://github.com/rust-lang/rust/issues/74465)
- once_cell doesn't require macro magic.

Replace the uses of lazy_static with their once_cell equivalents so we
don't need to pull in both crates.

BUG=b:236191006
TEST=tools/presubmit --all
TEST=tools/run_tests --target=host --arch=win64 --build-only
TEST=cargo test --features=plugin

Change-Id: I7cabcd837ef4878e8e8ae635bb4f235a58e4cae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3707624
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-06-21 23:40:55 +00:00
Daniel Verkamp
d4505a7f1c base: replace PollToken with EventToken tree-wide
Pull the declaration of the `EventToken` enum up to the top level of the
base crate, replacing the identical implementations inside sys/windows
and sys/unix.

Use the `EventToken` name consistently throughout the tree to remove the
unix-flavored "poll" nomenclature.

BUG=b:213153157
TEST=tools/dev_container tools/presubmit --all

Change-Id: I0ba42037b533b796797a7a3f6d8d7e71a5592aba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3642673
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
2022-06-02 22:30:38 +00:00
Michael Hoyle
c29271e168 Revert "Revert "metrics: Add metrics crate.""
This reverts commit 55a5c8d8f9.

In order to accommodate the removal of the
UnixSeqPacket+CloseNotifier change, I updated the controller.rs
to reference platform-specific internal implementations.

On Windows, CloseNotifier is used to detect closed Tubes.
On Linux, we rely on PollContext returning because the socket fd
    is hung up.

Some minor adjustmets to the code were made just to allow as
litte duplication as possible.

In the end, very little logic has changed from the original CL,
it's just moved around.

TL;DR:
This fixes the downstream regression by removing its dependency
on the breaking changes to base.

BUG=b:232316549
FIXED=b:232316549
TEST=Crosvm tests

Change-Id: I946d5096f7a312538c3c694950697fab1be7f0ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3661257
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-25 04:45:13 +00:00
Shao-Chuan Lee
55a5c8d8f9 Revert "metrics: Add metrics crate."
This reverts commit 4c2017c757.

Reason for revert: dependency crrev.com/c/3622798 caused regression

Original change's description:
> metrics: Add metrics crate.
>
> This crate is effectively a collection of stubs in this repo,
> but will allow a downstream repo to implement those stubs.
>
> BUG=b:213152497
> FIXED=b:213152497
> TEST=build + kokoro
>
> Change-Id: I3c544644ec3d7917f9ebb2e8621042c35b556db8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622799
> Reviewed-by: Noah Gold <nkgold@google.com>
> Commit-Queue: Michael Hoyle <mikehoyle@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>

BUG=b:213152497,b:232316549
TEST=CtsAccessibilityServiceTestCases

Change-Id: Idd636d7d34e68977fffc1f6c0a89924eb7be5d54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3641218
Auto-Submit: Shao-Chuan Lee <shaochuan@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Michael Hoyle <mikehoyle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-05-12 16:31:51 +00:00
Michael Hoyle
4c2017c757 metrics: Add metrics crate.
This crate is effectively a collection of stubs in this repo,
but will allow a downstream repo to implement those stubs.

BUG=b:213152497
FIXED=b:213152497
TEST=build + kokoro

Change-Id: I3c544644ec3d7917f9ebb2e8621042c35b556db8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3622799
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-10 03:52:13 +00:00