mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-21 07:21:15 +00:00
virtio-devices: Print out worker error messages
Currently any messages generated during the worker thread are not shown anywhere as the thread is never join()ed on. Instead output the error immediately. For now only cover the subset where the work to port to EpollHandler clashed with the seccomp filtering for virtio devices. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
ec9de259ba
commit
0e335a709d
@ -264,7 +264,7 @@ pub struct Block<T: DiskFile> {
|
|||||||
config: VirtioBlockConfig,
|
config: VirtioBlockConfig,
|
||||||
queue_evts: Option<Vec<EventFd>>,
|
queue_evts: Option<Vec<EventFd>>,
|
||||||
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
||||||
epoll_threads: Option<Vec<thread::JoinHandle<result::Result<(), EpollHelperError>>>>,
|
epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
|
||||||
pause_evt: Option<EventFd>,
|
pause_evt: Option<EventFd>,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
queue_size: Vec<u16>,
|
queue_size: Vec<u16>,
|
||||||
@ -542,10 +542,11 @@ impl<T: 'static + DiskFile + Send> VirtioDevice for Block<T> {
|
|||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("virtio_blk".to_string())
|
.name("virtio_blk".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
SeccompFilter::apply(virtio_blk_seccomp_filter)
|
if let Err(e) = SeccompFilter::apply(virtio_blk_seccomp_filter) {
|
||||||
.map_err(EpollHelperError::ApplySeccompFilter)?;
|
error!("Error applying seccomp filter: {:?}", e);
|
||||||
|
} else if let Err(e) = handler.run(paused) {
|
||||||
handler.run(paused)
|
error!("Error running worker: {:?}", e);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.map(|thread| epoll_threads.push(thread))
|
.map(|thread| epoll_threads.push(thread))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
@ -25,7 +25,6 @@ pub enum EpollHelperError {
|
|||||||
CreateFd(std::io::Error),
|
CreateFd(std::io::Error),
|
||||||
Ctl(std::io::Error),
|
Ctl(std::io::Error),
|
||||||
Wait(std::io::Error),
|
Wait(std::io::Error),
|
||||||
ApplySeccompFilter(seccomp::Error),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const EPOLL_HELPER_EVENT_PAUSE: u16 = 0;
|
pub const EPOLL_HELPER_EVENT_PAUSE: u16 = 0;
|
||||||
|
@ -285,7 +285,7 @@ pub struct Pmem {
|
|||||||
config: VirtioPmemConfig,
|
config: VirtioPmemConfig,
|
||||||
queue_evts: Option<Vec<EventFd>>,
|
queue_evts: Option<Vec<EventFd>>,
|
||||||
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
||||||
epoll_threads: Option<Vec<thread::JoinHandle<result::Result<(), EpollHelperError>>>>,
|
epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
mapping: UserspaceMapping,
|
mapping: UserspaceMapping,
|
||||||
seccomp_action: SeccompAction,
|
seccomp_action: SeccompAction,
|
||||||
@ -468,10 +468,11 @@ impl VirtioDevice for Pmem {
|
|||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("virtio_pmem".to_string())
|
.name("virtio_pmem".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
SeccompFilter::apply(virtio_pmem_seccomp_filter)
|
if let Err(e) = SeccompFilter::apply(virtio_pmem_seccomp_filter) {
|
||||||
.map_err(DeviceError::ApplySeccompFilter)?;
|
error!("Error applying seccomp filter: {:?}", e);
|
||||||
|
} else if let Err(e) = handler.run(paused) {
|
||||||
handler.run(paused)
|
error!("Error running worker: {:?}", e);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.map(|thread| epoll_threads.push(thread))
|
.map(|thread| epoll_threads.push(thread))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
@ -130,7 +130,7 @@ pub struct Rng {
|
|||||||
acked_features: u64,
|
acked_features: u64,
|
||||||
queue_evts: Option<Vec<EventFd>>,
|
queue_evts: Option<Vec<EventFd>>,
|
||||||
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
interrupt_cb: Option<Arc<dyn VirtioInterrupt>>,
|
||||||
epoll_threads: Option<Vec<thread::JoinHandle<result::Result<(), EpollHelperError>>>>,
|
epoll_threads: Option<Vec<thread::JoinHandle<()>>>,
|
||||||
paused: Arc<AtomicBool>,
|
paused: Arc<AtomicBool>,
|
||||||
seccomp_action: SeccompAction,
|
seccomp_action: SeccompAction,
|
||||||
}
|
}
|
||||||
@ -295,10 +295,11 @@ impl VirtioDevice for Rng {
|
|||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("virtio_rng".to_string())
|
.name("virtio_rng".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
SeccompFilter::apply(virtio_rng_seccomp_filter)
|
if let Err(e) = SeccompFilter::apply(virtio_rng_seccomp_filter) {
|
||||||
.map_err(DeviceError::ApplySeccompFilter)?;
|
error!("Error applying seccomp filter: {:?}", e);
|
||||||
|
} else if let Err(e) = handler.run(paused) {
|
||||||
handler.run(paused)
|
error!("Error running worker: {:?}", e);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.map(|thread| epoll_threads.push(thread))
|
.map(|thread| epoll_threads.push(thread))
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
Loading…
Reference in New Issue
Block a user