Make clippy happier

This commit is contained in:
guillaume didier 2020-04-01 16:31:06 +02:00
parent f8b02c4b6f
commit bebbf379c1
4 changed files with 42 additions and 30 deletions

View File

@ -2,7 +2,7 @@ use crate::{flush, maccess, rdtsc_fence};
use core::arch::x86_64 as arch_x86;
#[cfg(feature = "no_std")]
use polling_serial::serial_println as println;
use polling_serial::{serial_print as print, serial_println as println};
#[derive(Ord, PartialOrd, Eq, PartialEq)]
pub enum Verbosity {
@ -13,7 +13,7 @@ pub enum Verbosity {
}
extern crate alloc;
use crate::calibration::Verbosity::{Debug, NoOutput, RawResult, Thresholds};
use crate::calibration::Verbosity::*;
use alloc::vec;
use alloc::vec::Vec;
use core::cmp::min;
@ -150,7 +150,6 @@ const CFLUSH_BUCKET_SIZE: usize = 1;
const CFLUSH_BUCKET_NUMBER: usize = 500;
const CFLUSH_NUM_ITER: u32 = 1 << 11;
const CFLUSH_SPURIOUS_THRESHOLD: usize = 1;
/* TODO Code cleanup :
- change type back to a slice OK

View File

@ -81,8 +81,8 @@ pub fn main() {
println!("skipping");
continue;
}
Err(_) => {
panic!("Unexpected error while setting affinity");
Err(e) => {
panic!("Unexpected error while setting affinity: {}", e);
}
}
}

View File

@ -1,8 +1,6 @@
use x86_64::registers::model_specific::Msr;
use crate::calibration::only_flush;
use crate::flush;
use crate::maccess;
extern crate alloc;
use alloc::vec;
@ -28,7 +26,12 @@ pub fn enable_prefetchers(status: bool) {
unsafe { msr.write(value) };
}
pub fn prefetcher_fun(
pub unsafe fn prefetcher_fun(
victim_4k_addr: *mut u8,
#[allow(non_snake_case)] _victim_2M_addr: *mut u8,
threshold_ff: u64,
) -> Vec<i32> {
fn implementation(
victim_4k_addr: *mut u8,
#[allow(non_snake_case)] _victim_2M_addr: *mut u8,
threshold_ff: u64,
@ -51,3 +54,5 @@ pub fn prefetcher_fun(
}
results
}
implementation(victim_4k_addr, _victim_2M_addr, threshold_ff)
}

View File

@ -269,18 +269,26 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
let threshold_flush = 0; // FIXME
serial_println!("0");
let r_no_prefetch = prefetcher_fun(
let r_no_prefetch = unsafe {
prefetcher_fun(
victim4k_start as *mut u8,
unsafe { (victim.range.start_addr() as *mut u8).offset(phys_mem_offset.as_u64() as isize) },
unsafe {
(victim.range.start_addr() as *mut u8).offset(phys_mem_offset.as_u64() as isize)
},
threshold_flush,
);
)
};
serial_println!("1");
enable_prefetchers(true);
let r_prefetch = prefetcher_fun(
let r_prefetch = unsafe {
prefetcher_fun(
victim4k_start as *mut u8,
unsafe { (victim.range.start_addr() as *mut u8).offset(phys_mem_offset.as_u64() as isize) },
unsafe {
(victim.range.start_addr() as *mut u8).offset(phys_mem_offset.as_u64() as isize)
},
threshold_flush,
);
)
};
for (i, (&npf, pf)) in r_no_prefetch.iter().zip(r_prefetch).enumerate() {
serial_println!("{} {} {}", i, npf, pf);