mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vm-virtio: vhost-user: Send memory update to the backend
In order to keep vhost-user backend to work across guest memory resizing happening when memory is hot-plugged or hot-unplugged, both blk, net and fs devices are implementing the notifier to let the backend know. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
7ff82af4b2
commit
d75e7456fc
@ -321,6 +321,10 @@ impl VirtioDevice for Blk {
|
||||
fn shutdown(&mut self) {
|
||||
let _ = unsafe { libc::close(self.vhost_user_blk.as_raw_fd()) };
|
||||
}
|
||||
|
||||
fn update_memory(&mut self, mem: &GuestMemoryMmap) -> std::result::Result<(), crate::Error> {
|
||||
update_mem_table(&mut self.vhost_user_blk, mem).map_err(crate::Error::VhostUserUpdateMemory)
|
||||
}
|
||||
}
|
||||
|
||||
virtio_pausable!(Blk);
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright 2019 Intel Corporation. All Rights Reserved.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use super::vu_common_ctrl::{reset_vhost_user, setup_vhost_user};
|
||||
use super::vu_common_ctrl::{reset_vhost_user, setup_vhost_user, update_mem_table};
|
||||
use super::Error as DeviceError;
|
||||
use super::{Error, Result};
|
||||
use crate::vhost_user::handler::{VhostUserEpollConfig, VhostUserEpollHandler};
|
||||
@ -529,6 +529,10 @@ impl VirtioDevice for Fs {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn update_memory(&mut self, mem: &GuestMemoryMmap) -> std::result::Result<(), crate::Error> {
|
||||
update_mem_table(&mut self.vu, mem).map_err(crate::Error::VhostUserUpdateMemory)
|
||||
}
|
||||
}
|
||||
|
||||
virtio_pausable!(Fs);
|
||||
|
@ -358,6 +358,10 @@ impl VirtioDevice for Net {
|
||||
fn shutdown(&mut self) {
|
||||
let _ = unsafe { libc::close(self.vhost_user_net.as_raw_fd()) };
|
||||
}
|
||||
|
||||
fn update_memory(&mut self, mem: &GuestMemoryMmap) -> std::result::Result<(), crate::Error> {
|
||||
update_mem_table(&mut self.vhost_user_net, mem).map_err(crate::Error::VhostUserUpdateMemory)
|
||||
}
|
||||
}
|
||||
|
||||
virtio_ctrl_q_pausable!(Net);
|
||||
|
Loading…
Reference in New Issue
Block a user