cloudius-systems / osv

OSv, a new operating system for the cloud.
osv.io
Other
4.12k stars 605 forks source link

Implement NVMe driver #1203

Closed wkozaczuk closed 5 months ago

wkozaczuk commented 2 years ago

This is one of the blocks of work to allow running OSv on KVM-based EC2 instances.

Here are some helpful resources:

Testing this should not be to difficult as QEMU supports NVMe.

Refs #924

wkozaczuk commented 1 year ago

My "archeology" effort revealed that @imp implemented NVMe driver for OSv in 2015 but it looks like the branch and his fork -https://github.com/imp/osv/tree/nvme - are sadly gone :-(

imp commented 1 year ago

@wkozaczuk Wow! That work still lives in https://gitlab.com/osv/osv/-/commits/nvme/. Although I am not sure how applicable that code would be after all those years.

wkozaczuk commented 1 year ago

Thanks a lot, @imp!

I have very recently learned that one of the students has been working on adding NVMe support to OSv as part of his Bachelor thesis. So we may have 2 implementations soon!

As you point out yours may be a little outdated but many ideas and concepts are not. It will for sure be useful to look at it for comparison at least.

Please keep this branch around if you do not mind.

Meandres commented 1 year ago

I am currently using a NVMe driver on OSv that we implemented based on uNVMe. It works for my use case but it is not included in the OSv devfs nor in the vfs. Therefore, for now, I rely on calling the drivers functions directly from the application. You can find the code at https://github.com/Meandres/osv/tree/master/drivers especially the *nvme* files and pt.cpp (this is very hacky aswell and would need to be integrated to use OSv memory subsystem). I have tested this with QEMU emulated device and I am currently using it with pci-passthrough. Both run fine except that there seems to be some scalability issues. I am not sure at the moment if this driver is the problem or not.

wkozaczuk commented 10 months ago

@Meandres Thanks, I will take a look.

wkozaczuk commented 10 months ago

BTW we also have another PR implementing nvme - https://github.com/cloudius-systems/osv/pull/1284