MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / start_vmm_thread

Function start_vmm_thread

vmm/src/lib.rs:451–581  ·  view source on GitHub ↗
(
    vmm_version: VmmVersionInfo,
    http_path: &Option<String>,
    http_fd: Option<RawFd>,
    #[cfg(feature = "dbus_api")] dbus_options: Option<DBusApiOptions>,
    api_event: EventFd,
    api_se

Source from the content-addressed store, hash-verified

449#[allow(unused_variables)]
450#[allow(clippy::too_many_arguments)]
451pub fn start_vmm_thread(
452 vmm_version: VmmVersionInfo,
453 http_path: &Option<String>,
454 http_fd: Option<RawFd>,
455 #[cfg(feature = "dbus_api")] dbus_options: Option<DBusApiOptions>,
456 api_event: EventFd,
457 api_sender: Sender<ApiRequest>,
458 api_receiver: Receiver<ApiRequest>,
459 #[cfg(feature = "guest_debug")] debug_path: Option<PathBuf>,
460 #[cfg(feature = "guest_debug")] debug_event: EventFd,
461 #[cfg(feature = "guest_debug")] vm_debug_event: EventFd,
462 exit_event: EventFd,
463 seccomp_action: &SeccompAction,
464 hypervisor: Arc<dyn hypervisor::Hypervisor>,
465 no_shutdown: bool,
466 landlock_enable: bool,
467) -> Result<VmmThreadHandle> {
468 #[cfg(feature = "guest_debug")]
469 let gdb_hw_breakpoints = hypervisor.get_guest_debug_hw_bps();
470 #[cfg(feature = "guest_debug")]
471 let (gdb_sender, gdb_receiver) = std::sync::mpsc::channel();
472 #[cfg(feature = "guest_debug")]
473 let gdb_debug_event = debug_event.try_clone().map_err(Error::EventFdClone)?;
474 #[cfg(feature = "guest_debug")]
475 let gdb_vm_debug_event = vm_debug_event.try_clone().map_err(Error::EventFdClone)?;
476
477 let api_event_clone = api_event.try_clone().map_err(Error::EventFdClone)?;
478 let hypervisor_type = hypervisor.hypervisor_type();
479
480 // Retrieve seccomp filter
481 let vmm_seccomp_filter = get_seccomp_filter(seccomp_action, Thread::Vmm, hypervisor_type)
482 .map_err(Error::CreateSeccompFilter)?;
483
484 let vmm_seccomp_action = seccomp_action.clone();
485 let thread = {
486 let exit_event = exit_event.try_clone().map_err(Error::EventFdClone)?;
487 thread::Builder::new()
488 .name("vmm".to_string())
489 .spawn(move || {
490 // Apply seccomp filter for VMM thread.
491 if !vmm_seccomp_filter.is_empty() {
492 apply_filter(&vmm_seccomp_filter).map_err(Error::ApplySeccompFilter)?;
493 }
494
495 let mut vmm = Vmm::new(
496 vmm_version,
497 api_event,
498 #[cfg(feature = "guest_debug")]
499 debug_event,
500 #[cfg(feature = "guest_debug")]
501 vm_debug_event,
502 vmm_seccomp_action,
503 hypervisor,
504 exit_event,
505 no_shutdown,
506 )?;
507
508 vmm.setup_signal_handler(landlock_enable)?;

Callers 1

start_vmmFunction · 0.85

Calls 14

newFunction · 0.85
start_dbus_threadFunction · 0.85
start_http_path_threadFunction · 0.85
start_http_fd_threadFunction · 0.85
gdb_threadFunction · 0.85
spawnMethod · 0.80
setup_signal_handlerMethod · 0.80
control_loopMethod · 0.80
get_seccomp_filterFunction · 0.70
try_cloneMethod · 0.45
hypervisor_typeMethod · 0.45

Tested by

no test coverage detected