New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dragonball: Support vhost-user-net device #8503
Conversation
3cc02df
to
dd6e691
Compare
Hi @studychao @ZizhengBian @lifupan, vhost-user-net device has been tested with DPDK. Please take a look at this. Thanks! |
match mem.read_slice(&mut buf, desc.addr()) { | ||
Ok(_) => unsafe { Ok(std::ptr::read_volatile(&buf[..] as *const _ as *const T)) }, | ||
Err(err) => { | ||
error!("Failed to read from memory, {}", err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the error msg here too generic? It's difficult to tell if it's vhost-net related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is used to read an object from memory, but its type is generic without implementing Debug
trait. No more details are able to retrieve. To get more info, a possible way is to add a context("extra info here")
when calling this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE 1: anyhow
crate isn't used by Dragonball. So the context
is unavailable. Then extra info is required to pass from parameters, which I think it isn't a elegant way.
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/connection.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
} | ||
} | ||
Err(err) => { | ||
error!("{}: failed to setup connection: {}", self.id, err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The above two error messages are identical, making it difficult to figure out where goes wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VhostUserProtocol
error branch is to try to reconnect. Others should be one type of errors: print error log and stop performing this function. Sharing one error message is acceptable in my perspective.
0543fcb
to
a353a2d
Compare
Hi @liubogithub, I've pushed a new commit which resolve issues you mentioned in your code review. PTAL. Thanks! |
47439af
to
6e2d8fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, a few comments
@@ -364,6 +367,10 @@ pub mod tests { | |||
pub const VIRTQ_DESC_F_NEXT: u16 = 0x1; | |||
pub const VIRTQ_DESC_F_WRITE: u16 = 0x2; | |||
|
|||
pub(crate) const GUEST_PHYS_END: u64 = (1 << 46) - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you use GUEST_PHYS_END
, GUEST_MEM_START
and GUEST_MEM_END
defined in dbs_boot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Arc::new(cfg.queue_sizes()), | ||
epoll_mgr.clone(), | ||
)?)), | ||
None => Err(VirtioError::InvalidInput), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about making this error information more explicit like NoEpollMgr
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's great. However, other device managers, e.g. VirtioNetDeviceMgr
, are still using the InvalidInput
as well. Shall we file an issue to track this down and fix this in another PR?
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
src/dragonball/src/dbs_virtio_devices/src/vhost/vhost_user/net.rs
Outdated
Show resolved
Hide resolved
let config = VirtioDeviceConfig::<Arc<GuestMemoryMmap<()>>>::new( | ||
Arc::new(mem), | ||
address_space, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could you separate all addreess_space related change to a different commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've slipt that changes into a separate commit.
34866a8
to
0d8312e
Compare
c1a1c72
to
de9af1b
Compare
8cceae0
to
104d751
Compare
Hi @studychao, I've addressed the issues mentioned in your comments. Could you take a look at this again? Thanks! |
104d751
to
625d644
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
/test |
Vhost-user-net has a dependency on address space from `MmioV2DeviceState`. The addition of the address space is introduced in this patch. Plus, it makes sure all unit tests have the according parameter as well. Fixes: kata-containers#8502 Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
This PR introduces vhost-user-net devices to Dragonball. The devices are allowed to run as server on the VMM side. Fixes: kata-containers#8502 Signed-off-by: Eric Ren <renzhen@linux.alibaba.com> Signed-off-by: Liu Jiang <gerry@linux.alibaba.com> Signed-off-by: Zha Bin <zhabin@linux.alibaba.com> Signed-off-by: Chao Wu <chaowu@linux.alibaba.com> Signed-off-by: Zizheng Bian <zizheng.bian@linux.alibaba.com> Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
88d797d
to
e6c1868
Compare
e6c1868
to
4371cf1
Compare
/test |
Config space of network device is shared and accord with virtio 1.1 spec. It is a good way to abstract the common part into one function. `set_config_space()` implements this. Plus, this patch removes `vq_pairs` from vhost-net devices, since there is a possibility of data inconsistency. For example, some places read that from `self.vq_pairs`, others read from `queue_sizes.len() / 2`. Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
4371cf1
to
4c5de72
Compare
/test |
This PR introduces vhost-user-net devices to Dragonball. The devices are
allowed to run as server on the VMM side.
Fixes: #8502
Signed-off-by: Eric Ren renzhen@linux.alibaba.com
Signed-off-by: Liu Jiang gerry@linux.alibaba.com
Signed-off-by: Zha Bin zhabin@linux.alibaba.com
Signed-off-by: Chao Wu chaowu@linux.alibaba.com
Signed-off-by: Zizheng Bian zizheng.bian@linux.alibaba.com
Signed-off-by: Xuewei Niu niuxuewei.nxw@antgroup.com