From bd80380f98935a4b77e0bbc88df9014ba283c04f Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Tue, 14 May 2024 03:51:41 -0700 Subject: [PATCH] pvh works! --- crates/daemon/src/reconcile/guest/mod.rs | 4 ++-- crates/runtime/src/channel.rs | 30 +++++++++++++++++------- crates/runtime/src/launch.rs | 2 +- crates/xen/xenclient/src/sys.rs | 2 +- 4 files changed, 26 insertions(+), 12 deletions(-) diff --git a/crates/daemon/src/reconcile/guest/mod.rs b/crates/daemon/src/reconcile/guest/mod.rs index 01f503b..6e0e015 100644 --- a/crates/daemon/src/reconcile/guest/mod.rs +++ b/crates/daemon/src/reconcile/guest/mod.rs @@ -231,7 +231,7 @@ impl GuestReconciler { let start_status = guest.state.as_ref().map(|x| x.status()).unwrap_or_default(); let result = match start_status { GuestStatus::Starting => self.start(uuid, &mut guest).await, - // GuestStatus::Exited => self.exited(&mut guest).await, + GuestStatus::Exited => self.exited(&mut guest).await, GuestStatus::Destroying => self.destroy(uuid, &mut guest).await, _ => Ok(GuestReconcilerResult::Unchanged), }; @@ -289,7 +289,7 @@ impl GuestReconciler { starter.start(uuid, guest).await } - async fn _exited(&self, guest: &mut Guest) -> Result { + async fn exited(&self, guest: &mut Guest) -> Result { if let Some(ref mut state) = guest.state { state.set_status(GuestStatus::Destroying); Ok(GuestReconcilerResult::Changed { rerun: true }) diff --git a/crates/runtime/src/channel.rs b/crates/runtime/src/channel.rs index 982375b..0c5ee43 100644 --- a/crates/runtime/src/channel.rs +++ b/crates/runtime/src/channel.rs @@ -375,6 +375,10 @@ impl KrataChannelBackendProcessor { }; ring_ref = self.use_reserved_ref.unwrap_or(ring_ref); + debug!( + "channel backend for domain {} channel {}: ring-ref={} port={}", + self.domid, self.id, ring_ref, port, + ); break (ring_ref, port); } } @@ -388,14 +392,24 @@ impl KrataChannelBackendProcessor { self.store .write_string(format!("{}/state", self.backend), "4") .await?; - let memory = self.gnttab.map_grant_refs( - vec![GrantRef { - domid: self.domid, - reference: ring_ref as u32, - }], - true, - true, - )?; + let memory = self + .gnttab + .map_grant_refs( + vec![GrantRef { + domid: self.domid, + reference: ring_ref as u32, + }], + true, + true, + ) + .map_err(|e| { + anyhow!( + "failed to map grant ref {} for domid {}: {}", + ring_ref, + self.domid, + e + ) + })?; let mut channel = self.evtchn.bind(self.domid, port).await?; unsafe { let buffer = self.read_output_buffer(channel.local_port, &memory).await?; diff --git a/crates/runtime/src/launch.rs b/crates/runtime/src/launch.rs index 1d28ba8..d262908 100644 --- a/crates/runtime/src/launch.rs +++ b/crates/runtime/src/launch.rs @@ -138,7 +138,7 @@ impl GuestLauncher { } else { None }; - let cmdline_options = ["earlyprintk=xen,keep", "console=hvc0", "debug"]; + let cmdline_options = ["console=hvc0", "quiet"]; let cmdline = cmdline_options.join(" "); let guest_mac_string = container_mac.to_string().replace('-', ":"); diff --git a/crates/xen/xenclient/src/sys.rs b/crates/xen/xenclient/src/sys.rs index 06b6bbf..4acd037 100644 --- a/crates/xen/xenclient/src/sys.rs +++ b/crates/xen/xenclient/src/sys.rs @@ -138,7 +138,7 @@ pub const HVM_PARAM_STORE_EVTCHN: u32 = 2; pub const HVM_PARAM_IOREQ_PFN: u32 = 5; pub const HVM_PARAM_BUFIOREQ_PFN: u32 = 6; pub const HVM_PARAM_CONSOLE_PFN: u32 = 17; -pub const HVM_PARAM_CONSOLE_EVTCHN: u32 = 8; +pub const HVM_PARAM_CONSOLE_EVTCHN: u32 = 18; pub const HVM_PARAM_PAGING_RING_PFN: u32 = 27; pub const HVM_PARAM_MONITOR_RING_PFN: u32 = 28; pub const HVM_PARAM_SHARING_RING_PFN: u32 = 29;