Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Replacing Vec with SmallVec causes CMBC's memory usage to grow unboundedly during post-processing #2944

Open
roypat opened this issue Dec 14, 2023 · 1 comment
Assignees
Labels
[C] Bug This is a bug. Something isn't working. [E] Performance Track performance improvement (Time / Memory / CPU) T-User Tag user issues / requests

Comments

@roypat
Copy link

roypat commented Dec 14, 2023

Hi all,
Over at Firecracker we recently had to make some changes to our virtio code (which is covered by kani harnesses). As part of this, we replaced a Vec with a SmallVec for performance reasons (as descriptor chains heuristically are "short", so by using a SmallVec we can avoid an allocation most of the time). However, the harnesses at https://github.com/firecracker-microvm/firecracker/blob/main/src/vmm/src/devices/virtio/iovec.rs#L714 started timing out in our CI after that. Investigating manually showed that after the Symex step, Kani seemingly gets stuck in its post-processing phase, where CMBC just slowly uses more and more RAM until the system locks up.

To reproduce, remove the cfg directives at https://github.com/firecracker-microvm/firecracker/blob/036d9906a09ed759597ee88bab6c1278e4fd7655/src/vmm/src/devices/virtio/iovec.rs#L28-L31 and try to run the iovec harnesses.

Command line invocation:

cargo kani --enable-unstable -Z stubbing -Z function-contracts --restrict-vtable -j --output-format terse --harness iovec

Kani version: 0.41.0

@tautschnig
Copy link
Member

The symptoms point to a use of arrays of non-fixed size. It's not really obvious to me from SmallVec's documentation why we newly should end up with such, so I'll have to look at the intermediate representation that's being produced.

@tautschnig tautschnig self-assigned this Dec 14, 2023
@zhassan-aws zhassan-aws added [E] Performance Track performance improvement (Time / Memory / CPU) T-User Tag user issues / requests labels Jan 8, 2024
@celinval celinval assigned feliperodri and unassigned tautschnig Jan 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
[C] Bug This is a bug. Something isn't working. [E] Performance Track performance improvement (Time / Memory / CPU) T-User Tag user issues / requests
Projects
None yet
Development

No branches or pull requests

4 participants