Originally we clear all the fields about both input and output
resource when either input or output queue gets ResourceDestroyAll
command.
In this CL, we handle this command for the input or output queue
separately.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_adaptiveDrc
Change-Id: Ib7873a8192e9e0d01d6ea869eb8ea8661b6d1060
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2417793
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
At crrev.com/c/2416067 we split OutputResources out of Context struct.
Similiarly, this CL splits the fields that related to the input
resource to a dedicated struct `InputResources`.
Note that the field `res_id_to_res_handle` was shared by both input
and output resources. This CL split this field into both InputResources
and OutputResources struct.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_adaptiveDrc
Change-Id: I664815078e08f1e78ec9de2f6674dbdedd7fd482
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2428486
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
At crrev.com/c/2416067 we split the fields that are related to output
resource from Context struct out to OutputResources struct. Also, we
move the methods that only interact with these fields to the
OutputResources's implementation. However, these methods are designed
from the aspect of Context struct, not OutputResources.
In this CL, we re-design the method of OutputResources to make the
interaction between Context and OutputResources more clear.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_adaptiveDrc
Change-Id: Ib9a3fad8e0d71159c07ce5345b067a2c9924a119
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2417791
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Some fields of the `Context` struct are related to the output
resources. These fields should be cleared together. This CL
consolidates these fields to another struct to make the code clear.
Note that we add `keep_resources` and `set_output_buffer_count` fields
into OutputResources struct. Originally these two fields are not
cleared with other fields together. So this CL is not just a refactor
CL, it changes the reset logic.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_adaptiveDrc
Change-Id: I6843e835b6c488e74623704618ee54a5273eb7ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2416067
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Previously, the VFIO code was using a single IRQ VM control socket
within an Arc<> container for both MSI and MSI-X; however, MsgSocket is
not technically Sync. In order to remove the Sync trait from MsgSocket,
split the MSI and MSI-X uses into two separate sockets and remove the
Arc wrapper.
BUG=None
TEST=./build_test
Change-Id: Ib620521be3d02bc9b66c1cc771c34feb8622993c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2436399
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This will ensure that pinned VCPU threads get the per-core CPUID
information from the correct host CPU; previously, the host CPUID
instruction was executed on whatever host core the thread happened to be
running on.
BUG=b:167714813
TEST=Boot crosvm with --cpu-affinity and check core id in /proc/cpuinfo
Change-Id: If06155acb86c4b68d7fb1f8190836c5611e4d32f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2436955
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Very little of substance is added here, just the base boilerplate
BUG=b:162363783
TEST=./build_test
Change-Id: I2e3b3b45cf1d7234784d769b4dced31f10a8774d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2366110
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
This is very largely boilerplate, but changes some interfaces
to accept different parameters, esp using Descriptor.
BUG=b:162363783
TEST=./build_test
Change-Id: I81b513c0de9448c2de505fe5d3a61a29f4eccb78
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2342591
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Michael Hoyle <mikehoyle@google.com>
Change the inner helper methods to take an &InodeData instead of an
Inode. This removes the need to fetch the data from the map, which can
reduce unnecessary lookups when the calling method already has the data
on hand.
BUG=none
TEST=cargo test
Change-Id: Ia57a543e68d7aa63544f187bdefefe5a4d20c6a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2437683
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Now that readdirplus is handled by the server there's no need to have a
separate do_readdir method. Just merge it into the readdir method.
BUG=none
TEST=cargo test
Change-Id: I77475a64a13316bfbcd97a91610c6aa2ec0a9aae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2437682
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Add helper functions for common operations so that we don't have to
copy-paste the same thing everywhere.
BUG=none
TEST=cargo test
Change-Id: Ia9dd132336470cdaa5ecef72945f23f6d1dd4401
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2437681
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
This leaf is used to identify the APIC ID on Intel systems.
Fixes guest kernel warnings of this type:
[Firmware Bug]: CPU1: APIC id mismatch. Firmware: 1 APIC: 11
BUG=b:167714813
TEST=Boot Linux guest kernel; check dmesg
Change-Id: Icc3d32f5a382704c28ecc174b98c982c574bd2b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2402154
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When requested with the --gpu=cache-path=/path arg, crosvm
will pass it to Mesa via env var MESA_GLSL_CACHE_DIR. In
addition, the cache-size will also be passed along if
provided.
BUG=b:168540438
TEST=run with --gpu=cache-path=/tmp,cache-size=50M and
confirm that files are created in /tmp/mesa_shader_cache.
Change-Id: I2525597749d654a65373a723cefeab6cf2be62d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2415509
Tested-by: John Bates <jbates@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: David Riley <davidriley@chromium.org>
The existing mem_below_4g/mem_above_4g calculations did not match the
actual layout used when populating guest memory. Rather than
duplicating the logic in setup_io_bus to calculate the values reported
in CMOS, just reuse the arch_memory_regions function and count the bytes
in the regions below and above the 4G boundary.
BUG=b:168740534
BUG=b:168628037
TEST=Verify u-boot reports 4 GiB with crosvm --mem=4096
Change-Id: I32a70f19848595eaefd2e31c9f31a260d6ce4453
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2422129
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When the RAM size is specified to be exactly 3328 MiB (4096 - 768),
there is no memory after the gap; however, the arch_memory_regions code
was adding a zero-sized region to the list of guest memory areas to be
mapped.
This would result in a mmap syscall failure at startup:
[ERROR:src/main.rs:1590] The architecture failed to build the vm:
failed to set up guest memory: failed to map guest memory: mmap system
call failed: Invalid argument (os error 22)
Fix the off-by-one error when checking whether the address of the end of
guest memory is within 4 GB so that the > 4GB branch is not taken with
mem=3328.
BUG=chromium:1129547
TEST=crosvm run --mem=3328 vm_kernel
TEST=cargo test -p x86_64
Change-Id: I66cd66c98d690b42b2e1d97312528bb0d4830e76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2417004
Reviewed-by: Ram Muthiah <rammuthiah@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
The --serial option does not support args that have the '=' character
(or the ',' character for that matter, but we dont mind so much there).
This became a problem after crreev.com/c/2386885 made all encoded VM
names include padding, as the padding charcter '=' caused serial paths
like "foo=.log" to be interpreted as "foo".
This was not noticed because:
- Logging is not covered in automated testing.
- My vm name was "brl" in manual testing, which does not require
padding when b64 encoded.
BUG=b:168859379
TEST=vmc start termina; grep maitred /run/daemon.../log/dGVybWluYQ==.log
Change-Id: I07ffd1c76abab1866a8fb54763605c0ef8733776
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2417797
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Nic Hollingum <hollingum@google.com>
Reviewed-by: Nicholas Verne <nverne@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Fergus Dall <sidereal@google.com>
Originally crosvm calls VDA::reset() when either QueueClear the input
or output queue. However, VDA::reset() only drops input buffers,
not guarantee if drop output buffers.
This CL removes the VDA::reset() call when QueueClear output queue.
Instead, we only clear the records of all the queued output buffers.
Note that it's still a workaround. The correct solution is to expose
VDA::DismissPictureBuffer() to libvda, and then clear the record of
the dismissed output buffer.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek
with related CLs
Change-Id: Ic88b8b9bb14e4b29f7859bf06bd2231cecc85776
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2408597
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
When ProvidePictureBuffers() is called, it means the VDA already drops
the previous set of output buffers. This CL clears the variables that
are related to the output resource in ProvidePictureBuffers().
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek
with related CLs
Change-Id: I0e562fd216c6f2b91e4cbbe3ad174bca99003a0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2404511
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
When VDA requests crosvm to allocate N output buffers, crosvm will
request the userspace to allocate N+1 output buffers. Then crosvm
keeps one output buffer for notifying EOS.
Originally, after the preserved buffer is dequeued to notify EOS,
crosvm might keep another output buffer for next EOS. If so, then
crosvm will register all the N+1 buffers to VDA.
This CL changes to fix the preserved buffer until VDA requests another
set of output buffers. Also, it introduces another variable to track
the resource ids of queued buffers.
BUG=b:168557465
TEST=pass android.media.cts.AdaptivePlaybackTest#testVP8_eosFlushSeek
with related CLs
Change-Id: I8a6018f9e889dc6a2b6ef67d4915d6202858a42a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2404512
Tested-by: Chih-Yu Huang <akahuang@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
The Wayland context was being destroyed before the surfaces
were destroyed. This is because the drop order for fields
inside a struct is the order in which they are declared
[Rust RFC 1857].
BUG=b:168735942
TEST=boot Cuttlefish and then `adb reboot`
Change-Id: I3581375a0694871ad50945f5c3ce432bb1f65653
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2415511
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Jason Macnak <natsu@google.com>
1. Captures with the AC97 dedicated MIC will have the AEC effect enabled.
2. Removes the "capture_effect" option in --ac97.
BUG=b:167946783
TEST=Record in the VM by `arecord -D hw:0,1 -f S16_LE -r 48000 -c 2\
/tmp/a.out` and verify the opened stream has effect = 0x01 by
`cras_test_client --dump_a`.
TEST=`cat /proc/asound/I82801AAICH/codec97#0/ac97#0-0 | grep \
Capabilities` in the VM and verify "dedicated MIC PCM IN
channel" is supported.
TEST=`amixer controls` and verify that 'Mic Capture Switch'
and 'Mic Capture Volume' mixer controls show up.
TEST=Unit test.
Cq-Depend: chromium:2395855
Change-Id: I67bff9528175528e284f409fac1f51ecaaa89427
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2394983
Tested-by: Judy Hsiao <judyhsiao@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Auto-Submit: Judy Hsiao <judyhsiao@chromium.org>
It doesn't make sense to have 2 versions of this crate as we end up
missing bug fixes like chromium:2324089. Use the version from platform2
as that's updated more regularly.
BUG=b:167166153
TEST=Start a vm with a virtio-9p device and verify that it still works
Cq-Depend: chromium:2404987
Change-Id: I54abd88f64d599b68974c09a393c18ec830ecd76
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2404516
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Use the filter iterator method instead of a specific in-block check to
filter out tags we want to keep.
BUG=None
TEST=Video plays in Youtube.
Change-Id: I8c34fadb548c26762e077a3ba6dde822b2fb864a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2409491
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This makes the code a bit clearer.
BUG=None
TEST=Video plays in Youtube.
Change-Id: Ia904e693b692d70949afd529218dfc0aed7ec1b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2409490
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
We are taking ownership of params here, so no need to clone.
BUG=None
TEST=Video plays in Youtube.
Change-Id: I1013e669cde7e5d0001992d7620643054c03d87d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2409489
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Needed by ArcVm.
BUG=b:162388795
TEST='echo foo > test.txt; stat TEST.TXT` works when ascii_casefold is
enabled
Change-Id: Id2e720d6e9e9e511ee4ec6bb619a9fdbe2aa5d6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2403421
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Switch from an FnMut for adding entries to an iterator-like approach.
We can't use the Iterator trait directly because the DirEntry struct has
a generic lifetime parameter and generic associated types are not
currently supported by the language.
Also provide an automatic implementation of readdirplus so that file
systems don't have to deal with some of its fiddly details.
Move the directory entry enumeration code into a separate re-usable
struct as we will need it for the casefold support in the next change.
BUG=b:162388795
TEST=vm.Virtiofs
Change-Id: I40c92468a4852f1e302c2e67877b7189268e9c9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2403420
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
The futures don't require the IoSource to be Unpin if they take a
Pin<&I> where I: IoSource.
BUG=none
TEST=unit tests
Change-Id: I6d8e73d54ac612da58004b5bd732640524aac3b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2387822
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Pointers to the iovec structs are shared with the kernel for the
duration of an I/O operation and so must be pinned in memory. Use
Pin<Box<[iovec]>> instead of Vec<iovec> to express this and also to
prevent any changes made in the future from accidentally doing something
that causes the memory location of the iovecs to change.
BUG=none
TEST=unit tests
Change-Id: I317f3a6f68d457b0b0a6c86494d506b0e978b5fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2387823
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
We can use Pin::as_ref to go from a Pin<P> to a Pin<&<P as
Deref>::Target>, which doesn't require <P as Deref>::Target to be Unpin.
So let's have callers use that method rather than implementing the
IoSource trait for different pointer types.
BUG=none
TEST=unit tests
Change-Id: I45f54e70fe81bc0ceac3f038db47aef50201daa2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2387821
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
This CL includes several smaller changes to how executors work:
* Replace BTreeMap with Slab, which should give us some small
performance benefits by giving O(1) lookups and reducing memory
allocations when adding new I/O operations. It also gives some
improvements to readability as we no longer have to carry around
"next_*" variables. Slab has no dependencies and we're already
pulling it in via the futures crate.
* WakerToken no longer implements Clone.
* Merge pending_ops and completed_ops in URingExecutor into a single
`ops` Slab and introduce an OpStatus enum that indicates whether an
operation is pending or completed. This also fixes a resource leak
where an operation that was canceled before completion would end up
staying in completed_ops ~forever. Add a test for this leak.
* Add a generation number to RingWakerState and include it in all
RegisteredSources. Since a RegisteredSource can outlive the
RingWakerState that created it, the generation number ensures that
it will only affect the RingWakerState that created it. Add a test
for this.
* Poison RegisteredSource so that it doesn't implement Send or Sync.
Since it's associated with a thread-local executor, sending it
across thread boundaries is not ok.
BUG=none
TEST=unit tests
Change-Id: I43dcfbb8166002995ec8773522c22fab8fb2da9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2374885
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Allow separately specifying each VCPU thread's affinity, extending the
existing --cpu-affinity option so that it can parse a new format:
<GUEST-CPU>=<HOST-CPU-SET>[:<GUEST-CPU>=<HOST-CPU-SET>[:...]]
This can be used to pin each VCPU thread to a single host core, for
example.
Tested with this command to verify the affinity of the VCPU threads:
ps -C crosvm -T | grep vcpu | awk '{print $2}' | xargs -n1 taskset -p
BUG=b:167714813
TEST=cargo test
TEST=Run crosvm with new --cpu-affinity option; verify with taskset -p
Change-Id: Ie6c1acf954931c12b9eaa74c6ae3f67c3f062ef6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2399639
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This CL moves the remaining response logic from Worker to be done
by the decoder or encoder Device. Currently Worker matches on the
returned responses from Device's process_cmd and process_event_fd,
and adds additional responses when the Device already knows the
responses to send. This allows the encoder and decoder to send
different responses when the same AsyncCmdTag is returned, and to
remove the `take_resource_id_to_notify_eos` Device trait function.
BUG=b:161774071
BUG=b:161782360
TEST=USE=test emerge-$BOARD crosvm
TEST=play multiple YouTube videos to completion
Change-Id: I3b210b59f528df473a03657af76b5b8df488f7f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2352269
Tested-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alex Lau <alexlau@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This CL is a refactoring that moves out cancel_pending_requests as a
function of the descriptor map so that it can be shared with the
decoder and encoder implementation.
BUG=b:161774071
BUG=b:161782360
TEST=USE=test emerge-$BOARD crosvm
TEST=play YouTube video
Change-Id: I32cd7f5ced855cc42baa2d6d3d1a9db802433412
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2379572
Tested-by: Alex Lau <alexlau@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Alex Lau <alexlau@chromium.org>
Commit-Queue: Alex Lau <alexlau@chromium.org>
A recent API change made `{Reader,Writer}::new` take `GuestMemory` by
value instead of reference. Since `GuestMemory` is just a pair o'
`Arc`s, this appears to be an easy fix.
BUG=chromium:1125394
TEST=`emerge-amd64-generic crosvm` with a `--profile=fuzzer`'ed board
Change-Id: I964f284134241f958456f87912334a387dfcf61e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2394756
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
GPU in 2D mode does not need this and /dev/dri may not
exist (Nvidia startup failure after forced workstation
updates?).
BUG=b:166180769
TEST=boot Cuttlefish
Change-Id: Iaf80fc0f8f031270267df18d61964f8a648920b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2381892
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Jason Macnak <natsu@google.com>
Add an option to set some vcpus as real time. With a cooperative guest,
this allows for getting real time behavior for a subset of guest
threads. The guest will use cpusets to ensure that only real time tasks
are run on the real-time CPU, and that vcpu thread is real-time on the
host leading to behavior close to host real-time threads.
BUG=b:142777321
TEST=crosvm --rt-cpus 1 [OPTION]...
ps -AT -eo comm,sched,rtprio | grep crosvm_vcpu
then check the sched policy of vcpu1 is 2 (SCHED_RR)
Change-Id: Ic8e7a6840bdbce2c90e518458f6d0c50a65ca3f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2152167
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Suleiman Souhlal <suleiman@chromium.org>
Tested-by: Kansho Nishida <kansho@chromium.org>
Commit-Queue: Kansho Nishida <kansho@chromium.org>
This reverts commit ca3817bda3.
Reverting prevents these errors when starting the vm:
[ERROR:src/linux.rs:2324] failed to recv VmMemoryControlRequest:
msg buffer size too small
[ERROR:src/linux.rs:2324] failed to recv VmMemoryControlRequest:
msg buffer size too small
[ERROR:src/linux.rs:2350] failed to recv VmIrqRequest:
msg buffer size too small
BUG=b:162032986
TEST=manual
Change-Id: I22a31fa36274d3b6dd4ebc7431ab9ac3878b735b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2380301
Reviewed-by: Richard Zhang <rizhang@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Use the _by_key variant of the sort function as recommended by
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by
and replace the potentially easy-to-miss swap of the two compared values
with an explicit call to std::cmp::Reverse (also recommended by the same
clippy lint).
Fixes a clippy warning with Rust 1.46.0.
BUG=None
TEST=docker/wrapped_smoke_test.sh (with Rust 1.46.0)
Change-Id: I682652736a27cb09111dbc813e654b17269670da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2386479
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
When switching to async usage of descriptor queues, it is more useful to
consume the offsets and lengths of the descriptor buffers instead of the
buffers mapped as `VolatileSlice`s. Having the offset,length pair and
the guest memory it refers to is enough to initiate async ops.
Async versions of non-offset read/write case aren't possible as using
the existing "seek" offset of the file doesn't make sense with async IO.
Adding the new version modifies the existing API. This is necessary as
now `Reader` and `Writer` own `GuestMemory`, which makes async possible.
TEST=unit tests and new test to exercise the async functions.
Change-Id: I0a5e50694f40217e5d6ac40f5fcb82944a4c117e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2306784
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Msi capability structure for 32-bit message address and per vector
masking is missed, so vfio pci device with such cap couldn't receive
msi interrupt in guest.
BUG=None
TEST=Pass pci device with such msi cap into guest, then check this
device function in guest.
Change-Id: If89c5392af72a5bd1165c53a6857c24fe067e29c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2381399
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
GuestMemory is just Arcs, cloning it is as cheap as keeping an Rc.
Change-Id: I160585ce0cf70aa0ec33897b550b82fe09bde2a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2364992
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
These keys are frequently found as hardware keys on mobile devices.
BUG=b:163628929
TEST=Use crosvm to launch AOSP Cuttlefish and send volume key events.
Change-Id: I9175d32cfd4060abd74f0fde4100284483f13102
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2369357
Tested-by: Daniel Norman <danielnorman@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Norman <danielnorman@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Jorge Moreira Broche <jemoreira@google.com>
It's not supported by the protocol and unused by the virtio-video
kernel driver.
BUG=b:161774071
TEST=USE=test emerge-$BOARD crosvm
Change-Id: I5d28072618187b90acb29fbb4b4272f644ebf1d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2361543
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alex Lau <alexlau@chromium.org>
Where it simplifies the code, use tempfile() rather than TempDir to
create temporary files in tests.
BUG=None
TEST=./build_test
Change-Id: I5caff512a38a3b94556b0c72693e432503d6e679
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2360459
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
This simplifies the common case of creating a temporary file whose path
does not need to be known, as well as a a temporary file with a known
name.
BUG=None
TEST=cargo test -p tempfile
Change-Id: I664b6097b5ae44ae3f1aa7f6c366271375a8df46
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2360458
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>