• Rob Nelson's avatar
    UBUNTU: SAUCE: nvme: improve performance for virtual NVMe devices · 4a4037f2
    Rob Nelson authored
    BugLink: http://bugs.launchpad.net/bugs/1637565
    
    This change provides a mechanism to reduce the number of MMIO doorbell
    writes for the NVMe driver. When running in a virtualized environment
    like QEMU, the cost of an MMIO is quite hefy here. The main idea for
    the patch is provide the device two memory location locations:
     1) to store the doorbell values so they can be lookup without the doorbell
        MMIO write
     2) to store an event index.
    I believe the doorbell value is obvious, the event index not so much.
    Similar to the virtio specificaiton, the virtual device can tell the
    driver (guest OS) not to write MMIO unless you are writing past this
    value.
    
    FYI: doorbell values are written by the nvme driver (guest OS) and the
    event index is written by the virtual device (host OS).
    
    The patch implements a new admin command that will communicate where
    these two memory locations reside. If the command fails, the nvme
    driver will work as before without any optimizations.
    
    Contributions:
      Eric Northup <digitaleric@google.com>
      Frank Swiderski <fes@google.com>
      Ted Tso <tytso@mit.edu>
      Keith Busch <keith.busch@intel.com>
    
    Just to give an idea on the performance boost with the vendor
    extension: Running fio [1], a stock NVMe driver I get about 200K read
    IOPs with my vendor patch I get about 1000K read IOPs. This was
    running with a null device i.e. the backing device simply returned
    success on every read IO request.
    
    [1] Running on a 4 core machine:
      fio --time_based --name=benchmark --runtime=30
      --filename=/dev/nvme0n1 --nrfiles=1 --ioengine=libaio --iodepth=32
      --direct=1 --invalidate=1 --verify=0 --verify_fatal=0 --numjobs=4
      --rw=randread --blocksize=4k --randrepeat=false
    Signed-off-by: default avatarRob Nelson <rlnelson@google.com>
    [mlin: port for upstream]
    Signed-off-by: default avatarMing Lin <mlin@kernel.org>
    [koike: updated for current APIs]
    Signed-off-by: default avatarHelen Mae Koike Fornazier <helen.koike@collabora.co.uk>
    Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
    Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
    Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
    Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
    4a4037f2
Kconfig 1.08 KB