mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 13:45:20 +00:00
vhost_user_backend: Return a list of vring workers
Now that multiple worker threads can be run from the backend crate, it is important that each backend implementation can access every worker thread. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
d9eec0de14
commit
cd2b03f6ed
@ -191,8 +191,8 @@ impl<S: VhostUserBackend> VhostUserDaemon<S> {
|
||||
/// Retrieve the vring worker. This is necessary to perform further
|
||||
/// actions like registering and unregistering some extra event file
|
||||
/// descriptors.
|
||||
pub fn get_vring_worker(&self) -> Arc<VringWorker> {
|
||||
self.handler.lock().unwrap().get_vring_worker()
|
||||
pub fn get_vring_workers(&self) -> Vec<Arc<VringWorker>> {
|
||||
self.handler.lock().unwrap().get_vring_workers()
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,8 +545,8 @@ impl<S: VhostUserBackend> VhostUserHandler<S> {
|
||||
})
|
||||
}
|
||||
|
||||
fn get_vring_worker(&self) -> Arc<VringWorker> {
|
||||
self.workers[0].clone()
|
||||
fn get_vring_workers(&self) -> Vec<Arc<VringWorker>> {
|
||||
self.workers.clone()
|
||||
}
|
||||
|
||||
fn vmm_va_to_gpa(&self, vmm_va: u64) -> VhostUserHandlerResult<u64> {
|
||||
|
@ -449,14 +449,14 @@ pub fn start_block_backend(backend_command: &str) {
|
||||
.unwrap();
|
||||
debug!("blk_daemon is created!\n");
|
||||
|
||||
let vring_worker = blk_daemon.get_vring_worker();
|
||||
let vring_worker = blk_daemon.get_vring_workers();
|
||||
blk_backend
|
||||
.write()
|
||||
.unwrap()
|
||||
.thread
|
||||
.lock()
|
||||
.unwrap()
|
||||
.set_vring_worker(Some(vring_worker));
|
||||
.set_vring_worker(Some(vring_worker[0].clone()));
|
||||
|
||||
if let Err(e) = blk_daemon.start() {
|
||||
error!(
|
||||
|
@ -473,7 +473,7 @@ pub fn start_net_backend(backend_command: &str) {
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let vring_worker = net_daemon.get_vring_worker();
|
||||
let vring_worker = net_daemon.get_vring_workers();
|
||||
|
||||
net_backend
|
||||
.write()
|
||||
@ -481,7 +481,7 @@ pub fn start_net_backend(backend_command: &str) {
|
||||
.thread
|
||||
.lock()
|
||||
.unwrap()
|
||||
.set_vring_worker(Some(vring_worker));
|
||||
.set_vring_worker(Some(vring_worker[0].clone()));
|
||||
|
||||
if let Err(e) = net_daemon.start() {
|
||||
println!(
|
||||
|
Loading…
Reference in New Issue
Block a user