Skip to content
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

Implement nvme driver #1284

Closed
wants to merge 1 commit into from

Commits on Dec 7, 2023

  1. Implement a nvme driver

    The implemented driver allows OSv to boot from a emulated nvme device and
    handle additional nvme devices, emulated or passed through from the host.
    Booting directly from a nvme via pci-passthrough needs to be tested.
    
    The nvme driver creates nvme_queue_pairs to interact with the device
    controller. A nvme_queue_pair manages a submission queue and the
    corresponding completion queue.
    The nvme driver registers every namespace as device and forwards requests
    to the queues. Namespace 1 on the first nvme drive is named "vblk0".
    Further devices are named nvmeXnY where X is the driver instance id
    starting with 0 and Y is the namespace id starting with 1.
    
    Read/Write requests on the device file go through the block cache layer.
    This can reduce performance quite a bit, since the block cache splits
    every request into 512B-sized sequentiell requests. Setting
    NVME_DIRECT_RW_ENABLED in /drivers/nvme.hh disables the block cache.
    
    All queues use MSI-X. 1 interrupt vector gets registered for every queue.
    There is very noticeable overhead while using pci-passthrough. This gets
    reduced by using interrupt coalescing but needs to be further investigated.
    
    Add options to ./scripts/run.py:
    --nvme to start OSv on a nvme emulated by QEMU
    --second-nvme-image to attach an additional image as nvme
    --pass-pci to passthrough a pci device from the host
        the device needs to be bound to vfio-pci
    
    drivers/blk_ioctl.hh implements the BLKGETSIZE64 and BLKFLSBUF
    ioctl which are used by fio
    
    drivers/io-test.cc is an simple iops test that can be activated by
    building with conf_drivers_io_test=1 and runs during initialization
    of the nvme device
    
    Signed-off-by: Jan Braunwarth <jan.braunwarth@gmail.com>
    JanBraunwarth committed Dec 7, 2023
    Configuration menu
    Copy the full SHA
    2b84047 View commit details
    Browse the repository at this point in the history