mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 13:14:33 +00:00
memory: remove reserve_memory_bytes
This is currently an unsupported feature and we will remove it from the current code. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
This commit is contained in:
parent
bde6609b93
commit
cb54ac6c6e
@ -428,16 +428,6 @@ impl VmmService {
|
|||||||
|
|
||||||
config.mem_file_path = machine_config.mem_file_path.clone();
|
config.mem_file_path = machine_config.mem_file_path.clone();
|
||||||
|
|
||||||
let reserve_memory_bytes = machine_config.reserve_memory_bytes;
|
|
||||||
// Reserved memory must be 2MB aligned and less than half of the total memory.
|
|
||||||
if reserve_memory_bytes % 0x200000 != 0
|
|
||||||
|| reserve_memory_bytes > (config.mem_size_mib as u64) << 20
|
|
||||||
{
|
|
||||||
return Err(MachineConfig(InvalidReservedMemorySize(
|
|
||||||
reserve_memory_bytes as usize >> 20,
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
config.reserve_memory_bytes = reserve_memory_bytes;
|
|
||||||
if config.mem_type == "hugetlbfs" && config.mem_file_path.is_empty() {
|
if config.mem_type == "hugetlbfs" && config.mem_file_path.is_empty() {
|
||||||
return Err(MachineConfig(InvalidMemFilePath("".to_owned())));
|
return Err(MachineConfig(InvalidMemFilePath("".to_owned())));
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,6 @@ pub struct VmConfigInfo {
|
|||||||
pub mem_file_path: String,
|
pub mem_file_path: String,
|
||||||
/// The memory size in MiB.
|
/// The memory size in MiB.
|
||||||
pub mem_size_mib: usize,
|
pub mem_size_mib: usize,
|
||||||
/// reserve memory bytes
|
|
||||||
pub reserve_memory_bytes: u64,
|
|
||||||
|
|
||||||
/// sock path
|
/// sock path
|
||||||
pub serial_path: Option<String>,
|
pub serial_path: Option<String>,
|
||||||
@ -149,7 +147,6 @@ impl Default for VmConfigInfo {
|
|||||||
mem_type: String::from("shmem"),
|
mem_type: String::from("shmem"),
|
||||||
mem_file_path: String::from(""),
|
mem_file_path: String::from(""),
|
||||||
mem_size_mib: 128,
|
mem_size_mib: 128,
|
||||||
reserve_memory_bytes: 0,
|
|
||||||
serial_path: None,
|
serial_path: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,12 +507,6 @@ impl Vm {
|
|||||||
|
|
||||||
// vcpu boot up require local memory. reserve 100 MiB memory
|
// vcpu boot up require local memory. reserve 100 MiB memory
|
||||||
let mem_size = (self.vm_config.mem_size_mib as u64) << 20;
|
let mem_size = (self.vm_config.mem_size_mib as u64) << 20;
|
||||||
let reserve_memory_bytes = self.vm_config.reserve_memory_bytes;
|
|
||||||
if reserve_memory_bytes > (mem_size >> 1) as u64 {
|
|
||||||
return Err(StartMicroVmError::ConfigureInvalid(String::from(
|
|
||||||
"invalid reserve_memory_bytes",
|
|
||||||
)));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mem_type = self.vm_config.mem_type.clone();
|
let mem_type = self.vm_config.mem_type.clone();
|
||||||
let mut mem_file_path = String::from("");
|
let mut mem_file_path = String::from("");
|
||||||
@ -543,12 +534,10 @@ impl Vm {
|
|||||||
|
|
||||||
info!(
|
info!(
|
||||||
self.logger,
|
self.logger,
|
||||||
"VM: mem_type:{} mem_file_path:{}, mem_size:{}, reserve_memory_bytes:{}, \
|
"VM: mem_type:{} mem_file_path:{}, mem_size:{}, numa_regions:{:?}",
|
||||||
numa_regions:{:?}",
|
|
||||||
mem_type,
|
mem_type,
|
||||||
mem_file_path,
|
mem_file_path,
|
||||||
mem_size,
|
mem_size,
|
||||||
reserve_memory_bytes,
|
|
||||||
numa_regions,
|
numa_regions,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ fn configure_system<M: GuestMemory>(
|
|||||||
initrd: &Option<InitrdConfig>,
|
initrd: &Option<InitrdConfig>,
|
||||||
boot_cpus: u8,
|
boot_cpus: u8,
|
||||||
max_cpus: u8,
|
max_cpus: u8,
|
||||||
rsv_mem_bytes: u64,
|
|
||||||
) -> super::Result<()> {
|
) -> super::Result<()> {
|
||||||
const KERNEL_BOOT_FLAG_MAGIC: u16 = 0xaa55;
|
const KERNEL_BOOT_FLAG_MAGIC: u16 = 0xaa55;
|
||||||
const KERNEL_HDR_MAGIC: u32 = 0x5372_6448;
|
const KERNEL_HDR_MAGIC: u32 = 0x5372_6448;
|
||||||
@ -111,17 +110,6 @@ fn configure_system<M: GuestMemory>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reserve memory from microVM.
|
|
||||||
if rsv_mem_bytes > 0 {
|
|
||||||
add_e820_entry(
|
|
||||||
&mut params.0,
|
|
||||||
mem_end.raw_value().max(mmio_end.raw_value()) + 1,
|
|
||||||
rsv_mem_bytes,
|
|
||||||
bootparam::E820_RESERVED,
|
|
||||||
)
|
|
||||||
.map_err(Error::BootSystem)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
let zero_page_addr = GuestAddress(layout::ZERO_PAGE_START);
|
let zero_page_addr = GuestAddress(layout::ZERO_PAGE_START);
|
||||||
guest_mem
|
guest_mem
|
||||||
.checked_offset(zero_page_addr, mem::size_of::<bootparam::boot_params>())
|
.checked_offset(zero_page_addr, mem::size_of::<bootparam::boot_params>())
|
||||||
@ -237,7 +225,6 @@ impl Vm {
|
|||||||
&initrd,
|
&initrd,
|
||||||
self.vm_config.vcpu_count,
|
self.vm_config.vcpu_count,
|
||||||
self.vm_config.max_vcpu_count,
|
self.vm_config.max_vcpu_count,
|
||||||
self.vm_config.reserve_memory_bytes,
|
|
||||||
)
|
)
|
||||||
.map_err(StartMicroVmError::ConfigureSystem)
|
.map_err(StartMicroVmError::ConfigureSystem)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user