Commit Graph

4961 Commits

Author SHA1 Message Date
Bo Chen
d8a333b935 versions: Move to cloud-hypervisor v0.8.0
[ port from runtime commit 17d265af6fc1f0913545bfa64e3e1a497f3e44c0 ]

Major new functionalities added in clh v0.8.0 include Experimental
Snapshot and Restore Support, Experimental ARM64 Support, 5-level guest
paging support, etc. Also, there are quite some bug fixings and CLI/API
changes for cleanup. More details can be found in the release note:
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v0.8.0.

Changes:

52b83969 build, release-notes: Document 0.8.0 release
776f8fc5 build: Update Cargo.lock
3f18f93f docs: Add a guide for testing on AArch64
97a1e5e1 vmm: Exit VMM event loop after guest shutdown for AArch64
5cd1730b vmm: Configure VM on AArch64
917219fa vmm: Enable VCPU for AArch64
b5f1c912 vmm: Enable memory manager for AArch64
eeeb45bb vmm: Enable device manager for AArch64
e9488846 vm-allocator: Enable vm-allocator for AArch64
5343b0ac net_util: Fix usage of deprecated mac_address method
bf37ebdc arch: x86_64: Add 5th level of paging when needed
abd6204d source: Fix file permissions
02ac1820 scripts: Ensure musl-gcc is used by musl build
cc85d896 tests: Extend test_*_reboot with checks on fd leaking
2ae547cf build(deps): bump vmm-sys-util from 0.6.0 to 0.6.1
f3556279 build(deps): bump serde_json from 1.0.54 to 1.0.55
dc034eb3 scripts: Only use musl for the Rust components
176d6716 build: Run musl builds in parallel to glibc builds
083189e5 build(deps): bump vcpkg from 0.2.9 to 0.2.10
2334b521 build(deps): bump syn from 1.0.30 to 1.0.31
99c99c24 build(deps): bump serde_json from 1.0.53 to 1.0.54
96a5e22b resources: kernel: Enable 5 levels of page table
653087d7 vmm: Reduce MMIO address space by 4KiB
5f0b6201 arch: x86_64: Enable CR4 LA57 feature
09fd3259 build: Use fork of vm-memory with less performance impact
5f9e079a device: Add AArch64 RTC PL031 implementation
625bab69 vmm: api: Allow to delete non-booted VMs
313883f6 remove duplicated structure InitrdConfig
afe60808 build(deps): bump synstructure from 0.12.3 to 0.12.4
aa79a92c tests: Add integration test for unprivileged network
9b71ba20 vmm, vm-virtio: Stop always autogenerating a host MAC address
1f8b6fa9 net_util: Allow retrieving the MAC address from the TAP device
929d70bc net_util: Only try and enable the TAP device if it not already enabled
eda9bfc7 vhost_user_fs: Replace the '--sock' parameter with '--socket'
a8cdf2f0 tests,vm-virtio,vmm: Use 'socket' for all CLI/API parameters
90e7accf ch-remote: Show response body from error
e436bbf3 build: Install libfdt in github cross-build workflow
2d13751d aarch64: Porting fdt related files from Firecracker
5a18dd36 aarch64: Porting AArch64 register implementation from Firecracker
d605fda3 aarch64: Porting GIC source files from Firecracker
ce624a6d aarch64: Add memory layout for AArch64
c7d44b88 build(deps): bump quote from 1.0.6 to 1.0.7
7c91dfae build(deps): bump proc-macro-nested from 0.1.4 to 0.1.5
17c16e5c build(deps): bump pin-project from 0.4.19 to 0.4.20
a2398742 build(deps): bump arc-swap from 0.4.6 to 0.4.7
b31fe72e build(deps): bump openssl-sys from 0.9.57 to 0.9.58
96497004 build(deps): bump dirs-sys from 0.3.4 to 0.3.5
eabf43fb Revert "tests: Extend test_*_reboot with checks on fd leaking"
7dc4e913 tests: Extend test_*_reboot with checks on fd leaking
601d898f build(deps): bump pin-project from 0.4.17 to 0.4.19
6ff107af vm-device: Switch to use get_host_address_range in vfio-ioctls
3336e801 vfio: Switch to the vfio-ioctls crate ch branch
d24aa72d vfio: Rename to vfio-ioctls
53ce5298 vfio: Move the PCI implementation to the PCI crate
8f7dc735 vmm: Move Vcpu::configure() to arch crate
969e5e0b vmm: Split configure_system() from load_kernel() for x86_64
20cf21cd vmm: Change booting process to cover AArch64 requirements
61aa4615 vhost_user_net: Implement VIRTIO_RING_F_EVENT_IDX
a4d377a0 vm-virtio: net: Implement VIRTIO_RING_F_EVENT_IDX
f0697073 vm-virtio: net: Handle lost interrupts on restore
a5596020 vm-virtio: Add some info! level debugging interrupt generation
cc51fdb8 vhost_user_net: Use NetQueuePair from vm-virtio
fcc62efc vm-virtio: net: Prepare NetQueuePair for use in vhost-user-net
2dbd1186 vm-virtio: net: Split network handling
237cb184 vm-virtio: net: Add further missing error reporting
36d072e6 vm-virtio: Add error propagation for TAP listener (un)registration
3151b5d8 vm-virtio: net: Refactor to support code reuse
22be88d3 build(deps): bump vfio-bindings from `887b3cf` to `f08cbcb`
6121f462 build(deps): bump vfio-bindings from `46ef9d4` to `887b3cf`
b731e63a build(deps): bump ryu from 1.0.4 to 1.0.5
d2d5ccb1 build(deps): bump proc-macro2 from 1.0.17 to 1.0.18
a1b9131b build(deps): bump syn from 1.0.29 to 1.0.30
2571b279 build(deps): bump vcpkg from 0.2.8 to 0.2.9
57f477ef build(deps): bump syn from 1.0.28 to 1.0.29
8a08ea46 build(deps): bump serde_derive from 1.0.110 to 1.0.111
b8ae30d4 build(deps): bump serde from 1.0.110 to 1.0.111
0a0fb246 build(deps): bump syn from 1.0.27 to 1.0.28
bc2921b2 build(deps): bump regex from 1.3.8 to 1.3.9
917ad530 build(deps): bump regex from 1.3.7 to 1.3.8
aac87196 build(deps): bump vm-memory from 0.2.0 to 0.2.1
4c2e6054 build: Update to latest version of container
c471ae94 Dockerfile: Update to latest Rust toolchain: 1.43.0
c31ad72e build: Address issues found by 1.43.0 clippy
fbd1a6c5 vmm: api: Return complete error responses in handle_http_request()
0728bece vmm: seccomp: Ensure that umask() can be reprogrammed
3497eeff main: Set the umask to 0077
c1d15de7 build(deps): bump syn from 1.0.25 to 1.0.27
a4bb96d4 build(deps): bump libc from 0.2.70 to 0.2.71
bfd52ad8 build(deps): bump linux-loader from `bd01b6d` to `1af92d2`
8f1f9d9e devices: Implement InterruptController on AArch64
b32d3025 devices: Refactor IOAPIC to cover other architectures
d5884180 build(deps): bump syn from 1.0.24 to 1.0.25
83c18de5 build(deps): bump proc-macro-hack from 0.5.15 to 0.5.16
7708b95e build(deps): bump syn from 1.0.23 to 1.0.24
749f2f03 build(deps): bump proc-macro2 from 1.0.15 to 1.0.17
c98d6fd0 build(deps): bump openssl-sys from 0.9.56 to 0.9.57
a9ca493b build(deps): bump proc-macro2 from 1.0.14 to 1.0.15
974c7138 build(deps): bump thiserror from 1.0.18 to 1.0.19
321c479b build(deps): bump proc-macro2 from 1.0.13 to 1.0.14
4f5c8be3 build: Added a workflow to cross-build targetting AArch64
1befae87 build: Fixed build errors and warnings on AArch64
0090ec2d build: Updated development utilities for AArch64
af8292b6 vmm, config, vhost_user_blk: remove "wce" parameter
9101bdd7 vm-virtio: block: Ensure backing file consistency
dc66eee8 vhost_user_block: Ensure backing file consistency
10db2131 vm-virtio: block: Add "writeback" control to Request
b94d9a30 vhost_user_backend: Allow backends to know features that can be used
9d88ba7a vhost_user_block: Use VirtioBlockConfig from vm-virtio
1fac2632 vm-virtio: Use config name as per spec
077a5c36 build(deps): bump syn from 1.0.22 to 1.0.23
a813b57f vm-virtio, vhost_user_{fs,block,backend}: Move EVENT_IDX handling
8ae7a38d build: Use same virtio-bindings version
3947809c vm-virtio: block: Ensure that VIRTIO_BLK_T_FLUSH requests actually sync
ca6edafb build(deps): bump cc from 1.0.53 to 1.0.54
a7f236b8 ci: Extend snapshot/restore to validate virtio-vsock
f442c62b vm-virtio: Implement Snapshottable trait for Vsock
f9759988 ci: Extend snapshot/restore test with virtio-iommu
646d33fe vm-virtio: Set queue fields explicitely during restore
02cbea54 vm-virtio: Implement Snapshottable trait for Iommu
4f89cb05 build(deps): bump linux-loader from `43d1c51` to `bd01b6d`
14db7b0a build(deps): bump addr2line from 0.12.0 to 0.12.1
9f2eddd9 ci: Fix test_serial_off
7c3e19c6 vhost_user_backend, vmm: Close leaked file descriptors
35782bd9 vm-virtio: Close file descriptors created by epoll::create()
039accc1 vhost_user_net, vm-virtio: Interrupt guest when TX queue is updated
c8a081e4 build(deps): bump pin-project from 0.4.16 to 0.4.17
b80a7d01 build(deps): bump vmm-sys-util from 0.5.0 to 0.6.0
e6fd6d63 vhost_user_block: Implement VIRTIO_BLK_F_FLUSH
95e3edda build(deps): bump quote from 1.0.5 to 1.0.6
d760010c build(deps): bump ppv-lite86 from 0.2.6 to 0.2.8
0cde08a7 build(deps): bump hermit-abi from 0.1.12 to 0.1.13
3adfe3fb build(deps): bump syn from 1.0.21 to 1.0.22
85aadd15 build(deps): bump proc-macro2 from 1.0.12 to 1.0.13
c764c212 build(deps): bump thiserror from 1.0.17 to 1.0.18
4366dd92 vm-virtio: block: Add support for VIRTIO_RING_F_EVENT_IDX
5a55fc07 vhost_user_fs: Fix seccomp filter for musl
391508f0 tests: Add tests checking for host MAC address setting
1b8b5ac1 vhost-user_net, vm-virtio, vmm: Permit host MAC address setting
11049401 vmm: seccomp: Add ioctl() commands interface hardware address
59e1361f net_util: tap: Add support for setting tap MAC address
68fc4329 vmm: Update seccomp filters with clock_nanosleep
badf8261 build(deps): bump anyhow from 1.0.30 to 1.0.31
7b10f732 build(deps): bump cc from 1.0.52 to 1.0.53
4120a7de vhost_user_fs: Add seccomp
6aa29bdb vmm: api: Use a common handler for data actions too
0fe223f0 vmm: api: Extend VmAction to reduce code duplication
6ec605a7 vmm: api: Refactor generic action handler
c652625b vmm: api: Add a default implementation for simple PUT requests
a3e8bea0 vmm: api: Move HttpError enum to http module
6aab0a54 vhost_user_fs: Implement support for optional sandboxing
c4bf383f vhost_user_*: Create a vhost::Listener in advance
fa844865 vhost_user_fs: Allow callers to provide a fd for /proc/self/fd
831cff3f vhost_user_fs: Use a fd for /proc/self/fd instead of /proc
ba4ec7fc ci: Extend snapshot_restore_test with hotplug
9e165c2c ci: Enable snapshot/restore integration test
c566f1f0 build(deps): bump once_cell from 1.3.1 to 1.4.0
7ffde295 build(deps): bump backtrace from 0.3.47 to 0.3.48
e9c2dbc8 build(deps): bump anyhow from 1.0.29 to 1.0.30
9ccc7daa build, vmm: Update to latest kvm-ioctls
80aa0a75 tests: Test unplugging virtio-fs
88ec93d0 vmm: config: Add missing "id" from FsConfig parsing
0f89f5ec build(deps): bump anyhow from 1.0.28 to 1.0.29
ab3d374a build(deps): bump syn from 1.0.20 to 1.0.21
35b8992e build(deps): bump thiserror from 1.0.16 to 1.0.17
3415b11d build(deps): bump quote from 1.0.4 to 1.0.5
6989bf05 build(deps): bump backtrace from 0.3.46 to 0.3.47
2991fd2a build(deps): bump libc from 0.2.69 to 0.2.70
c37da600 vmm: Update DeviceTree upon PCI BAR reprogramming
d0ae9d7c vmm: Share the DeviceTree across threads
5e9d2545 vmm: Store and restore virtio-pci BAR resources
02bd50f6 vm-virtio: Add helper to set the configuration BAR value
8a826ae2 vmm: Store and restore virtio-pci device on right PCI slot
98dac352 vmm: Add optional PCI b/d/f to each DeviceNode
1e0ebb76 pci: Allow specific PCI b/d/f to be reserved
e577b64a build(deps): bump syn from 1.0.19 to 1.0.20
36bffff2 tests: Expand the test_large_memory() test to cover lots of vCPUs
b9ba81c3 arch, vmm: Don't build mptable when using ACPI
16ac24d8 tests: Only test "noacpi" test when we don't build with ACPI
bb8d19bb arch: Check RSDP address does not go past memory
1c44e917 build(deps): bump clap from 2.33.0 to 2.33.1
4cd2eccf build(deps): bump signal-hook from 0.1.14 to 0.1.15
308b790c vm-virtio: Implement Snapshottable trait for VirtioPciDevice
6d594286 vm-virtio: Implement Snapshottable trait for VirtioPciCommonConfig
e1701f11 pci: Implement Snapshottable trait for PciConfiguration
376db311 pci: Implement Snapshottable trait for MsixConfig
52ac3779 tests: Remove network interface from test_memory_overhead
b57eeb96 vhost_user_block: Add "queue_size" to --block-backend
5016fcf8 vhost_user_block: Use config::OptionParser to simplify block backend parsing
592de97f vhost_user_net: Use config::OptionParser to simplify net backend parsing
f3f398eb vhost_user_block: Consolidate the vhost-user-block backend syntax
3220292d vhost_user_net: Consolidate the vhost-user-net backend syntax
0d2be3b6 build(deps): bump serde from 1.0.107 to 1.0.110
9d8754c6 build(deps): bump pin-project from 0.4.13 to 0.4.16
9bac13de build(deps): bump serde_json from 1.0.52 to 1.0.53
e8d4a13e build(deps): bump serde_derive from 1.0.107 to 1.0.110
d8f181c5 build(deps): bump futures from 0.3.4 to 0.3.5
1e44ac51 build(deps): bump serde_derive from 1.0.106 to 1.0.107
c197bd6f build(deps): bump serde from 1.0.106 to 1.0.107
475040b2 vm-virtio: Correctly reset the virtqueues
d809f2fe vm-virtio: Add virtio reset() support to MmioDevice
0d720cc3 bin: ch-remote: Ensure ch-remote supports syntax it advertises
74d88c4c build(deps): bump openssl-sys from 0.9.55 to 0.9.56
9adc32a0 tests: Print out details for smaps in test_memory_overhead
250f825f tests: Check that requesting tap name for virtio-net succeeds
006da040 tests: Check tap name provided is used for vhost_user_net tests
54b3329f tests: Add tests that use (non-existing) named tap
6fde2d18 build: Strip the binaries before using/releasing them
a4d23c3c build(deps): bump syn from 1.0.18 to 1.0.19
12e00c0f vmm: cpu: Retry sending signals if necessary
31bde4f5 vmm: Unpark the DeviceManager threads in shutdown
801e72ac vmm: cpu: Unpause vCPU threads
91a4a258 vmm: cpu: When coming out of the pause event check for a kill signal
cd60de8f Revert "vmm: vm: Unpark the threads before shutdown when the current state is paused"
797cd13d build(deps): bump vec_map from 0.8.1 to 0.8.2
f6a71bec vmm: Add unit tests for DeviceTree
64e01684 vmm: Create new module device_tree
3b77be90 vmm: Add device_node!() macro to improve code readability
83ec716e vmm: Create breadth-first search iterator for the DeviceTree
b91ab1e3 vmm: Remove the list of migratable devices
1be70372 vmm: Don't use migratable_devices for restore
bc608439 vmm: Add migratable field to the DeviceNode
7fec020f vmm: Create a dedicated DeviceTree structure
14b379de vmm: Add an identifier field to DeviceNode structure
0805d458 vmm: Add support for multiple children per DeviceNode
daaeba51 vmm: Change Node into DeviceNode
5c7df03e vmm: Store and restore virtio-pmem resources
2e6895d9 vmm: Store and restore virtio-fs resources
987f8215 vmm: Store and restore virtio-mmio resources
9cb1e1cc vmm: Perform MMIO allocation from virtio-mmio device creation
adf29706 vmm: Create devices in different path if restoring the VM
d39f91de vmm: Reorganize DeviceManager creation
89c2a586 vmm: Restore devices following the device tree
52c80cfc vmm: Snapshot and restore DeviceManager state
5b408eec vmm: Create a device tree
a6fde0bb vm-device: Define a Resource
b8841d7a tests: Validate vsock functionality works across a reboot
fec97e05 vm-virtio, vmm: Delete unix socket on shutdown
5109f914 vmm: config: Reject attempts to use VFIO or IOMMU without PCI
cb220ae1 tests: Add some debugging to test_memory_overhead
eb3d9d15 build(deps): bump ssh2 from 0.8.0 to 0.8.1
59b73034 build(deps): bump failure from 0.1.7 to 0.1.8
dd0791d7 build(deps): bump pnet from 0.25.0 to 0.26.0
7660a104 build(deps): bump failure_derive from 0.1.7 to 0.1.8
327d67fa virtio-mem: Return reize error in MemEpollHandler.run
bc318b64 build(deps): bump proc-macro2 from 1.0.10 to 1.0.12
5571c6af build(deps): bump signal-hook from 0.1.13 to 0.1.14
af3d0802 build(deps): bump pnet_macros from 0.25.0 to 0.26.0
678855e8 build(deps): bump term_size from 0.3.1 to 0.3.2
2a16ce7e build(deps): bump quote from 1.0.3 to 1.0.4
99e3a150 build(deps): bump backtrace-sys from 0.1.36 to 0.1.37

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:39 -07:00
Jose Carlos Venegas Munoz
9177d3a3b7 virtiofsd: Use cache=auto
[ port from runtime commit 4645d3e6ef2e99dae1f2b3a7bfded6fc304d3023 ]

Today for virtiofsd kata sets by default `cache=always`. This option is
useful for performance but if the shared files are modified from the
host changes are not updated in the guest as virtiofsd uses cached value
all time.

This patch changes to  `cache=auto` to fix consistency issues. The option
can still be set to always if it is wanted by the user.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:39 -07:00
Pradipta Kr. Banerjee
d66f21921b cli: Fix kata-env output on Power
[ port from runtime commit 9ac39116b08148de8e66abfca2e5407bc153af87 ]

kata-env output always shows "VMContainerCapable=false" on Power.
This patch fixes the same.

Signed-off-by: bpradipt@in.ibm.com
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:39 -07:00
Jose Carlos Venegas Munoz
94fdec4e4b clh: Allow add virtiofs args and cache options from config
[ port from runtime commit e5a3211c74e20e9878fd0f5d1c80a3c4354eabd1 ]

Today some options for virtiofsd could improve compatibility
for example xattrs for dnf or cache=auto for file consistency
for changes in the host. Allow users can enabled as requiered.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:39 -07:00
Bo Chen
653df674d3 kata_agent: Add unit tests
[ port from runtime commit 6be76fcd07a3d74ca5521af2feaf966dd6f2c344 ]

This patch adds the unit test for 'handleDeviceBlockVolume()'.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
Bo Chen
6da49a0418 clh: Clear the "PCIAddr" field while blk device hotplug
[ port from runtime commit 5b96e01f1ba3b0458539c1c920d0c1aab7d5968e ]

We explicitly set "PCIAddr" to NULL, so that the "VirtPath" field can be
used by the agent to create the container.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
Bo Chen
2d6c0731eb kata_agent: Pass "VirtPath" with "PCIAddr" of blk devices to agent
[ port from runtime commit 50c1dce137bb3d608daa931c01e4941ed5fdb6cc ]

In case the "PCIAddr" of block devices is not available (e.g.
cloud-hypervisor), we also pass the "VirtPath" to the agent for adding
block devices to the container.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
Bo Chen
56ae20990d kata_agent: Allow to use "VirtPath" as volume source for blk devices
[ port from runtime commit aea29b64b66f75049cb045f9e41dff2becdbebdc ]

When the "PCIAddr" of block device is not available (e.g. cloud-hypervisor), we
allow to use the "VirtPath" as the volume source for creating containers.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
Shuicheng Lin
bdd386ba14 qemu: Fix rtc parameter is not set to qemu
[ port from runtime commit 379f19f7ccd71ebe938d9d6fe3cfe5f05f4f02bf ]

Add default value for Clock, otherwise rtc parameter will be dropped
by Valid function. "host" is the default value in qemu for rtc clock.

Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
Pradipta Kr. Banerjee
51a6d60ab4 qemu: Remove PMU feature for Power (ppc64le) platform
[ port from runtime commit 6b32472c2138536ea7e859360498f175601d9ec9 ]

The bug got introduced in 06571f0

Signed-off-by: bpradipt@in.ibm.com
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-30 04:04:38 -07:00
bin liu
3ece4130c9 runtime: clean up shim abstraction
This PR will delete shim abstraction from sandbox.

Fixes: #364

Signed-off-by: bin liu <bin@hyper.sh>
2020-06-30 15:52:20 +08:00
Yang Bo
c03b796cfe
Merge pull request #356 from lifupan/fix_log
Fix issue of debug console
2020-06-30 11:48:17 +08:00
Jia He
3a17e7aafe qemu: Remove pmu limitation in nested virtualization of amd/ppc64le
[ port from runtime commit 18662e16687453185ff4cf99b495a34e3ea9935f ]

It's up to the user enable/disable pmu. After previous commit, the default
pmu option has been set to off.

This patch removes the hard limitation and unit test codes.

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:33:46 -07:00
Jia He
06571f0377 build: Add "pmu=off" to default cpu_features option
[ port from runtime commit 41a06d4961f51af4ec4799aaee202c744584f31e ]

The user sometimes doesn't care about pmu usage(e.g. perf tool profiling).
But pmu will cost significant overhead on boot time and virtualization
context switch. E.g. on arm64, if guest pmu is enabled, kvm should save
and restore all PMU registers when guest/host switching.

for dmesg comparision:
Before:
[    0.007620] bus: 'platform': driver_probe_device: matched device pmu with driver armv8-pmu
[    0.007622] bus: 'platform': really_probe: probing driver armv8-pmu with device pmu
[    0.036282] hw perfevents: enabled with armv8_pmuv3 PMU driver, 7 counters available
[    0.036285] driver: 'armv8-pmu': driver_bound: bound to device 'pmu'
[    0.036295] bus: 'platform': really_probe: bound device pmu to driver armv8-pmu

After:
[    0.007935] bus: 'platform': driver_probe_device: matched device alarmtimer with driver alarmtimer
[    0.007937] bus: 'platform': really_probe: probing driver alarmtimer with device alarmtimer
[    0.007940] driver: 'alarmtimer': driver_bound: bound to device 'alarmtimer'
[    0.007944] bus: 'platform': really_probe: bound device alarmtimer to driver alarmtimer

Because s390 doest support "pmu=off", keep the default CPUFEATURES to be ""
instead of "pmu=off".

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:20:58 -07:00
Jia He
115dfa19cd annotations: add cpu_features
[ port from runtime commit f03c17d107999fd68da87d98ab3e242ac7843051 ]

So that users can use annotations to set it.

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:19:21 -07:00
Jia He
fa9d619e8a qemu: add cpu_features option
[ port from runtime commit 0100af18a2afdd6dfcc95129ec6237ba4915b3e5 ]

To control whether guest can enable/disable some CPU features. E.g. pmu=off,
vmx=off. As discussed in the thread [1], the best approach is to let users
specify them. How about adding a new option in the configuration file.

Currently this patch only supports this option in qemu,no other vmm.

[1] https://github.com/kata-containers/runtime/pull/2559#issuecomment-603998256

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:16:11 -07:00
Archana Shinde
520295b938 network: Detect and add static ARP entries
[ port from runtime commit 67d3e2c5c5d11738c0c0ff46b1228909a6c81ab0 ]

Some network plugins add static arp entries in the network namespace.
Scan namespace for static entries and pass these on to the
agent to be added within the guest.

If the grpc api is not implemented by the agent due to a older running
agent, check for this and do not error out to maintain
backward compatibility.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:06:15 -07:00
Jose Carlos Venegas Munoz
117ce4ac41 clh: remove slow boot debug flags from kernel cmdline
[ port from runtime commit 6c517548429da06d33172c8e135dc9b9a297175d ]

The systemd debug  and kernel init call debug flags make slow the boot.
The flags are not really related with the hypervisor and
can be added if needed using extra kernel command line options.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:03:16 -07:00
Jose Carlos Venegas Munoz
70137962d6 clh: Remove vsock log port in kernel cmdline
[ port from runtime commit 160e3a7c98043a52032b15cc8f6e32a91b032258 ]

Cloud hypervisor logs console via stdout. Using console logs help
to get not only agent logs but early boot kernel logs.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:02:30 -07:00
Jose Carlos Venegas Munoz
fd5d139470 clh: Improve hypervisor logging
[ port from runtime commit e1ee00d16ed621594a92ce0456eb048362962ff0 ]

Use systemd-cat to collect hypervisor output. The `systemd-cat` program
will open a journal fd and call `cat(1)` to redirect all the output to
the fd. This requires an extra binary to read from hypervisor stdout
(that has combined stdin, stderr and serial terminal). But because it is
cat the overhead is minimal and only is started on Kata debug mode.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 20:00:34 -07:00
Bo Chen
21f83348e9 clh: Set 'virtio-blk' as the default block device driver
[ port from runtime commit 5e5527204c03036f1d1a6b3122c1e0c3e1d1ba94 ]

The block device driver defaults to 'virtio-scsi' when it is not set in
the hypervisor configuration file, while cloud-hypervisor supports only
'virtio-blk' for its block devices.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 19:59:02 -07:00
Bo Chen
8b5eed70f7 clh: Enable disk block device hotplug support
[ port from runtime commit c5f97b24d7a1eaac216f144b2c5429feb3451553 ]

With this patch, the container image can be shared from host with guest
as a block device when the 'devicemapper' is used as the storage driver
for docker. Note: The 'block_device_driver="virtio-blk"' entry is
required in the hypervisor config file to work properly.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 19:58:00 -07:00
Xu Wang
c20179ee0e
Merge pull request #353 from bergwolf/runtime-port-2
runtime port -- wave 2
2020-06-30 10:49:39 +08:00
fupan.lfp
883af9c76f agent: set hostname when running as init
it's better to set the right hostname to
guest when run rust-agent as the init process.

Fixes: #355

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-06-29 19:38:48 +08:00
fupan.lfp
899b75f2de agent: fix the issue of missing found right shell
It should iter the shells to find the existing shell
command instead of return an error directly when it
meet an absent shell command.

Fixes: #354

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-06-29 19:38:34 +08:00
Hui Zhu
e761ad318f
Merge pull request #352 from bergwolf/runtime-port-1
port runtime commits -- wave 1
2020-06-29 16:33:02 +08:00
Peng Tao
2a8650baa1 agent-ctl: add Cargo.lock
A binary cargo should go with Cargo.lock

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:27:50 -07:00
Peng Tao
a8430b3791 gitignore: ignore more files
We don't need to track them.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:27:05 -07:00
Christophe de Dinechin
be9ca0d58b qemu: Don't leak file descriptors in case of error
[ port from runtime commit 7b269ff7aa2d62fe12593ff7040798e6c9bd5d65 ]

If we take one of the error paths from setupVirtiofsd() after
opening the fd variable, the fd.Close() function is not called.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:19:18 -07:00
Jose Carlos Venegas Munoz
60606647de virtiofsd: Improve logging
[ port from runtime commit 882a82393305a4b11a77744b5fc77b98e42d15b9 ]

Send virtiofsd logs to syslog in the same way that qemu implementation
does. This requires not to wait for messages from virtiofsd stdout. This
takes the qemu implementation approach. Give the socket fd to virtiofsd.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:16:08 -07:00
Alex Price
7e250f29e9 shim: exit out of oom polling if unimplemented
[ port from runtime commit 86f581068eb9dc4b6862c7415cdc912e111177dd ]

This exits out of polling for OOM events if the getOOMEvent
method is unimplemented.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:11:54 -07:00
Alex Price
9f8d1baa57 virtcontainers: tests fix, nit fix
[ port from runtime commit b4833a48c81132e5a6b1c25a764cd0ebbdc6afff ]

fix tests and nit

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:08:54 -07:00
Liam Merwick
d3b3e8bee6 virtcontainers: x86: Support microvm machine type
[ port from runtime commit 6aff077901021d9a0075c446dfe281b2487e1487 ]

With the addition of support to govmm for multiple transports (intel/govmm#111)
and microvm (intel/govmm#121) we can now enable support for the 'microvm'
machine type in kata-runtime.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:06:30 -07:00
Alex Price
198339367b virtcontainers: add support for getOOMEvent agent endpoint to sandbox
[ port from runtime commit 86686b56a2bf7f6dd62f620278ae289564da51d0 ]

This adds support for the getOOMEvent agent endpoint to retrieve OOM
events from the agent.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:51:23 -07:00
Alex Price
7c205be27d virtcontainers: add support for getOOMEvent agent endpoint to sandbox
[ port from runtime commit 86686b56a2bf7f6dd62f620278ae289564da51d0 ]

This adds support for the getOOMEvent agent endpoint to retrieve OOM
events from the agent.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:42:08 -07:00
Peng Tao
380f07ec4b proto: update agent protocol
To add GetOOMEvent API.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:34:38 -07:00
James O. D. Hunt
dbc1c30d9e versions: Remove golangci-lint and gometalinter entries
Removed the `golangci-lint` and `gometalinter` entries from the versions database:

- The `golangci-lint` package is now tracked in the `tests` versions database:

  https://github.com/kata-containers/tests/blob/master/versions.yaml

- The `gometalinter` package is no longer used.

See:

- https://github.com/kata-containers/tests/issues/1323
- d676140510

Fixes: #2636.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-06-28 20:51:51 -07:00
Jia He
6e7dd435a2 qemu: arm64: Set defaultGICVersion to 3 to limit the max vCPU number
[ port from runtime commit ee985a608015d81772901c1d9999190495fc9a0a ]

After removing dectect of host gic version, we need to limit the max vCPU
in different cases.

Given that in most cases, Kata is running on gicv3 host, set it as default
value. If the user really want to run Kata on gicv2 host, he/she need to
set default_maxvcpus in toml file to 8 instead of 0.

In summary, If the user uses host gicv3 gicv4, everything is fine
            If the user uses host gicv2, set default_maxvcpus=8

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:48:48 -07:00
Wainer dos Santos Moschetta
93d1f7b4e3 Subject: [PATCH] versions: Misc changes to descriptions
[ port from runtime commit c4b5922df2 ]

Most of the description fields have capitalized text,
some of those that don't are then converted on this
change.

Fixed spelling of 'required'.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:45:21 -07:00
Jia He
17b3021b54 Subject: [PATCH] qemu: arm64: Don't detect gic version by /proc/interrupts
[ port from runtime repository commit 4d4a153af5cb145215cb6e6e386eac2bcb8c3e32 ]

Commit b4385901da ("qemu/arm64: Detect host GIC version to configure guest
GIC") reads /proc/interrupts to detect the host gic version.

But on a ThunderX2 host with 224 cpus, the /proc/interrupts is ~762K bytes.
Hence it will costs ~900K bytes memory overhead.
From the go tool pprof results:
      flat  flat%   sum%        cum   cum%
  976.89kB   100%   100%   976.89kB   100%  github.com/kata-containers/runtime/virtcontainers.getHostGICVersion
Although the allocated memory will be freed, seems it worthy removing that
for speed up the runtime.

As per [1], there is no perfect way to detect the gic version on host.
At qemu side, if we use "gic-version=host", qemu will automatically detect
the verion by kvm ioctl. So we'd better let qemu determine the gic version.

If the user really want to start vm with gic-verion=2, he/she can set it
in machine_accelerators option.

[1]https://lists.cs.columbia.edu/pipermail/kvmarm/2014-October/011690.html

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:43:16 -07:00
Penny Zheng
4cda90abcb dax: enable dax on arm64
[ port from runtime repository commit e36389e25e ]

After backporting patch series of enabling memory hot remove on aarch64
to v5.4.x, we finally could enable nvdimm/dax on aarch64.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:40:41 -07:00
Peng Tao
7a44025464 Makefile: add trace-forwarder/agent-ctl missing targets
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:36:33 -07:00
Ted Yu
61e011e86b vc: Version support check is ineffective in createSandbox
[ port from runtime repository commit 7e47046111 ]

If major version matches max supported major, we continue comparing the minor version.

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:32:55 -07:00
Fupan Li
0c5ace57d5
Merge pull request #346 from bergwolf/builder
osbuilder: use newest golang
2020-06-28 17:16:55 +08:00
Fupan Li
acab606f98
Merge pull request #344 from bergwolf/build
Fix make file and trace-forwarder build failure
2020-06-28 17:16:00 +08:00
Peng Tao
ebfbca031b osbuilder: use newest golang
Instead of the oldest one.

Fixes: #345
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:42:30 -07:00
Peng Tao
0fd1eb59a4 Makefile: add default rule
Otherwise `make` would only build the agent.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:16:53 -07:00
Peng Tao
3f8d4b6822 trace-forwarder: add Cargo.lock
And rely on protobuf 2.14.0. Otherwise build fails as protobuf 2.15.0
requires unstable cargo.

error[E0658]: non-builtin inner attributes are unstable

Fixes: #343
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:16:40 -07:00
Peng Tao
e587abe6b4
Merge pull request #333 from jodh-intel/improve-toplevel-makefile
build: Improve top-level Makefile
2020-06-26 16:20:01 +08:00
Peng Tao
a3d77bc0d1
Merge pull request #338 from amshinde/remove-workaround-sharedpid
shimv2 : Remove workaround for sharedPidNs
2020-06-26 16:18:48 +08:00