Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/src/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ impl CpuidFeatureEntry {
};
if !is_compatible {
info!(
"CPUID incompatibility for value definition='{:?}' detected in leaf={:#02x}, sub-leaf={:#02x}, register={:?}, compatibility_check={:?}, source VM value='{:#04x}' destination VM value='{:#04x}'",
"CPUID incompatibility for value definition='{:?}' detected in leaf={:#04x}, sub-leaf={:#04x}, register={:?}, compatibility_check={:?}, source VM value='{:#04x}' destination VM value='{:#04x}'",
def,
entry.function,
entry.index,
Expand Down Expand Up @@ -640,7 +640,7 @@ impl CpuidFeatureEntry {
};
if !entry_compatible {
error!(
"Detected incompatible CPUID entry: leaf={:#02x} (subleaf={:#02x}), register='{:?}', \
"Detected incompatible CPUID entry: leaf={:#04x} (subleaf={:#04x}), register='{:?}', \
compatible_check='{:?}', source VM feature='{:#04x}', destination VM feature'{:#04x}'.",
entry.function,
entry.index,
Expand Down
4 changes: 2 additions & 2 deletions cloud-hypervisor/tests/common/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl TargetApi {
if output.status.success() {
true
} else {
eprintln!("Error running ch-remote command: {:?}", &cmd);
eprintln!("Error running ch-remote command: {cmd:?}");
let stderr = String::from_utf8_lossy(&output.stderr);
eprintln!("stderr: {stderr}");
false
Expand Down Expand Up @@ -1154,7 +1154,7 @@ pub(crate) fn start_live_migration(

// Start to send migration from the source VM
let args = [
format!("--api-socket={}", &src_api_socket),
format!("--api-socket={src_api_socket}"),
"send-migration".to_string(),
format!(
"destination_url=unix:{migration_socket},local={}",
Expand Down
12 changes: 6 additions & 6 deletions cloud-hypervisor/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ mod common_parallel {
assert!(
exec_host_command_output(&format!(
"mount {} {}",
&loop_dev_path,
loop_dev_path,
mnt_dir.to_str().unwrap()
))
.status
Expand All @@ -1363,7 +1363,7 @@ mod common_parallel {
assert!(
exec_host_command_output(&format!(
"cp {} {}",
&src_qcow2,
src_qcow2,
dest_qcow2.to_str().unwrap()
))
.status
Expand Down Expand Up @@ -3467,7 +3467,7 @@ mod common_parallel {
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
format!("path={},direct=on,image_type=raw", &loop_dev).as_str(),
format!("path={loop_dev},direct=on,image_type=raw").as_str(),
])
.default_net()
.capture_output()
Expand Down Expand Up @@ -3543,7 +3543,7 @@ mod common_parallel {
assert!(
exec_host_command_output(&format!(
"mount {} {}",
&loop_dev_path,
loop_dev_path,
mnt_dir.to_str().unwrap()
))
.status
Expand Down Expand Up @@ -4108,7 +4108,7 @@ mod common_parallel {
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
format!("path={},image_type=raw", &loop_dev).as_str(),
format!("path={loop_dev},image_type=raw").as_str(),
])
.default_net()
.capture_output()
Expand Down Expand Up @@ -4284,7 +4284,7 @@ mod common_parallel {
guest.disk_config.disk(DiskType::CloudInit).unwrap()
)
.as_str(),
format!("path={},image_type=raw", &dm_dev).as_str(),
format!("path={dm_dev},image_type=raw").as_str(),
])
.default_net()
.capture_output()
Expand Down
4 changes: 2 additions & 2 deletions hypervisor/src/kvm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ impl vm::Vm for KvmVm {
///
fn start_dirty_log(&self) -> vm::Result<()> {
let dirty_log_slots = self.dirty_log_slots.read().unwrap();
for (_, s) in dirty_log_slots.iter() {
for s in dirty_log_slots.values() {
let region = kvm_userspace_memory_region2 {
slot: s.slot,
guest_phys_addr: s.guest_phys_addr,
Expand All @@ -1344,7 +1344,7 @@ impl vm::Vm for KvmVm {
///
fn stop_dirty_log(&self) -> vm::Result<()> {
let dirty_log_slots = self.dirty_log_slots.read().unwrap();
for (_, s) in dirty_log_slots.iter() {
for s in dirty_log_slots.values() {
let region = kvm_userspace_memory_region2 {
slot: s.slot,
guest_phys_addr: s.guest_phys_addr,
Expand Down
2 changes: 1 addition & 1 deletion hypervisor/src/mshv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2229,7 +2229,7 @@ impl vm::Vm for MshvVm {
// Before disabling the dirty page tracking we need
// to set the dirty bits in the Hypervisor
// This is a requirement from Microsoft Hypervisor
for (_, s) in dirty_log_slots.iter() {
for s in dirty_log_slots.values() {
self.fd
.get_dirty_log(
s.guest_pfn,
Expand Down
2 changes: 1 addition & 1 deletion test_infra/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ pub fn remote_command(api_socket: &str, command: &str, arg: Option<&str>) -> boo
if output.status.success() {
true
} else {
eprintln!("Error running ch-remote command: {:?}", &cmd);
eprintln!("Error running ch-remote command: {cmd:?}");
let stderr = String::from_utf8_lossy(&output.stderr);
eprintln!("stderr: {stderr}");
false
Expand Down
6 changes: 3 additions & 3 deletions virtio-devices/src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ impl MemEpollHandler {
if plug {
let mut gpa = addr;
for _ in 0..nb_blocks {
for (_, handler) in handlers.iter() {
for handler in handlers.values() {
if let Err(e) = handler.map(gpa, gpa, config.block_size) {
error!(
"failed DMA mapping addr 0x{:x} size 0x{:x}: {}",
Expand All @@ -529,7 +529,7 @@ impl MemEpollHandler {

config.plugged_size += size;
} else {
for (_, handler) in handlers.iter() {
for handler in handlers.values() {
if let Err(e) = handler.unmap(addr, size) {
error!("failed DMA unmapping addr 0x{addr:x} size 0x{size:x}: {e}");
return VIRTIO_MEM_RESP_ERROR;
Expand All @@ -555,7 +555,7 @@ impl MemEpollHandler {
for (idx, plugged) in self.blocks_state.lock().unwrap().inner().iter().enumerate() {
if *plugged {
let gpa = config.addr + (idx as u64 * config.block_size);
for (_, handler) in handlers.iter() {
for handler in handlers.values() {
if let Err(e) = handler.unmap(gpa, config.block_size) {
error!(
"failed DMA unmapping addr 0x{:x} size 0x{:x}: {}",
Expand Down
2 changes: 1 addition & 1 deletion virtio-devices/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ impl VirtioDevice for Net {

let mut epoll_threads = Vec::new();
spawn_virtio_thread(
&format!("{}_ctrl", &self.id),
&format!("{}_ctrl", self.id),
&self.seccomp_action,
Thread::VirtioNetCtl,
&mut epoll_threads,
Expand Down
2 changes: 1 addition & 1 deletion virtio-devices/src/vhost_user/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ impl VirtioDevice for Net {

let mut epoll_threads = Vec::new();
spawn_virtio_thread(
&format!("{}_ctrl", &self.id),
&format!("{}_ctrl", self.id),
&self.seccomp_action,
Thread::VirtioVhostNetCtl,
&mut epoll_threads,
Expand Down
10 changes: 5 additions & 5 deletions vmm/src/device_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3940,7 +3940,7 @@ impl DeviceManager {
// Register DMA mapping in IOMMU.
// Do not register virtio-mem regions, as they are handled directly by
// virtio-mem device itself.
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
for region in zone.regions() {
// vfio_dma_map is unsound and ought to be marked as unsafe
#[allow(unused_unsafe)]
Expand Down Expand Up @@ -4209,7 +4209,7 @@ impl DeviceManager {
.map_err(DeviceManagerError::AddDmaMappingHandlerVirtioMem)?;
}

for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
for region in zone.regions() {
vfio_user_pci_device
.dma_map(region)
Expand Down Expand Up @@ -4350,7 +4350,7 @@ impl DeviceManager {

// Do not register virtio-mem regions, as they are handled directly by
// virtio-mem devices.
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
for region in zone.regions() {
let gpa = region.start_addr().0;
let size = region.len();
Expand Down Expand Up @@ -4935,7 +4935,7 @@ impl DeviceManager {
if let Some(dma_handler) = dev.dma_handler()
&& !iommu_attached
{
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
for region in zone.regions() {
let iova = region.start_addr().0;
let size = region.len();
Expand All @@ -4955,7 +4955,7 @@ impl DeviceManager {
}
PciDeviceHandle::VfioUser(vfio_user_pci_device) => {
let mut dev = vfio_user_pci_device.lock().unwrap();
for (_, zone) in self.memory_manager.lock().unwrap().memory_zones().iter() {
for zone in self.memory_manager.lock().unwrap().memory_zones().values() {
for region in zone.regions() {
// On error, log, but continue so the loop below removing the mapping from
// the devices runs.
Expand Down
2 changes: 1 addition & 1 deletion vmm/src/device_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl<'a> BftIter<'a> {
let mut nodes = Vec::with_capacity(hash_map.len());
let mut i = 0;

for (_, node) in hash_map.iter() {
for node in hash_map.values() {
if node.parent.is_none() {
nodes.push(node);
}
Expand Down
6 changes: 3 additions & 3 deletions vmm/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl MsiInterruptGroup {

fn set_gsi_routes(&self, routes: &HashMap<u32, RoutingEntry>) -> Result<()> {
let mut entry_vec: Vec<IrqRoutingEntry> = Vec::new();
for (_, entry) in routes.iter() {
for entry in routes.values() {
if entry.masked {
continue;
}
Expand All @@ -207,15 +207,15 @@ impl MsiInterruptGroup {

impl InterruptSourceGroup for MsiInterruptGroup {
fn enable(&self) -> Result<()> {
for (_, route) in self.irq_routes.iter() {
for route in self.irq_routes.values() {
route.lock().unwrap().enable(self.vm.as_ref())?;
}

Ok(())
}

fn disable(&self) -> Result<()> {
for (_, route) in self.irq_routes.iter() {
for route in self.irq_routes.values() {
route.lock().unwrap().disable(self.vm.as_ref())?;
}

Expand Down
6 changes: 3 additions & 3 deletions vmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3275,9 +3275,9 @@ impl RequestHandler for Vmm {
"Receiving migration: receiver_url={},tls={},net_fds={:?}, tcp_url={:?}, zones={:?}",
receive_data_migration.receiver_url,
receive_data_migration.tls_dir.is_some(),
&receive_data_migration.net_fds,
&receive_data_migration.tcp_serial_url,
&receive_data_migration.zones,
receive_data_migration.net_fds,
receive_data_migration.tcp_serial_url,
receive_data_migration.zones,
);

let mut listener = migration_transport::receive_migration_listener(
Expand Down
2 changes: 1 addition & 1 deletion vmm/src/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ impl Vm {
.validate()
.map_err(Error::ConfigValidation)?;

info!("Booting VM from config: {:?}", &config);
info!("Booting VM from config: {config:?}");

// Create NUMA nodes based on NumaConfig.
let numa_nodes =
Expand Down
Loading