mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-07 17:26:14 +00:00
virtio-devices: vhost-user: Send set_vring_num before setup inflight I/O tracking
backend like SPDK required to know how many virt queues to be handled before gets VHOST_USER_SET_INFLIGHT_FD message. fix dpdk core dump while processing vhost_user_set_inflight_fd: #0 0x00007fffef47c347 in vhost_user_set_inflight_fd (pdev=0x7fffe2895998, msg=0x7fffe28956f0, main_fd=545) at ../lib/librte_vhost/vhost_user.c:1570 #1 0x00007fffef47e7b9 in vhost_user_msg_handler (vid=0, fd=545) at ../lib/librte_vhost/vhost_user.c:2735 #2 0x00007fffef46bac0 in vhost_user_read_cb (connfd=545, dat=0x7fffdc0008c0, remove=0x7fffe2895a64) at ../lib/librte_vhost/socket.c:309 #3 0x00007fffef45b3f6 in fdset_event_dispatch (arg=0x7fffef6dc2e0 <vhost_user+8192>) at ../lib/librte_vhost/fd_man.c:286 #4 0x00007ffff09926f3 in rte_thread_init (arg=0x15ee180) at ../lib/librte_eal/common/eal_common_thread.c:175 Signed-off-by: Arafatms <arafatms@outlook.com>
This commit is contained in:
parent
c7d3992bbc
commit
8fb53eb167
virtio-devices/src/vhost_user
@ -24,7 +24,6 @@ use vhost::vhost_user::message::VhostUserConfigFlags;
|
|||||||
use vhost::vhost_user::message::VHOST_USER_CONFIG_OFFSET;
|
use vhost::vhost_user::message::VHOST_USER_CONFIG_OFFSET;
|
||||||
use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
|
use vhost::vhost_user::message::{VhostUserProtocolFeatures, VhostUserVirtioFeatures};
|
||||||
use vhost::vhost_user::{MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler};
|
use vhost::vhost_user::{MasterReqHandler, VhostUserMaster, VhostUserMasterReqHandler};
|
||||||
use vhost::VhostBackend;
|
|
||||||
use virtio_bindings::bindings::virtio_blk::{
|
use virtio_bindings::bindings::virtio_blk::{
|
||||||
VIRTIO_BLK_F_BLK_SIZE, VIRTIO_BLK_F_CONFIG_WCE, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_FLUSH,
|
VIRTIO_BLK_F_BLK_SIZE, VIRTIO_BLK_F_CONFIG_WCE, VIRTIO_BLK_F_DISCARD, VIRTIO_BLK_F_FLUSH,
|
||||||
VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_SEG_MAX,
|
VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_MQ, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_SEG_MAX,
|
||||||
@ -128,15 +127,6 @@ impl Blk {
|
|||||||
config.num_queues = num_queues as u16;
|
config.num_queues = num_queues as u16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send set_vring_base here, since it could tell backends, like SPDK,
|
|
||||||
// how many virt queues to be handled, which backend required to know
|
|
||||||
// at early stage.
|
|
||||||
for i in 0..num_queues {
|
|
||||||
vu.socket_handle()
|
|
||||||
.set_vring_base(i, 0)
|
|
||||||
.map_err(Error::VhostUserSetVringBase)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(Blk {
|
Ok(Blk {
|
||||||
common: VirtioCommon {
|
common: VirtioCommon {
|
||||||
device_type: VirtioDeviceType::Block as u32,
|
device_type: VirtioDeviceType::Block as u32,
|
||||||
|
@ -141,6 +141,15 @@ impl VhostUserHandle {
|
|||||||
// Let's first provide the memory table to the backend.
|
// Let's first provide the memory table to the backend.
|
||||||
self.update_mem_table(mem)?;
|
self.update_mem_table(mem)?;
|
||||||
|
|
||||||
|
// Send set_vring_num here, since it could tell backends, like SPDK,
|
||||||
|
// how many virt queues to be handled, which backend required to know
|
||||||
|
// at early stage.
|
||||||
|
for (queue_index, queue) in queues.iter().enumerate() {
|
||||||
|
self.vu
|
||||||
|
.set_vring_num(queue_index, queue.actual_size())
|
||||||
|
.map_err(Error::VhostUserSetVringNum)?;
|
||||||
|
}
|
||||||
|
|
||||||
// Setup for inflight I/O tracking shared memory.
|
// Setup for inflight I/O tracking shared memory.
|
||||||
if let Some(inflight) = inflight {
|
if let Some(inflight) = inflight {
|
||||||
if inflight.fd.is_none() {
|
if inflight.fd.is_none() {
|
||||||
@ -168,10 +177,6 @@ impl VhostUserHandle {
|
|||||||
for (queue_index, queue) in queues.into_iter().enumerate() {
|
for (queue_index, queue) in queues.into_iter().enumerate() {
|
||||||
let actual_size: usize = queue.actual_size().try_into().unwrap();
|
let actual_size: usize = queue.actual_size().try_into().unwrap();
|
||||||
|
|
||||||
self.vu
|
|
||||||
.set_vring_num(queue_index, queue.actual_size())
|
|
||||||
.map_err(Error::VhostUserSetVringNum)?;
|
|
||||||
|
|
||||||
let config_data = VringConfigData {
|
let config_data = VringConfigData {
|
||||||
queue_max_size: queue.get_max_size(),
|
queue_max_size: queue.get_max_size(),
|
||||||
queue_size: queue.actual_size(),
|
queue_size: queue.actual_size(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user