Commit 3b047a61 authored by Andreas Economides's avatar Andreas Economides Committed by Tomasz Zawadzki
Browse files

nvmf/vfio-user: support shadow doorbells



As per the NVMe specification, a host can identify two areas of guest
memory: one of which is used for the host-written doorbells, and one of
which contains event indexes. The host writes to the shadow doorbell
area, but also writes to the controller's BAR0 doorbell area if the
corresponding event index is crossed by the update. This avoids many
mmio exits in interrupt mode, where BAR0 doorbells are not directly
mapped into the guest VM, with greatly improved performance.

This isn't a useful feature in BAR0 doorbells are mapped into the VM, so
we explicitly disable support in that case.

NB: the Windows NVMe driver doesn't yet support this feature.

Although the specification says that the admin queues should also engage
in this behaviour, in practice, no VM does, so have to include some
hacks to account for this.

Co-authored-by: default avatarJohn Levon <john.levon@nutanix.com>
Signed-off-by: default avatarJohn Levon <john.levon@nutanix.com>
Change-Id: I0646b234d31fbbf9a6b85572042c6cdaf8366659
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11492


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 7f75e108
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6318,6 +6318,7 @@ no_wr_batching | Optional | boolean | Disable work requests batchin
control_msg_num             | Optional | number  | The number of control messages per poll group (TCP only)
disable_mappable_bar0       | Optional | boolean | disable client mmap() of BAR0 (VFIO-USER only)
disable_adaptive_irq        | Optional | boolean | Disable adaptive interrupt feature (VFIO-USER only)
disable_shadow_doorbells    | Optional | boolean | disable shadow doorbell support (VFIO-USER only)
zcopy                       | Optional | boolean | Use zero-copy operations if the underlying bdev supports them

#### Example
+654 −18

File changed.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ def nvmf_create_transport(client, **params):
        control_msg_num: The number of control messages per poll group - TCP specific (optional)
        disable_mappable_bar0: disable client mmap() of BAR0 - VFIO-USER specific (optional)
        disable_adaptive_irq: Disable adaptive interrupt feature - VFIO-USER specific (optional)
        disable_shadow_doorbells: disable shadow doorbell support - VFIO-USER specific (optional)
        acceptor_poll_rate: Acceptor poll period in microseconds (optional)
    Returns:
        True or False
+2 −0
Original line number Diff line number Diff line
@@ -2140,6 +2140,8 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
    Relevant only for VFIO-USER transport""")
    p.add_argument('-I', '--disable-adaptive-irq', action='store_true', help="""Disable adaptive interrupt feature.
    Relevant only for VFIO-USER transport""")
    p.add_argument('-S', '--disable-shadow-doorbells', action='store_true', help="""Disable shadow doorbell support.
    Relevant only for VFIO-USER transport""")
    p.add_argument('--acceptor-poll-rate', help='Polling interval of the acceptor for incoming connections (usec)', type=int)
    p.set_defaults(func=nvmf_create_transport)