Commit graph

19 commits

Author SHA1 Message Date
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
Daniel Verkamp
04ac514618 cros_tracing: use Mutex<Option<..>> for trace marker file
This gets rid of the extra OnceCell complexity, since we can now
statically initialize a Mutex.

Also switch to our sync wrapper to avoid the unwrap() calls when locking
the Mutex.

Change-Id: I2b2166135875bc4e5bdad8fca694b4584dd79c4b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5320344
Reviewed-by: Morg <morg@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2024-02-27 00:42:58 +00:00
Kaiyi Li
c28067d1d9 Reformat comments
Test: presubmit
Change-Id: I39c261d9985989873b698213c5d8b653fc13757b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5299850
Auto-Submit: Kaiyi Li <kaiyili@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2024-02-15 23:30:13 +00:00
Noah Gold
9d51088b78 cros_tracing: fix interface drift.
The interface of trace_marker & noop drifted from the Perfetto
interface. This CL re-unifies the interfaces and cleans up some
parameter types that were too permissive.

BUG=b:314218142
TEST=builds on both platforms.

Change-Id: I5b2da1f6de8e1df5cab6a0a434f3135b16f1f3c3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5080936
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-12-02 00:02:41 +00:00
Joe Hattori
ec26085d6b devices: virtio: Add trace points to virtio-blk and virtio-scsi
This commit adds tracing points in virtio-blk and virtio-scsi, so that
developpers can easily measure the performance of each commands.

BUG=300042376
TEST=tools/presubmit

Change-Id: Iaae2912505c6e224fa1fe587fb51c97838ecb66b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5035879
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Joe Hattori <hattorij@google.com>
2023-11-16 11:34:15 +00:00
Pujun Lun
7eac9a86c7 Add AOT for GPU display.
This will record the thread/window messages flowing through our message
pump. It could help debug window not responding issues like b/264846691.

TODO(b/252870196):
Add freeze detection and trigger simulated crash reports.

Bug: 264846691
Test: Triggered crash reports and checked the generated traces
Change-Id: If7a9fc4da40ed5b56cb7eff40e2680eccf0c6150
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4804800
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Auto-Submit: Kaiyi Li <kaiyili@google.com>
2023-09-20 17:17:11 +00:00
Federico 'Morg' Pareschi
b3b0e3dadb devices: replace usb_debug macro with cros_tracing
The USB stack used a usb_debug!() macro that was conditionally compiled
as debug logs into the code. The code has been converted to use
cros_tracing instead where appropriate.

Additionally some of the usb_debug!() invocations have been removed
(because unnecessary as they were closer to print debugging), converted to
their appropriate logging level (warn, info, debug) when they were not
appropriate as tracing points.

BUG=b:283033495
TEST=`cargo build --features=trace_marker` and `cargo build`

Change-Id: Ia01d3a24d0dc73a46b63844c21556778672795d0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4653693
Auto-Submit: Morg <morg@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Ryuichiro Chiba <chibar@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-07-04 04:52:24 +00:00
yuanyaogoog
b46bdc351a devices: Add trace point for virtio-net
Currently, there is no trace point in virtio-net. This CL add
preliminary trace points for virtio-net. Trace point traces the
virtio-net status after initialization and each package size write
to or read from tap device.

BUG=b:276683004
TEST=run crosvm with virtio-net and check tracing logs in
/sys/kernel/tracing

Change-Id: Id26e66c0ccf82fc800355484f876e51821607907
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4555079
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-05-30 02:14:52 +00:00
Federico 'Morg' Pareschi
362f5103fa cros_tracing: Fix missing fully qualified names
We need to use fully qualified crate names for things like Ordering when
we use them inside macros.

BUG=None
TEST=built crosvm with tracing and checked macros work without imports

Change-Id: I7cae94822ca5c3ef188e8e46e79edfb6bd0fca5b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4560807
Auto-Submit: Morg <morg@chromium.org>
Commit-Queue: Takaya Saeki <takayas@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Takaya Saeki <takayas@chromium.org>
2023-05-24 04:49:56 +00:00
Federico 'Morg' Pareschi
da3725ebce cros_tracing: Add scoped tracing to trace_marker
BUG=b:259501910
TEST=compiled and ran crosvm with virtiofs and verified tracing works

Change-Id: I109244364a323633edcf77127cedfe17bfdad578
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4119930
Auto-Submit: Morg <morg@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-05-18 02:14:25 +00:00
Noah Gold
81fdd8c7dd perfetto: minor build fixes.
* Requiring documentation for all public functions is a little too broad
(it covers the auto-gen'ed bindings too, which we don't want). This CL
removes the requirement.
* Minor issues in the hashing implemention using the sha2 crate were
  fixed.
* Fixed dependency issues.
* Switch to std::ffi::c_char since this differs by platform.
* Fix clippy errors.

TEST=builds
BUG=none

Change-Id: I0757a1efa17af225d01a636c611e4ca517825632
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4522874
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2023-05-16 22:30:45 +00:00
Noah Gold
64dee782da cros_tracing: add perfetto support.
This support doesn't build quite yet, but it's safe to include now
behind a feature. We're planning to set up the build for Perfetto
libraries shortly.

BUG=b:277138899
TEST=builds (doesn't break with the feature off).

Change-Id: Iff2cbbef93be4b6d5b5464b13b25cb1b50bf91d0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4428222
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Morg <morg@chromium.org>
2023-05-11 18:21:04 +00:00
Federico 'Morg' Pareschi
2e93874a25 cros_tracing: Add trace_marker integration tests
This CL adds a new "root" test suite for trace_marker integration tests,
since the tests require root to run in order to access the kernel's
tracefs mounted partition.

BUG=b:273379306
TEST=CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='sudo -E' cargo test --features=trace_marker

Change-Id: I4656374023d91d87959f6ce0d59eb9e51bdc77bd
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4349039
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Auto-Submit: Morg <morg@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
2023-04-12 01:21:39 +00:00
Daniel Verkamp
083dcf75f4 tree-wide: apply nightly rustfmt
BUG=None
TEST=tools/fmt --nightly

Change-Id: Ifb08dd55ccf2a74ef739d7517a64970d24a82405
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4375640
Auto-Submit: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-03-27 21:30:45 +00:00
Daniel Verkamp
df67a1207d cros_tracing: do not print errors in push_descriptors()
If the trace_marker feature was enabled but the sysfs file could not be
opened, cros_tracing::push_descriptors() would log an error message each
time it was called. We already log an error when tracing can't be
initialized, so the extra logs aren't necessary and can be removed.

BUG=b:256052372
TEST=cargo build --features=trace_marker and run crosvm

Change-Id: If7737cf3f27d7815536310eb995b9fad7669df5d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4262324
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-02-21 20:31:28 +00:00
Daniel Verkamp
1445ac1b93 cros_tracing: simplify trace_marker file checking
Rather than checking if the trace_marker file in sysfs exists and then
immediately proceeding to open it, we can just try to open it and handle
the resulting error if it doesn't exist.

Additionally, log the filename if the file can't be opened to make the
debugging process easier.

BUG=b:256052372
TEST=cargo build --features=trace_marker

Change-Id: I117324b0903afdbd351d03a18755321cacf1f42c
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4262323
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-02-21 20:31:04 +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
Federico 'Morg' Pareschi
912b70b741 cros_trace: Add initial trace_marker backend
This CL adds a new backend for the cros_tracing crate. This backend can
be enabled by building crosvm with the trace_marker feature enabled.
When the feature is not enabled, no extra overhead incurs as the default
NOOP cros_tracing crate will be compiled in instead.

BUG=b:259501910
TEST=compiled and ran crosvm with and without `--features trace_marker`

Change-Id: Ia4b929b042712a458b7d54c0362d6fda90db9e9f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4075413
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Auto-Submit: Morg <morg@chromium.org>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2022-12-23 06:21:24 +00:00
Noah Gold
cb55cd0394 tracing: rename tracing to cros_tracing.
`tracing` conflicts with a crates.io crate. Since we may support tokio
tracing in the future, and want to submit some benchmarks against it
right now, we should rename our crate.

BUG=b:253517247
TEST=presubmit

Change-Id: I32bf64a7ce1830e881bd582e4606932782df65c6
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3957598
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
2022-10-17 20:49:16 +00:00