Updated the book to cover the network device hotplug feature.
BUG=b:243767476
TEST=./tools/dev_container ./tools/fmt
Change-Id: I570a981a347ce8896e4cf0eaf65a7c755b331590
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4720165
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Jason Iman <jasongustaman@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
After integrating downstream, we found a couple of adjustments that were
worth making:
* Bug: get_read_notifier wasn't used on the Tube, so it wouldn't ever
wake up when added to the wait context.
* Feature: an adjust request has no reply, so having to specify a
response id doesn't make sense since we don't actually want the reply
routed anywhere (in some cases, we have no where to route it).
BUG=b:291684465
TEST=builds.
TEST=tested downstream.
Change-Id: Idfb1bd4d28ad26f1df3fd6d543df43cf84938975
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4718769
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: David Stevens <stevensd@chromium.org>
If crosvm fails at the early stage of setup, opening to_guest fifo
blocks forever and it takes 20 seconds to timeout.
Opening to_guest fifo should be wrapped by timeout as well as
from_guest.
Check the crosvm process status periodically to abort testing earlier.
With this change, the total e2etest execution for failure case is
reduced to 0.2s from 20s.
There is better way without panicking on timeout; interrupt the blocked
open(2) for fifo by pthread_kill(). However it is too much since this is
just a test. panicking is welcome.
BUG=b:293383846
TEST=./tools/run_tests2 --dut=vm -E 'rdeps(e2e_tests)'
Change-Id: I8735a77201f930162113efa98d655f77be8d259d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4721027
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
`peek_size` blocks until there is data available, so it is actually more
likely to see an EINTR than the `recv_with_fds` call that follows it.
Before, the following command failed had 5 flakes, 3 of which were
clearly caused by EINTR when recving on a tube. After, I saw no flakes.
./tools/run_tests --dut=vm --filter-expr="test(boot_test_vm_uring)" --repetitions 100
BUG=b:293463612
Change-Id: Ie0471a46be11d67f38d4d0a5a4793e5ca2fc1633
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4727022
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
BUG=b:290315473
TEST=`tools/dev_container tools/presubmit format`
TEST=generated docs and served the html pages and all looks good
Change-Id: I6057a1ee849226659b915345d707c42b462dd4b9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712779
Commit-Queue: Morg <morg@google.com>
Auto-Submit: Morg <morg@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
VSCode prompted me Better TOML extension is deprecated and Even
Better TOML should be used instead.
TESTED=toml support still works after rebuilding dev container
Change-Id: Ic7a71f99a89a47e139627fcd75e35acbdf3bef41
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4728142
Auto-Submit: Zihan Chen <zihanchen@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
If the virtio-gpu device hadn't been activated yet, then crosvm shutdown
would hang forever.
Ideally we'd make it respect the kill event instead of carefully
managing the lifetime of the channel, but that introduces much more
complexity.
This can be tested by running crosvm with the following arguments (to
add a gpu device + tell linux not to use it) and then stopping crosvm.
--gpu=backend=2d -p nomodeset
BUG=b:266514608,b:293347107
Change-Id: I42523c4e5973815bb1b41f40c3d72b12fc910965
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4723348
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Elie Kheirallah <khei@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Frederick Mayle <fmayle@google.com>
This is technically more strict than it needs to be: The worker
shouldn't need to wait for the parent thread to hit the barrier before
it proceeds. However, in practice, the parent thread is always going to
hit the barrier first and, even if it doesn't, the performance
difference probably doesn't matter.
Change-Id: Ibf452fb7b896f1650fc6c9669e15aa970b224fa1
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4723347
Reviewed-by: Jason Macnak <natsu@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The cross-domain rutabaga component never calls the
fence handler for fences scoped to the global ring.
This means that descriptors would never be returned
and the guest kernel would freeze.
Newer kernel are fixed to never create global fences,
but for older kernels let's signal the fence
immediately on creation.
BUG=b:293370836
TEST=run Wayland
Change-Id: I37c288dc5ed435f6099ac68801c63fd8a909aa18
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4722177
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
In order to replicate the ACPI notification from the host to the guest
pass-through devices:
1) allocate GPE and eventfd per pci-vfio device
2) generate proper aml code for ACPI GPE handler. The example of generated aml:
Scope (_GPE)
{
Method (_E00, 0, NotSerialized) // _Exx: Edge-Triggered GPE, xx=0x00-0xFF
{
Local0 = \_SB.PC00.PE08.NOTY
Notify (\_SB.PC00.PE08, Local0)
}
}
The eventfd is registered by host kernel via VFIO_DEVICE_SET_IRQS
ioctl. Crosvm upon receiving early provided, per pci-vfio eventfd,
stores the notification value and triggers GPE associated to pci-vfio
device.
Guest kernel upon handling GPE (thanks to generated aml [ad 2)],
triggers Notify on required pass-through device and therefore replicates
the ACPI Notification on the guest side [Accessing \_SB.PC00.PE08.NOTY
pointed by VCFG opregion result with trap to crosvm, which returns
previously stored notify value].
Kernel counterpart: CL:4538472
BUG=b:244205651
TEST=Observe replication of ACPI notification in the guest kernel
Change-Id: Iaf66097acd84f3066f6ff70d382f83ecaeea9a00
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4538483
Commit-Queue: Grzegorz Jaszczyk <jaszczyk@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
e2e_tests/run script was used as a convenience tool, and is superseded
by tools/run_tests2.
BUG=NONE
TEST=tools/presubmit
Change-Id: I52ea9d3718d005fd64506c6586624a07da66db85
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705407
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
This CL implements PCI hotplug feature for virtio-net device. The
feature is controlled by pci-hotplug feature flag and pci-hotplug-slots
runtime flag. No behavior change to crosvm unless pci-hotplug-slots flag
is set to a nonzero value.
BUG=b:243767476
TEST=tools/presubmit
TEST=e2e_test::tap_hotplug for TAP device hotplug and removal
TEST=manual test for TAP device hotplug and removal with swap
Change-Id: I5a60314293ef8a27981d7b550a61822491c254bb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4473610
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Jason Iman <jasongustaman@chromium.org>
This CL adds the missing raw descriptors of SwapDeviceHelper to the
keep_rds of jail warden process. Previously, pci hotplug do not function
with swap turned on due to the missing RDs.
BUG=b:243767476
TEST=tools/presubmit
TEST=manual pci hotplug and swap test with crrev/c/4473610
Change-Id: Ic54c5cd8af5393a0875d3f2dd6386e8407ba2377
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4719307
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Shin Kawamura <kawasin@google.com>
To support packed virtqueue in net device, add packed-queue runtime flag
to net device. If flag is set true, net device uses packed virtqueue. If
flag is not set or set to false, net device use split virtqueue as
default.
BUG=b:243621596
TEST=crosvm run —net “…,packed-queue=true”
Change-Id: I521eb77226c75f1dd96a5d2d185ac427286d6397
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4630878
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
This reverts commit 1eb1106537.
Reason for revert: headers generated by cbindgen do not compile as expected downstream
Original change's description:
> balloon: rename WSS to WS
>
> as the working set feature approaches acceptance at the spec-level, we
> are keeping up with nomenclature changes.
>
> BUG=b/288432539
> TEST=cargo build, cargo build --no-default-features, cargo build --features registered_events
>
> Change-Id: I323a2c5402cb8008f8c912b0849e8e3501f9e1f3
> Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4702340
> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
> Commit-Queue: maciek swiech <drmasquatch@google.com>
BUG=b/288432539
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: I46459b4afd428c67436a754b3e62a104a680c68f
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4722468
Commit-Queue: maciek swiech <drmasquatch@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Partially fixes display window functionality when using options like
--display-window-keyboard and --display-window-mouse.
Other issues still exist when using the GPU with a display window and
sandboxing, but this change at least lets things proceed a bit further.
BUG=None
TEST=Run tools/examples/example_desktop
Change-Id: I2129b323fbc39d706d2044d5cb29885f6bf474d9
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4713686
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This will ensure the binary is compiled in upstream CI.
The new location will require an updated ebuild file
and needs to be synchronized via Cq-Depend during the
ChromeOS merge process.
BUG=b:293164205
TEST=presubmit
Change-Id: I51f4d8b8e606b64f124bf2801c1e4701d00eed85
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4718765
Reviewed-by: Judy Hsiao <judyhsiao@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
- Group definitions in ways that make more logical sense
- rutabaga_fence -> *rutabaga_fence
- const correctness
BUG=b:273555494
TEST=compile
Change-Id: I2c3c715ee1b03b0441868a517545d34ff774c2de
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712928
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This adds a debug callback to rutabaga_gfx + gfxstream. This is
because VMMs often redirect logging to custom handlers, or even
abort on error. For gfxstream alone, for the unstable API
we have:
- METRICS_CALLBACK_ADD_INSTANT_EVENT
- METRICS_CALLBACK_ADD_INSTANT_EVENT_WITH_DESCRIPTOR
- METRICS_CALLBACK_ADD_VULKAN_OUT_OF_MEMORY_EVENT
- METRICS_CALLBACK_SET_ANNOTATION
- METRICS_CALLBACK_ABORT
Many of these can be converted to use this more generic debug
handler (just by extending the struct).
BUG=b:292548160
TEST=see debug output when booting a VMM with FFI bindings.
Change-Id: Id69bfc9e5fb4c5610f5108278aed37c31150c95a
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712927
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
When snapshotting was added to the balloon device, we started caring
about whether the various worker futures exited when we didn't used to.
On unix this is fine, but on Windows we have a problem: one of the
futures, handle_command_tube, exits early because we have a global async
executor, and that executor gets shut down, cancelling the Tube's
.next() early (removing the global executor is b/196911556).
To work around this, we explicitly ignore the error, and also require the
future to act like the others (wait on a stop channel before returning).
It's a bit of a hack, but until we yank the executor it's probably our
best option.
BUG=b:292699711
TEST=ran emulator downstream & verified the balloon isn't exiting
with an error anymore on shutdown.
Change-Id: If2e8cd013cc86c7da5cee82bc104adf33edfe49b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4719205
Commit-Queue: Noah Gold <nkgold@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Richard Zhang <rizhang@google.com>
Move the split and packed virtqueue specific DescriptorChain parsing
code into new files in the virtio::queue module. This places the split
and packed descriptor chain code next to the corresponding queue code,
and it helps clarify which parts of descriptor_chain are generic and
which are queue type specific.
No functional change, only code movement.
BUG=b:243621596
TEST=tools/dev_container tools/presubmit
Change-Id: I3dc512657344f0801a03b54c3eb7bbe6858abae3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4708304
Reviewed-by: Yuan Yao <yuanyaogoog@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
resident page count is independent from page handler. Showing resident
pages in the guest memory while vmm-swap is disabled is useful for
tracking vmm-swap usage.
This also include typo fix regident -> resident.
BUG=b:291193201
TEST=manually tested
Change-Id: Ib1d0fbd3958705446c73481abf6261bbffe134a0
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4705404
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
One key caveat here: migration of snapshots between devices
is not supported. We'll be looking at that in b/291346907.
BUG=b:286344791
TEST=unit tests
Change-Id: If0b887c719aa835b92dc0f7d7785278e985dc355
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4686789
Reviewed-by: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Commit-Queue: Noah Gold <nkgold@google.com>
Due to MFD_NOEXEC_SEAL being applied by SharedMemory::new() on newer
kernels, the set of seals may not be 0 after shm creation. Tweak the
test to validate that only the F_SEAL_SEAL flag is clear before we
intentionally set it so the test can pass on both old and new kernels.
BUG=b:282221246
TEST=tools/dev_container tools/presubmit # on Linux 6.3.11 kernel
Fixes: 5b7cdc1eb0 ("base: use MFD_NOEXEC_SEAL if available when creating memfds")
Change-Id: I60e3886bf0401f037b3ca03ba1b43186adcec5bb
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4718767
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
as the working set feature approaches acceptance at the spec-level, we
are keeping up with nomenclature changes.
BUG=b/288432539
TEST=cargo build, cargo build --no-default-features, cargo build --features registered_events
Change-Id: I323a2c5402cb8008f8c912b0849e8e3501f9e1f3
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4702340
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: maciek swiech <drmasquatch@google.com>
Arc::try_unwrap(my_arc.clone()) fundamentally can't work since the clone
holds onto a reference (meaning if you have my_arc, and my_arc.clone()
around, there's 2 refs and try_unwrap will fail).
Instead, lets wrap our executor / futures in a scope, which cleans up
the borrow checking problems and allows us to consume rx_queue_arc right
after.
BUG=b:292863423
TEST=downstream emulator
Change-Id: Iac2d21eb069be6c92d1fb4bfb49525faba963343
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4711929
Commit-Queue: Idan Raiter <idanr@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Reviewed-by: Richard Zhang <rizhang@google.com>
To support packed virtqueue in block device, add packed-queue runtime
flag to block device. If flag is set true, block deivice uses packed
virtqueue. If flag is not set or set to false, block device use split
virtqueue as default.
BUG=b:243621596
TEST=crosvm run —block ”…,packed-queue=true”
Change-Id: Iaca015392103858e06c9368553540ba937ec3b3d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4648470
Reviewed-by: Takaya Saeki <takayas@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Commit-Queue: Yuan Yao <yuanyaogoog@chromium.org>
This CL cleans the creation of PCI root port and existing support for
host vfio PCI hotplug. The logic for creating root port with host
passthrough is separated from a purely virtual root. Logics only used
for feature direct is isolated from the rest.
BUG=b:243767476
TEST=tools/presubmit
Change-Id: I4a71524d0a71d9148cc83de1fa5b9ff337a73e10
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4703390
Commit-Queue: Ningyuan Wang <ningyuan@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Sometimes, it's desirable for rutabaga to tell the VMM something.
Currently, it's just fences, but in the future it may be messages
from gfxstream.
BUG=b:292548160
TEST=run VM
Change-Id: Ica13a83a4bb8ebab88e929b469143a4a7f35f43e
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712926
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
1) VirglCookie --> RutabagaCookie
Most accurately, since gfxstream uses the cookie as well, it is
neither a virgl cookie or a gfxstream cookie. It, in fact, is
a rutabaga cookie.
2) Organize callbacks into gfxstream and virglrenderer files
They both have *slightly* different function signatures anyways.
BUG=b:292548160
TEST=compile
Change-Id: I915ec747d29fe6c2d92b58ff2088009a4dfdeb29
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4712925
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>