Skip to content

Implement a simple interval tree.#1

Merged
sameo merged 1 commit into
cloud-hypervisor:dragonballfrom
wllenyj:dragonball
Jul 1, 2020
Merged

Implement a simple interval tree.#1
sameo merged 1 commit into
cloud-hypervisor:dragonballfrom
wllenyj:dragonball

Conversation

@wllenyj

@wllenyj wllenyj commented Dec 16, 2019

Copy link
Copy Markdown

A special interval tree implementation for VMM resource management.
It's not designed as a generic interval tree, but specialized for VMM
resource management.

Signed-off-by: wllenyj wllenyj@linux.alibaba.com

A special interval tree implementation for VMM resource management.
It's not designed as a generic interval tree, but specialized for VMM
resource management.

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>

@sboeuf sboeuf left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why we need such a complex and rich Interval tree? I'm asking because it's not obvious which benefits this will bring. Could you elaborate on the need for this and include it part of the documentation (in the code) and also as part of the git commit.

@jiangliu

Copy link
Copy Markdown

It will be used to manage PCI bus resources, such as mmio/pio address ranges. We are refactoring PCI crate from cloud hypervisor.

@sameo

sameo commented Dec 20, 2019

Copy link
Copy Markdown
Member

It will be used to manage PCI bus resources, such as mmio/pio address ranges. We are refactoring PCI crate from cloud hypervisor.

I think @sboeuf question is similar to the one I asked upstream.
The code from this PR looks nice, but we are missing the requirements behind the complexity it carries. It would be good to e.g. document them from this PR. Personally I'd like to understand:

  • What are the VMM specific requirements for managing an interval tree? What are we trying to solve with that PR compared to the current cloud hypervisor vm-allocator?
  • How would that work with an actual device creation? Showing the workflow for (device resources creation -> device resources translation to Constraint -> device resources allocation from this allocator) would be nice.
  • It seems that each node on this tree holds a (range, NodeState<T>) couple. Basically you're trying to map a range to potentially some object. It would be very useful to get some VMM related examples of what T would be. Something like a PCI bar? Or a chunk of RAM?
  • Why isn't a simpler BTreeMap<Range, NodeState<T>>, not good enough?

@jiangliu

Copy link
Copy Markdown

Here is an example to use the interval tree to implement an epoll manager with support of device hotplug.
https://github.com/jiangliu/vmm-epoll/blob/v2/src/interval_tree_mt.rs

Actually the device manager should use an interval tree instead of an btree to map address to registered DeviceIo objects.

@sameo

sameo commented Jul 1, 2020

Copy link
Copy Markdown
Member

I'm merging this PR into the dragonball branch in order to allow @jiangliu to submit the vm-pci code from dragonball.

@sameo sameo merged commit 62a19f0 into cloud-hypervisor:dragonball Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants