-
Notifications
You must be signed in to change notification settings - Fork 42
virtio-queue: update virtio-queue to v0.6.0 #248
Conversation
for queue in self.queues.iter_mut() { | ||
queue.queue = Q::new(queue.queue.max_size()); | ||
let new_queue = Q::new(queue.queue.max_size()); |
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 part need to be reviewed more carefully.
Other parts are just changeing the parameter names.
@@ -68,8 +68,9 @@ impl<Q: QueueStateT> VirtioQueueConfig<Q> { | |||
pub fn create(queue_size: u16, index: u16) -> Result<Self> { | |||
let eventfd = EventFd::new(EFD_NONBLOCK).map_err(Error::IOError)?; | |||
|
|||
let queue = Q::new(queue_size)?; |
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 part need to be reviewed more carefully.
Other parts are just changeing the parameter names.
@@ -32,7 +32,7 @@ serde_json = "1.0.9" | |||
thiserror = "1" | |||
threadpool = "1" | |||
virtio-bindings = "0.1.0" | |||
virtio-queue = "0.4.0" | |||
virtio-queue = "0.6.0" | |||
vmm-sys-util = "0.11.0" | |||
vm-memory = { version = "0.9.0", features = [ "backend-mmap" ] } |
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.
Does this need to be updated too?
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 there is no need. Since virtio-queue
0.6.0 use vm-memory
0.9.0 and 0.10.0 of vm-memory may cause conflict.
let new_queue = Q::new(queue.queue.max_size()); | ||
if let Err(e) = new_queue { | ||
reset_suc_flag = false; | ||
warn!("reset device failed because new virtio-queue could not be created due to {:?}", e); |
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.
If one of the Queues fails to initialize, the device does not work.
I think is it better to panic directly? @jiangliu
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.
Or modify the reset
function to return Result
, and the caller decides the next action.
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.
Result
is added for reset
.
And how the caller handle reset
's Result
is also updated (in mmio_v2.rs
).
0259da7
to
8151514
Compare
8151514
to
e57c9e6
Compare
Since the vm-memory conflict brought by virtio-queue 0.4.0, we need to upgrade virtio-queue to the newest version. Meanwhile, virtio-queue change a lot of APIs from 0.4.0 to 0.5.0, so this PR mainly for fixing all the API changes. fixes: openanolis#249 Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
e57c9e6
to
1caffd3
Compare
In order to solve virtio-queue dependency problem, we need to update nydus crates. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
Update the unit tests that are related to virtio-queue upgrade changes. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
09a5289
to
5179716
Compare
Codecov Report
@@ Coverage Diff @@
## main #248 +/- ##
==========================================
- Coverage 91.57% 91.57% -0.01%
==========================================
Files 80 80
Lines 22429 22369 -60
==========================================
- Hits 20540 20484 -56
+ Misses 1889 1885 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
5179716
to
167f8d6
Compare
@@ -842,8 +842,8 @@ pub(crate) mod tests { | |||
let gm = GuestMemoryAtomic::<GuestMemoryMmap>::new(gmm); | |||
|
|||
let queues = vec![ | |||
VirtioQueueConfig::create(0, 0).unwrap(), | |||
VirtioQueueConfig::create(0, 0).unwrap(), |
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.
What error will be reported if it is not modified?
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.
In the new Virtio-queue, when creating Virtio queue, it will check that the max size is a power of 2 because the valid queue sizes are a power of 2 as per the specification.
So here we could not successfully create a Virtio queue with a max size of 0
@@ -62,12 +61,6 @@ pub(crate) const PASSTHROUGHFS: &str = "passthroughfs"; | |||
pub(crate) const BLOBFS: &str = "blobfs"; | |||
pub(crate) const RAFS: &str = "rafs"; | |||
|
|||
#[derive(Clone, Deserialize)] | |||
struct BlobCacheConfig { |
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 this useless?
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.
Yes, in the new Nydus-api, they introduce ConfigV2
, it could be created through RafsConfig
str. blob_config
is directly generated in the creation of ConfigV2
, so there is no need for dbs-virtio-devices to define and create the BlobCacheConfig for Nydus.
@@ -1,4 +1,5 @@ | |||
// Copyright 2022 Alibaba Cloud. All Rights Reserved. | |||
// Copyright 2022 Alibaba Cloud. All Rights Reserved. |
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.
Repeated
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
@@ -295,10 +289,10 @@ impl<AS: GuestAddressSpace> VirtioFs<AS> { | |||
"bootstrap_path": "{}", | |||
"blob_cache_dir": "{}" | |||
}}"#, | |||
cfg, source, &blob_config.work_dir | |||
cfg, source, blob_config.as_ref().unwrap().work_dir |
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.
Need to return Error here? This is the behavior at runtime.
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.
FsError::InvalidData
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 all the unwrap()
with ok_or()
to define FsError
291bb4a
to
4216a65
Compare
|
||
( | ||
Rafs::new(rafs_conf, mountpoint, &mut file) | ||
Rafs::new(&rafs_conf, mountpoint, &mut file) |
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.
Can it work without the reference?
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.
Nope, Rafs
api has changed in the new Nydus.
It seems that there are still a few clippy that have not been fixed. |
fix several clippy errors introduced by the latest Rust. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
adjust some queue size in UT to fix queue size erorr. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
update nydus-api, nydus-blobfs and nydus-rafs to fit with the virtio-queue version. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
5d0b1b6
to
bfc1831
Compare
bfc1831
to
263e207
Compare
Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
263e207
to
8e1c81e
Compare
Since the vm-memory conflict brought by virtio-queue 0.4.0, we need to upgrade virtio-queue to the newest version. Meanwhile, virtio-queue change a lot of APIs from 0.4.0 to 0.5.0, so this PR mainly for fixing all the API changes.
Signed-off-by: Chao Wu chaowu@linux.alibaba.com