controller: make image downloads async

This commit is contained in:
Alex Zenla
2024-02-25 05:38:23 +00:00
parent f66ab25521
commit 973db87b98
8 changed files with 112 additions and 66 deletions

View File

@ -92,16 +92,13 @@ impl BootSetup<'_> {
max_vcpus: u32,
mem_mb: u64,
) -> Result<BootState> {
debug!(
"BootSetup initialize max_vcpus={:?} mem_mb={:?}",
max_vcpus, mem_mb
);
debug!("initialize max_vcpus={:?} mem_mb={:?}", max_vcpus, mem_mb);
let total_pages = mem_mb << (20 - arch.page_shift());
self.initialize_memory(arch, total_pages)?;
let image_info = image_loader.parse()?;
debug!("BootSetup initialize image_info={:?}", image_info);
debug!("initialize image_info={:?}", image_info);
self.virt_alloc_end = image_info.virt_base;
let kernel_segment = self.load_kernel_segment(arch, image_loader, &image_info)?;
let mut p2m_segment: Option<DomainSegment> = None;
@ -152,7 +149,7 @@ impl BootSetup<'_> {
console_evtchn,
shared_info_frame: 0,
};
debug!("BootSetup initialize state={:?}", state);
debug!("initialize state={:?}", state);
Ok(state)
}
@ -259,7 +256,7 @@ impl BootSetup<'_> {
slice.fill(0);
segment.vend = self.virt_alloc_end;
debug!(
"BootSetup alloc_segment {:#x} -> {:#x} (pfn {:#x} + {:#x} pages)",
"alloc_segment {:#x} -> {:#x} (pfn {:#x} + {:#x} pages)",
start, segment.vend, segment.pfn, pages
);
Ok(segment)
@ -270,7 +267,7 @@ impl BootSetup<'_> {
let pfn = self.pfn_alloc_end;
self.chk_alloc_pages(arch, 1)?;
debug!("BootSetup alloc_page {:#x} (pfn {:#x})", start, pfn);
debug!("alloc_page {:#x} (pfn {:#x})", start, pfn);
Ok(DomainSegment {
vstart: start,
vend: (start + arch.page_size()) - 1,

View File

@ -254,7 +254,7 @@ impl BootImageLoader for ElfImageLoader {
let segments = elf.segments().ok_or(Error::ElfInvalidImage)?;
debug!(
"ElfImageLoader load dst={:#x} segments={}",
"load dst={:#x} segments={}",
dst.as_ptr() as u64,
segments.len()
);
@ -267,7 +267,7 @@ impl BootImageLoader for ElfImageLoader {
let segment_dst = &mut dst[base_offset as usize..];
let copy_slice = &data[0..filesz as usize];
debug!(
"ElfImageLoader load copy hdr={:?} dst={:#x} len={}",
"load copy hdr={:?} dst={:#x} len={}",
header,
copy_slice.as_ptr() as u64,
copy_slice.len()
@ -276,7 +276,7 @@ impl BootImageLoader for ElfImageLoader {
if (memsz - filesz) > 0 {
let remaining = &mut segment_dst[filesz as usize..memsz as usize];
debug!(
"ElfImageLoader load fill_zero hdr={:?} dst={:#x} len={}",
"load fill_zero hdr={:?} dst={:#x} len={}",
header.p_offset,
remaining.as_ptr() as u64,
remaining.len()

View File

@ -268,7 +268,7 @@ impl X86BootSetup {
}
debug!(
"BootSetup count_pgtables {:#x}/{}: {:#x} -> {:#x}, {} tables",
"count_pgtables {:#x}/{}: {:#x} -> {:#x}, {} tables",
mask, bits, map.levels[l].from, map.levels[l].to, map.levels[l].pgtables
);
map.area.pgtables += map.levels[l].pgtables;
@ -342,7 +342,7 @@ impl ArchBootSetup for X86BootSetup {
let size = self.table.mappings[m].area.pgtables as u64 * X86_PAGE_SIZE;
let segment = setup.alloc_segment(self, 0, size)?;
debug!(
"BootSetup alloc_page_tables table={:?} segment={:?}",
"alloc_page_tables table={:?} segment={:?}",
self.table, segment
);
Ok(segment)
@ -387,7 +387,7 @@ impl ArchBootSetup for X86BootSetup {
let mut pfn = ((max(from, lvl.from) - lvl.from) >> rhs) + lvl.pfn;
debug!(
"BootSetup setup_page_tables lvl={} map_1={} map_2={} pfn={:#x} p_s={:#x} p_e={:#x}",
"setup_page_tables lvl={} map_1={} map_2={} pfn={:#x} p_s={:#x} p_e={:#x}",
l, m1, m2, pfn, p_s, p_e
);
@ -439,7 +439,7 @@ impl ArchBootSetup for X86BootSetup {
(*info).cmdline[i] = c as c_char;
}
(*info).cmdline[MAX_GUEST_CMDLINE - 1] = 0;
trace!("BootSetup setup_start_info start_info={:?}", *info);
trace!("setup_start_info start_info={:?}", *info);
}
Ok(())
}
@ -456,7 +456,7 @@ impl ArchBootSetup for X86BootSetup {
for i in 0..32 {
(*info).vcpu_info[i].evtchn_upcall_mask = 1;
}
trace!("BootSetup setup_shared_info shared_info={:?}", *info);
trace!("setup_shared_info shared_info={:?}", *info);
}
Ok(())
}
@ -620,7 +620,7 @@ impl ArchBootSetup for X86BootSetup {
vcpu.user_regs.cs = 0xe033;
vcpu.kernel_ss = vcpu.user_regs.ss as u64;
vcpu.kernel_sp = vcpu.user_regs.rsp;
debug!("vcpu context: {:?}", vcpu);
trace!("vcpu context: {:?}", vcpu);
setup.call.set_vcpu_context(setup.domid, 0, &vcpu)?;
Ok(())
}