Let the user of the io_uring interface specify a slice of iovecs to read
from or write to when queueing an operation to the ring.
These ops can be used by block that has a Vec of iovecs from the
descriptor chain already.
Change-Id: Ia91e03e441cdae03e4fdba33bb601de006ef53ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140914
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Switch from returning an i32 to a u32. This will make handling the
number easier for users, as they can assume it is >= 0.
Any value < 0 would not be returned as Ok(value) anyways as ret < 0 is
used for error conditions.
Change-Id: I609ce55d3c6be6e28f4d7aadf7148b2ac3b18878
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2140913
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Previously, writable pmem devices implemented the flush command using
fsync(); however, this does not guarantee synchronization of memory
mappings via mmap() to the file on disk. What we actually need is
msync() on the pmem file mapping, but we don't have access to that
mapping in the pmem child process, and it isn't trivial to pass it along
since it is owned by the Vm object once it has been added as a
mmap_arena.
In order to call msync() on the mapping, add a new VmControl socket so
that the pmem device can request that the main process issues an msync()
on the MemoryMappingArena identified by its slot number.
BUG=chromium:1007535
TEST=mount filesystem on /dev/pmem0 and sync; verify msync in strace
Change-Id: Id0484757c422cf81d454fd54012a12dbcc1baaf6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2044365
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This was adding ~11 minutes to the boot time with sparse images.
BUG=b:151981838
TEST=launch cuttlefish with sparse images.
Change-Id: I707258566aee338f742a3a5fe94d0bad8302c447
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2111117
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Cody Schuffelen <schuffelen@google.com>
Poll available memory from the host and guest every second. Resize the
balloon so that available memory in the guest is the same as in the
host.
balancemem_timer adds a Token::BalanceMemory to poll_ctx every second
which creates a balloon stats request.
When the stats results come back from the guest, we compute how much the
balloon should change to balance available memory between the guest and
host. If this new balloon size is > 5% different than the current
balloon size, we make a BalloonControlCommand::Adjust to resize the
balloon.
BUG=b:147334004
TEST=tast run <DUT> arc.MemoryChomeOSPerf*, .vm shows memory use similar
to the base arc test. tast run <DUT> arc.MemoryShiftingPerf.vm, both
chromeos and android counters report high numbers. Switch
LOWMEM_AVAILABLE constant to non-existing file, check the ARCVM reports
not running in ChromeOS, but still boots.
Change-Id: I8a581f86bf4881541d2f5f26dc541b35b862d244
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2061518
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Charles Dueck <cwd@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Charles Dueck <cwd@chromium.org>
Provide a low-level interface to operating the new io_uring interface.
This is an unsafe interface with the basic operations of setting up the
ring, adding to it, removing from it, and polling it.
This will be followed by a safe interface layer on top of this code,
then by additions to the asynchronous executor that allow for
asynchronously doing multiple operations to files from one context.
Change-Id: I71f7ffb04ce8cb4da470deda9aee768ab95d3d98
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124009
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
While only 32 bits of address can be mapped, that 32 bits can be offset
by further than 32 bits in to a large file. As chirantan points out, the
try_mmap call was already casting the usize to u64 on all architectures.
Convert the usize offset in mmap to u64 and address users of the API as
well.
Change-Id: I67aed928ea521049fb51eb7aa61ea4de8b4d096c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124879
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
This change is a major shift in how the MsgOnSocket trait works to allow
`self` to be used to determine the result `msg_size()`. This is to
support data structures with `Vec` or other dynamically sized type.
TEST=./build_test
cargo test -p msg_socket
tast run <DUT> crostini.CopyPaste.*
BUG=None
Cq-Depend: chromium:2025907
Change-Id: Ibdb51b377b2a2a77892f6c75e1a9f30b2f8b0240
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2029930
Tested-by: Zach Reizner <zachr@chromium.org>
Auto-Submit: Zach Reizner <zachr@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Zach Reizner <zachr@chromium.org>
Virtio-net multi queue feature need multi queue pairs, this patch change
queue-num configurable instead of static. --net-vq-pairs parameter could
config virtio net device virtual queue pairs.
BUG=chromium:1064482
TEST=Test virtio net function in guest with --net-vq-pairs=1 and
--net-vq-pairs=2
Change-Id: I75202c8ae52a83b8087b52149ec6d2138d8831cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120312
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Add the following setup for libvda, which will be used by video features
introduced by CL:1973973:
* Pull down platform2 as /platform2
* Create a dummpy libvda.pc file
Note that we don't build libvda.so.
BUG=b:147465619
TEST=build_crosvm.sh
Change-Id: I1f61df57244a13b7df1b7a373d955b6cfe91e188
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2133987
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
The current Dockerfile builds crosvm only with some selected features.
To cover all of crosvm code, this CL adds 'cargo check' command.
BUG=none
TEST=./build_crosvm_base.sh && ./build_crosvm.sh
Change-Id: I6e1efa8f68476912c9cec46188f096d430df663c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2134003
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
In order to support 2 vq pairs for virtio-net, this patch create 2
sockets in one tap interface, 2 vq pairs(rx/tx) and 2 threads in
device model, So one vq pair has one thread and one socket in tap
corresponding.
On my SkyLake desktop with crosvm and ubuntu 18.04 guest:
If run one iperf server on host and one iperf client in guest, 2 vq
pairs has the same netwrok bandwidth as 1 vq pair, the bandwidth is
5.99Gbits/sec
If run two iperf server on host and two iperf client in guest,
In 1 vq pair mode, two iperf cliens bandwidth are 3.19Gbits/sec and
3.18Gbits/sec.
In 2 vq pairs mode, two iperf clients bandwidth are 4.87Gbits/sec and
4.86Gbits/sec.
So 2 vq pairs improve net bandwidth 52.7% compared with 1 vq pair in
this case.
BUG=chromium:1064482
TEST=Run iperf test in guest
Change-Id: I1fa14d7e24085552dc828a89a883d4a2ada34789
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2099754
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Xiong Zhang <xiong.y.zhang@intel.corp-partner.google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Introduces the ability to request BalloonStats from a
BalloonControlCommand.
BUG=b:147334004
TEST=tast run <DUT> arc.Boot.vm, and the balance available changes based
on this.
Change-Id: I808c4024f8c644c9cc4e30cc455ceda5f477bff3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2061517
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Charles Dueck <cwd@chromium.org>
io_uring would like to pre-fault the ring pages as they are likely to be
accessed regularly. Allow mmap users to specify the MAP_POPULATE flag
through a new API.
Change-Id: I5fefc13443280fe832c9601fe5a497b572127f0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124008
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
io_uring is needed so update the syscall defines to match 5.6-rc5.
There was a slight refactor in arm upstream which changed some syscall
names to better reflect their 32 vs 64 bit variants. See kernel commit:
00bf25d6: y2038: use time32 syscall names on 32-bit
TEST=samus, kukui, and kevin64 build.
Change-Id: Idcceb4bba313a3f826556e90ffde94f166de0a05
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2124007
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Abhishek Bhardwaj <abhishekbh@chromium.org>
The RwLock implementation on linux has a tendency to starve writers.
Since the fs device workload has a roughly evenly distributed number of
reads and writes, using a Mutex should give us better performance.
BUG=b:150264042
TEST=vm.Blogbbench.virtiofs
Change-Id: I85ec4053bf03d19bb21b420c0aa506720e666708
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2103604
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
This is a workaround for a bug encountered with newer Android phones -
when connected to the Linux VM, resetting the USB device via
USBDEVFS_RESET causes the device to disconnect from the host, preventing
its use in the VM.
This works around the issue by removing both paths that can cause a
USB device reset (initial reset at device insertion plus reset when
requested by the guest kernel). Both of these must be removed to
restore functionality; if either is still in place, the failure is still
observed.
The workaround specifically exempts Edge TPU devices, which need a reset
for firmware update; these devices will still issue a reset on connect
and when requested by the guest.
BUG=chromium:1058059
TEST=Connect Pixel 3 to eve, adb logcat
Change-Id: I7a689da1120e1fb772d95e41a0d4debe64f7d6a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105814
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Using the `open_inode` method on an fd for a symlink results in the
kernel returning -ELOOP. Since there are no `*at` methods for extended
attributes, manually read the path for the file and then use the
l{get,set,list,remove}xattr method on the returned path.
BUG=b:136128512
TEST=boot arcvm with virtio-fs and selinux enabled
Change-Id: I2fde57db8a075838a3a877309f6cf89059f19258
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120763
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
`offset_dst` is supposed to be a pointer.
BUG=none
TEST=none
Change-Id: I033501ba5a57a130625e68be88457b15ad1484ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2120762
Auto-Submit: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
The current vhost-net msix irq injection flow is from vhost-kernel
to crosvm vhost-net, then to the KVM for irq injection. It still need
crosvm vhost-net to trigger irq, which is because the set_vring_call
is not directly using the msix irq fd.
To optimize this flow to be from vhost-kernel to KVM directly, need:
1. if the msix is enabled and unmasked, use the misx irq fd for the
vring_call directly so that all the misx injection can directly to
KVM from vhost-kernel.
2. if the msix is disabled or masked, use the indirect vhost_interrupt
fd to let the crosvm to control the irq injection.
BUG=None
TEST=cargo test -p devices
TEST=start crosvm with vhost-net, and run the iperf3 on the network
without any issue
Change-Id: Idb3427f69f23b728305ed63d88973156a03e7c6b
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046452
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Pass the Option of the response socket should be used by the
activate thread, to communicate with its device model.
BUG=None
TEST=cargo test -p devices
Change-Id: I929f4c901468e920116f2a744ec73571d91080e3
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046451
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Add a pair of control socket for vhost net. This pair can be
used for the vhost-net device model to control and
communicate with its activate thread.
BUG=None
TEST=cargo test -p devices
Change-Id: I8bacdb9132787dc499ef00eea1df26ff3b35028d
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2046450
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
On devices with only one configuration, skip the code that attempts to
change the device's active configuration, since it must always be the
single available configuration.
This works around an issue observed with some USB devices (e.g. Servo
Micro) where the initial Get Configuration control request fails with
-EPIPE.
BUG=chromium:1061382
BUG=b:151408644
TEST=Attach servo micro, see /dev/ttyUSB[012], screen /dev/ttyUSB0
Change-Id: Ic3333e1d70a0c57b090de64e4d3b7932ce2cf81d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2108871
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: George Engelbrecht <engeg@google.com>
Commit-Queue: George Engelbrecht <engeg@google.com>
* Remove RESOURCE_V2_UNREF
* Add RESOURCE_MAP/RESOURCE_UNMAP to enable resources without guest
storage that don't need to be mapped directly either
BUG=chromium:924405
TEST=compile and test
Change-Id: I10d6cd120d86131fa7ed8917ddad25cdb99ae50c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2015587
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Auto-Submit: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Rebase of zero-copy virtio-gpu flow:
* Removes guest_memory_type/guest_caching_type in favor of a bitmask
* Removes ALLOCATION_METADATA, since ideally we'd just read from
guest memory to get guest responses
* Renames HOST_COHERENT to HOST_VISIBLE
* Adds a few more feature flags
BUG=chromium:924405
TEST=compile
Change-Id: I0d5a84b66cfa6d09f7e2d07ed8e761e7ba850284
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2013767
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Lingfeng Yang <lfy@google.com>
Reviewed-by: Zach Reizner <zachr@chromium.org>
The vararg bindings are different for different architectures. Limit
support to x86 and x86_64, since those are the bindings that are checked
in.
BUG=chromium:1063640
TEST=compiles
Change-Id: Ic69753959684f55855fd7a8577a422638cd05f8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2114633
Reviewed-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
1. Replace --cras-audio, --cras-capture, null-audio options by --ac97
option to create audio devices.
2. "--ac97 backend=BACKEND\
[capture=true,capture_effect=EFFECT]" is comma
separated key=value pairs for setting up Ac97 devices.
It can be given more than once to create multiple devices. Possible
key values are:
backend=(null, cras) - Where to route the audio device.
`null` for /dev/null, and cras for CRAS server.
capture=true - Enable audio capture.
capture_effects - | separated effects to be enabled
for recording. The only supported effect value now is EchoCancellation
or aec.
BUG=b:140866281
TEST=1.crosvm run -r ./vm_rootfs.img -c 4 -m 1024 -s /run --cid 5 --host_ip\
100.115.92.25 --netmask 255.255.255.252 --ac97\
backend=cras,capture=true,capture_effect=aec\
--mac d2:47:f7:c5:9e:53 ./vm_kernel
2. Record with the vm by:
arecord -D hw:0,0 -d5 -fS16_LE -c2 -r48000 /tmp/test.mp3
3. Verify that AEC is enabled within the recording stream by
cras_test_cleint.
Cq-Depend: chromium:2053654
Cq-Depend: chromium:2095644
Cq-Depend: chromium:2038221
Change-Id: Ia9e0e7cda1671a4842ec77a354efaa4a2dc745eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2038413
Tested-by: Judy Hsiao <judyhsiao@chromium.org>
Commit-Queue: Judy Hsiao <judyhsiao@chromium.org>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Auto-Submit: Judy Hsiao <judyhsiao@chromium.org>
This is a virtio device that provides a serial console. It has
constructors matching the existing Serial device (new_in_out, new_out,
and new_sink) that take generic io::Read and io::Write streams.
This change just adds the device code; additional changes are required
to add the console device to the command-line parsing and device setup
code.
BUG=chromium:1059924
TEST=boot linux with console=hvc0
Change-Id: I917157d5ecb5160c9b00b499eabe6fb08486776c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2095534
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Previously the "acpi=off" in cmdline has disabled the ACPI for the
guest kernel. With removing the "acpi=off", the ACPI will be enabled
for the guest kernel by default. With acpi enabled, the SCI irq will
be needed by the ACPI core driver. Register the SCI irq in MP table
so that it can use IO-APIC routing.
The reason to have "pci=noacpi" is that, in the current DSDT there is
only suspend capability, so PCI scan still need to be done by the
traditional way.
BUG=chromium:1018674
TEST=Linux guest is able to boot up with the virtio devices functional.
Also able to see the S1 capability from kernel dmesg.
Change-Id: Id54e788f4aa4c944fac5e3fa1c92b76865dd5021
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2078967
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Add new definitions and constants to support fuse minor version 31.
These include the FUSE_SETUPMAPPING and FUSE_REMOVEMAPPING opcodes used
by the virtio-fs driver for implementing DAX support.
BUG=b:147341783
TEST=vm.Virtiofs
Change-Id: Ie59ec1a44e555910f2ee2c5ba7afccb8bd435db9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105823
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Add support for FOPEN_CACHE_DIR so that the guest can cache directory
entries for longer.
BUG=b:150264964
TEST=vm.Virtiofs
Change-Id: Iade67b54084ed72378afa70af9e9e0f7f0bc03e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2105821
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Add a frequency file that teaches the seccomp compiler to weight the
comparison tree in favor of the most frequenctly called syscalls.
This frequency file was created by running strace against vm_conciege's
pid (e.g., "strace -p PID -ff -e raw=all -o /tmp/strace") when
performing a start and stop of a VM, deleting the trace files that
weren't for a crosvm process, passing the files to minijail's
tools/generate_seccomp_policy.py (using the -frequency option), and
combining the results of the frequency file. I rounded the #s to the
nearest multiple of 5 and only retained the syscalls that had at least
10 calls.
BUG=None
TEST=Local build and deploy. Verified that crostini VM still boots and
shuts down properly. Used scmp_bpf_disasm to disassemble a few bpf
files before and after this change to confirm that with the frequency
file the first comparision is "jge 2" (to quickly whitelist syscalls
0 and 1 ['read' and 'write']) instead of a comparison around the middle
of the range of syscall numbers that are used.
Change-Id: Icace2b5cdbcae6e51cfd67a3034a1a17fdb6d59e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2005793
Commit-Queue: Matt Delco <delco@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Tested-by: Matt Delco <delco@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Auto-Submit: Matt Delco <delco@chromium.org>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Change the type of argument::Error::InvalidValue::expected from "&'static str" to String.
It allows the lower level parse error object to handle the output of the expected value so that
the rule of parsing will not be duplicated.
For example, instead of:
```
v.parse::<Settings>()
.map_err(|e| argument::Error::InvalidValue {
value: v.to_string(),
expected: "The value of setting should null or cras",
})?;
```
we can have:
```
v.parse::<Settings>()
.map_err(|e| argument::Error::InvalidValue {
value: v.to_string(),
expected: e.to_string(),
})?;
```
and the expected value can be handled in the Display implementaion of
Settings::ParseError.
BUG=b:140866281
TEST=cargo build
Change-Id: Ieba12a21103945fe0e47c70a190a4e5d985af537
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2103605
Tested-by: Judy Hsiao <judyhsiao@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Chih-Yang Hsia <paulhsia@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Auto-Submit: Judy Hsiao <judyhsiao@chromium.org>
Commit-Queue: Judy Hsiao <judyhsiao@chromium.org>
rustc now warns about return statements that have an extra set of
parenthesis. Remove such instances so that the code is warning free.
TEST=cargo build completes without warnings
Change-Id: I55148f8aceca8ba90f6bead2b6929e2c843351aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2104767
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Dylan Reid <dgreid@chromium.org>
Commit-Queue: Dylan Reid <dgreid@chromium.org>
Specifying O_DIRECT in the 9p device doesn't actually work correctly and
leads to an error. O_DIRECT handling in the fs device works correctly
but also makes it look much worse in disk I/O benchmarks because the
block device gets the benefit of the host cache while the fs device
depends on the performance of the actual storage device.
BUG=none
TEST=`tast run vm.Fio.*`
Change-Id: I738e4032081e331ef956c9d4c33616607e403d86
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2093967
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
We have instructions for building with Docker, but it's now possible to build
for normal Linux distros too. Also add a pointer to the main CrOS developer
guide.
BUG=none
TEST=follow the instructions
Change-Id: Ic7ce498268f8057fbe90a88166017f54108d0e16
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2057747
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Tested-by: Stephen Barber <smbarber@chromium.org>
Commit-Queue: Stephen Barber <smbarber@chromium.org>
Fixes warnings of the form:
warning: this method call currently resolves to `<&[T; N] as
IntoIterator>::into_iter` (due to autoref coercions), but that might
change in the future when `IntoIterator` impls for arrays are added.
BUG=None
TEST=emerge-nami crosvm
Change-Id: I2b46b55f0e967d985d04678c240604b542e27e07
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2093287
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Add an `iter` method to the `Reader` struct so that callers can iterate
over the objects in place rather than having to store them in a separate
collection.
BUG=none
TEST=unit tests
Change-Id: I29671910a4244a8d7786ca2eb241416ae72b8c9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2093966
Tested-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Chirantan Ekbote <chirantan@chromium.org>
Current one vm could have one vfio device only, this patch let one vm
could have multi vfio devices by changing the vfio parameter into vec<>.
BUG=chromium:992270
TEST=passthrough two/three devices into guest, these devices are in the
same vfio group, then check these devices function in guest.
Change-Id: I366d24d750a199d7862fb907fa44f9be429c5944
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2080111
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
These have been marked as deprecated for several release; use --disk or
--rwdisk instead.
BUG=None
TEST=./build_test.py
Change-Id: I8a52c9abaf3f41e2dfc4189dd19c7d828802772e
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1906992
Reviewed-by: Zach Reizner <zachr@chromium.org>
Transfer plane offsets and strides for exported GPU resource over resource
bridge as well as a resource itself.
These metadata will be required by virtio-video decoder and encoder.
BUG=b:120456557
TEST=Start ARCVM on atlas
Change-Id: Iaf539857c0f8525bd5be294521e75ad32cae05e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1787032
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Keiichi Watanabe <keiichiw@chromium.org>
The test is flaky and causes continuous build failures.
BUG=chromium:1058881
TEST=Tests run, offending test is listed as ignored.
Exempt-From-Owner-Approval: Sheriff action to silence flakes on builders
Change-Id: I204e6ef548e6f203b0c15b0d01fde3b88660bd44
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2090414
Reviewed-by: Mattias Nissler <mnissler@chromium.org>
Commit-Queue: Mattias Nissler <mnissler@chromium.org>
Tested-by: Mattias Nissler <mnissler@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
VIRTIO_RING_F_EVENT_IDX use Wrapping(u16) for irq suppressing, this
test case to avoid some corner case for Wrapping.
BUG=None
TEST=Run build_test.py
Change-Id: I47d377056fefcc36739bb197e30319deafb0faf4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2073902
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>