Skip to content

Commit

Permalink
Rebase and resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
kumargu committed Dec 9, 2020
1 parent 8c0efa4 commit ae7f807
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 21 deletions.
1 change: 1 addition & 0 deletions src/firecracker/src/api_server_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ impl Subscriber for ApiServerAdapter {
}
}

#[allow(clippy::too_many_arguments)]
pub(crate) fn run_with_api(
seccomp_filter: BpfProgram,
config_json: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion src/firecracker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn main() {

let boot_timer_enabled = arguments.flag_present("boot-timer");
let api_enabled = !arguments.flag_present("no-api");
let debugger_enabled = arguments.flag_present("debugger").unwrap_or(false);
let debugger_enabled = arguments.flag_present("debugger");

if api_enabled {
let bind_path = arguments
Expand Down
3 changes: 2 additions & 1 deletion src/gdb_server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::net::{TcpListener, TcpStream};

pub use arch;
pub use kernel::loader::{Elf64_Phdr, PT_LOAD};
pub use arch::x86_64::regs::setup_sregs;
pub use kernel::loader::elf::{Elf64_Phdr, PT_LOAD};
pub use kvm_bindings;
pub use kvm_ioctls::VcpuFd;
pub use std::sync::mpsc::{Receiver, Sender};
Expand Down
3 changes: 2 additions & 1 deletion src/gdb_server/src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ use std::collections::HashMap;

use gdbstub::{arch, Actions, BreakOp, StopReason, Target, Tid, SINGLE_THREAD_TID};

use super::{Bytes, Elf64_Phdr, GuestAddress, GuestMemoryMmap};
use super::{Bytes, GuestAddress, GuestMemoryMmap};
use super::{DebugEvent, Debugger, DebuggerError, FullVcpuState, Receiver, ResumeAction, Sender};
use crate::DynResult;
pub use kernel::loader::elf::Elf64_Phdr;

pub struct FirecrackerGDBServer {
pub guest_memory: GuestMemoryMmap,
Expand Down
6 changes: 4 additions & 2 deletions src/gdb_server/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use std::fmt::{Display, Formatter};
use vm_memory::Bytes;
use vmm_sys_util::errno::Error;

pub use super::arch::x86_64::regs::setup_sregs;
pub use arch::x86_64::regs::setup_sregs;
pub use kernel::loader::elf::{Elf64_Phdr, PT_LOAD};

use super::kvm_bindings::*;
use super::{Elf64_Phdr, GuestAddress, GuestMemoryMmap, VcpuFd, PT_LOAD};
use super::{GuestAddress, GuestMemoryMmap, VcpuFd};

// See Chapter 2.5 (Control Registers), Volume 3A in Intel Arch SW Developer's Manual.
// Bit 0 of CR0 register on x86 architecture
Expand Down
4 changes: 1 addition & 3 deletions src/kernel/src/loader/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use vm_memory::{Address, Bytes, GuestAddress, GuestMemory, GuestMemoryMmap};
#[allow(non_camel_case_types)]
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
// Add here any other architecture that uses as kernel image an ELF file.
mod elf;

pub use elf::{Elf64_Phdr, PT_LOAD};
pub mod elf;

#[derive(Debug, PartialEq)]
pub enum Error {
Expand Down
5 changes: 2 additions & 3 deletions src/vmm/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ pub fn build_microvm_for_boot(
track_dirty_pages,
)?;
let vcpu_config = vm_resources.vcpu_config();
let entry_addr = load_kernel(boot_config, &guest_memory)?;
let track_dirty_pages = vm_resources.track_dirty_pages();
let (entry_addr, e_phdrs) = load_kernel(boot_config, &guest_memory)?;
let initrd = load_initrd_from_config(boot_config, &guest_memory)?;
Expand Down Expand Up @@ -483,7 +482,7 @@ pub fn create_guest_memory(
fn load_kernel(
boot_config: &BootConfig,
guest_memory: &GuestMemoryMmap,
) -> std::result::Result<(GuestAddress, Vec<kernel::loader::Elf64_Phdr>), StartMicrovmError> {
) -> std::result::Result<(GuestAddress, Vec<kernel::loader::elf::Elf64_Phdr>), StartMicrovmError> {
let mut kernel_file = boot_config
.kernel_file
.try_clone()
Expand Down Expand Up @@ -843,7 +842,7 @@ fn vmm_run_gdb_server(
vmm_mem: GuestMemoryMmap,
receiver: Receiver<gdb_server::DebugEvent>,
sender: Sender<gdb_server::DebugEvent>,
e_phdrs: Vec<kernel::loader::Elf64_Phdr>,
e_phdrs: Vec<kernel::loader::elf::Elf64_Phdr>,
entry_point: GuestAddress,
vcpus: &[Vcpu],
) -> Result<(), StartMicrovmError> {
Expand Down
7 changes: 0 additions & 7 deletions src/vmm/src/default_syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ const KVM_GET_MP_STATE: u64 = 0x8004_ae98;
const KVM_SET_MP_STATE: u64 = 0x4004_ae99;
const KVM_GET_VCPU_EVENTS: u64 = 0x8040_ae9f;
const KVM_SET_VCPU_EVENTS: u64 = 0x4040_aea0;
const KVM_GET_DEBUGREGS: u64 = 0x8080_aea1;
const KVM_SET_DEBUGREGS: u64 = 0x4080_aea2;
const KVM_GET_XSAVE: u64 = 0x9000_aea4;
const KVM_SET_XSAVE: u64 = 0x5000_aea5;
const KVM_GET_XCRS: u64 = 0x8188_aea6;
const KVM_SET_XCRS: u64 = 0x4188_aea7;
const KVM_SET_GUEST_DEBUG: u64 = 0x4048_ae9b;

// Use this mod to define ioctl params that are architecture specific.
Expand Down Expand Up @@ -132,7 +126,6 @@ fn create_ioctl_seccomp_rule() -> Result<Vec<SeccompRule>, Error> {
and![Cond::new(1, ArgLen::DWORD, Eq, KVM_GET_VCPU_EVENTS)?],
and![Cond::new(1, ArgLen::DWORD, Eq, KVM_SET_VCPU_EVENTS)?],
and![Cond::new(1, ArgLen::DWORD, Eq, KVM_SET_GUEST_DEBUG)?],

];

rule.append(&mut create_arch_specific_ioctl_conditions()?);
Expand Down
2 changes: 2 additions & 0 deletions src/vmm/src/resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ mod tests {
net_builder: default_net_builder(),
mmds_config: None,
boot_timer: false,
debugger: false,
};
let mut new_balloon_cfg = BalloonDeviceConfig {
amount_mb: 100,
Expand Down Expand Up @@ -878,6 +879,7 @@ mod tests {
net_builder: default_net_builder(),
mmds_config: None,
boot_timer: false,
debugger: false,
};
new_balloon_cfg.amount_mb = 256;
assert!(vm_resources.set_balloon_device(new_balloon_cfg).is_err());
Expand Down
5 changes: 5 additions & 0 deletions src/vmm/src/rpc_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ impl<'a> PrebootApiController<'a> {
&self.vm_resources,
&mut self.event_manager,
&self.seccomp_filter,
self.vm_resources.debugger,
)
.map(|vmm| {
self.built_vmm = Some(vmm);
Expand Down Expand Up @@ -706,6 +707,7 @@ mod tests {
pub boot_timer: bool,
// when `true`, all self methods are forced to fail
pub force_errors: bool,
pub debugger: bool,
}

impl MockVmRes {
Expand Down Expand Up @@ -806,6 +808,7 @@ mod tests {
pub update_net_rate_limiters_called: bool,
// when `true`, all self methods are forced to fail
pub force_errors: bool,
pub debugger: bool,
}

impl MockVmm {
Expand Down Expand Up @@ -911,6 +914,7 @@ mod tests {
_: &VmResources,
_: &mut EventManager,
_: BpfProgramRef,
_: bool,
) -> Result<Arc<Mutex<Vmm>>, StartMicrovmError> {
Ok(Arc::new(Mutex::new(MockVmm::default())))
}
Expand Down Expand Up @@ -1286,6 +1290,7 @@ mod tests {
commands,
expected_resp,
false,
false,
);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/integration_tests/build/test_binary_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

SIZES_DICT = {
"x86_64": {
"FC_BINARY_SIZE_TARGET": 2212120,
"FC_BINARY_SIZE_TARGET": 2447361,
"JAILER_BINARY_SIZE_TARGET": 1439512,
"FC_BINARY_SIZE_LIMIT": 2322726,
"FC_BINARY_SIZE_LIMIT": 2447361,
"JAILER_BINARY_SIZE_LIMIT": 1511488,
},
"aarch64": {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration_tests/build/test_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# this contains the frequency while on AMD it does not.
# Checkout the cpuid crate. In the future other
# differences may appear.
COVERAGE_DICT = {"Intel": 85.25, "AMD": 84.50, "ARM": 82.72}
COVERAGE_DICT = {"Intel": 83.15, "AMD": 82.40, "ARM": 82.72}
PROC_MODEL = proc.proc_type()

COVERAGE_MAX_DELTA = 0.05
Expand Down

0 comments on commit ae7f807

Please sign in to comment.