mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-08 12:41:35 +00:00
virtio-devices: Report events for virtio device activation and reset
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
9260c4c10e
commit
c89095ab85
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1521,6 +1521,7 @@ dependencies = [
|
|||||||
"block_util",
|
"block_util",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"epoll",
|
"epoll",
|
||||||
|
"event_monitor",
|
||||||
"io-uring",
|
"io-uring",
|
||||||
"libc",
|
"libc",
|
||||||
"log 0.4.14",
|
"log 0.4.14",
|
||||||
|
@ -14,6 +14,7 @@ arc-swap = ">=1.0.0"
|
|||||||
block_util = { path = "../block_util" }
|
block_util = { path = "../block_util" }
|
||||||
byteorder = "1.3.4"
|
byteorder = "1.3.4"
|
||||||
epoll = ">=4.0.1"
|
epoll = ">=4.0.1"
|
||||||
|
event_monitor = { path = "../event_monitor" }
|
||||||
io-uring = ">=0.4.0"
|
io-uring = ">=0.4.0"
|
||||||
libc = "0.2.86"
|
libc = "0.2.86"
|
||||||
log = "0.4.14"
|
log = "0.4.14"
|
||||||
|
@ -462,11 +462,14 @@ impl VirtioDevice for Balloon {
|
|||||||
})?;
|
})?;
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,12 +567,15 @@ impl VirtioDevice for Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
||||||
|
@ -485,11 +485,14 @@ impl VirtioDevice for Console {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,11 +948,14 @@ impl VirtioDevice for Iommu {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
extern crate arc_swap;
|
extern crate arc_swap;
|
||||||
extern crate epoll;
|
extern crate epoll;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
extern crate event_monitor;
|
||||||
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
extern crate pci;
|
extern crate pci;
|
||||||
extern crate serde;
|
extern crate serde;
|
||||||
|
@ -869,11 +869,14 @@ impl VirtioDevice for Mem {
|
|||||||
})?;
|
})?;
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,13 +524,16 @@ impl VirtioDevice for Net {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(ActivateError::BadActivate)
|
Err(ActivateError::BadActivate)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
fn counters(&self) -> Option<HashMap<&'static str, Wrapping<u64>>> {
|
||||||
|
@ -428,13 +428,16 @@ impl VirtioDevice for Pmem {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(ActivateError::BadActivate)
|
Err(ActivateError::BadActivate)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn userspace_mappings(&self) -> Vec<UserspaceMapping> {
|
fn userspace_mappings(&self) -> Vec<UserspaceMapping> {
|
||||||
|
@ -274,13 +274,16 @@ impl VirtioDevice for Rng {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(ActivateError::BadActivate)
|
Err(ActivateError::BadActivate)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -272,6 +272,7 @@ impl VirtioDevice for Blk {
|
|||||||
}
|
}
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,6 +292,8 @@ impl VirtioDevice for Blk {
|
|||||||
let _ = kill_evt.write(1);
|
let _ = kill_evt.write(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
|
||||||
// Return the interrupt
|
// Return the interrupt
|
||||||
Some(self.common.interrupt_cb.take().unwrap())
|
Some(self.common.interrupt_cb.take().unwrap())
|
||||||
}
|
}
|
||||||
|
@ -492,6 +492,7 @@ impl VirtioDevice for Fs {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -511,6 +512,8 @@ impl VirtioDevice for Fs {
|
|||||||
let _ = kill_evt.write(1);
|
let _ = kill_evt.write(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
|
||||||
// Return the interrupt
|
// Return the interrupt
|
||||||
Some(self.common.interrupt_cb.take().unwrap())
|
Some(self.common.interrupt_cb.take().unwrap())
|
||||||
}
|
}
|
||||||
|
@ -347,6 +347,8 @@ impl VirtioDevice for Net {
|
|||||||
let _ = kill_evt.write(1);
|
let _ = kill_evt.write(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
|
||||||
// Return the interrupt
|
// Return the interrupt
|
||||||
Some(self.common.interrupt_cb.take().unwrap())
|
Some(self.common.interrupt_cb.take().unwrap())
|
||||||
}
|
}
|
||||||
|
@ -471,11 +471,14 @@ where
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn shutdown(&mut self) {
|
fn shutdown(&mut self) {
|
||||||
|
@ -355,11 +355,14 @@ impl VirtioDevice for Watchdog {
|
|||||||
|
|
||||||
self.common.epoll_threads = Some(epoll_threads);
|
self.common.epoll_threads = Some(epoll_threads);
|
||||||
|
|
||||||
|
event!("virtio-device", "activated", "id", &self.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
fn reset(&mut self) -> Option<Arc<dyn VirtioInterrupt>> {
|
||||||
self.common.reset()
|
let result = self.common.reset();
|
||||||
|
event!("virtio-device", "reset", "id", &self.id);
|
||||||
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user