qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 3f7fe8: hw/nvme: Implement shadow doorbell bu


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 3f7fe8: hw/nvme: Implement shadow doorbell buffer support
Date: Fri, 15 Jul 2022 07:43:39 -0700

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 3f7fe8de3d49fdd2c1461fcd22fe73d84d2a9f8a
      
https://github.com/qemu/qemu/commit/3f7fe8de3d49fdd2c1461fcd22fe73d84d2a9f8a
  Author: Jinhao Fan <fanjinhao21s@ict.ac.cn>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M hw/nvme/ctrl.c
    M hw/nvme/nvme.h
    M include/block/nvme.h

  Log Message:
  -----------
  hw/nvme: Implement shadow doorbell buffer support

Implement Doorbel Buffer Config command (Section 5.7 in NVMe Spec 1.3)
and Shadow Doorbel buffer & EventIdx buffer handling logic (Section 7.13
in NVMe Spec 1.3). For queues created before the Doorbell Buffer Config
command, the nvme_dbbuf_config function tries to associate each existing
SQ and CQ with its Shadow Doorbel buffer and EventIdx buffer address.
Queues created after the Doorbell Buffer Config command will have the
doorbell buffers associated with them when they are initialized.

In nvme_process_sq and nvme_post_cqe, proactively check for Shadow
Doorbell buffer changes instead of wait for doorbell register changes.
This reduces the number of MMIOs.

In nvme_process_db(), update the shadow doorbell buffer value with
the doorbell register value if it is the admin queue. This is a hack
since hosts like Linux NVMe driver and SPDK do not use shadow
doorbell buffer for the admin queue. Copying the doorbell register
value to the shadow doorbell buffer allows us to support these hosts
as well as spec-compliant hosts that use shadow doorbell buffer for
the admin queue.

Signed-off-by: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
[k.jensen: rebased]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 387350d5f451b9f0c804f82f64ec127d5392bb3b
      
https://github.com/qemu/qemu/commit/387350d5f451b9f0c804f82f64ec127d5392bb3b
  Author: Jinhao Fan <fanjinhao21s@ict.ac.cn>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M hw/nvme/ctrl.c
    M hw/nvme/trace-events

  Log Message:
  -----------
  hw/nvme: Add trace events for shadow doorbell buffer

When shadow doorbell buffer is enabled, doorbell registers are lazily
updated. The actual queue head and tail pointers are stored in Shadow
Doorbell buffers.

Add trace events for updates on the Shadow Doorbell buffers and EventIdx
buffers. Also add trace event for the Doorbell Buffer Config command.

Signed-off-by: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
[k.jensen: rebased]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 146b5fa505fc21baa129c7538936fbdd9875b6ed
      
https://github.com/qemu/qemu/commit/146b5fa505fc21baa129c7538936fbdd9875b6ed
  Author: Niklas Cassel <niklas.cassel@wdc.com>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M docs/system/devices/nvme.rst

  Log Message:
  -----------
  hw/nvme: fix example serial in documentation

The serial prop on the controller is actually describing the nvme
subsystem serial, which has to be identical for all controllers within
the same nvme subsystem.

This is enforced since commit a859eb9f8f64 ("hw/nvme: enforce common
serial per subsystem").

Fix the documentation, so that people copying the qemu command line
example won't get an error on qemu start.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: dfa82ac201af28c451271d3f1dc6827b431cd827
      
https://github.com/qemu/qemu/commit/dfa82ac201af28c451271d3f1dc6827b431cd827
  Author: Niklas Cassel <niklas.cassel@wdc.com>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M hw/nvme/ns.c

  Log Message:
  -----------
  hw/nvme: force nvme-ns param 'shared' to false if no nvme-subsys node

Since commit 916b0f0b5264 ("hw/nvme: change nvme-ns 'shared' default")
the default value of nvme-ns param 'shared' is set to true, regardless
if there is a nvme-subsys node or not.

On a system without a nvme-subsys node, a namespace will never be able
to be attached to more than one controller, so for this configuration,
it is counterintuitive for this parameter to be set by default.

Force the nvme-ns param 'shared' to false for configurations where
there is no nvme-subsys node, as the namespace will never be able to
attach to more than one controller anyway.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 43f76aac49c439ea79c125d1befd9d5d7057dbb4
      
https://github.com/qemu/qemu/commit/43f76aac49c439ea79c125d1befd9d5d7057dbb4
  Author: Darren Kenny <darren.kenny@oracle.com>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M include/block/nvme.h

  Log Message:
  -----------
  nvme: Fix misleading macro when mixed with ternary operator

Using the Parfait source code analyser and issue was found in
hw/nvme/ctrl.c where the macros NVME_CAP_SET_CMBS and NVME_CAP_SET_PMRS
are called with a ternary operatore in the second parameter, resulting
in a potentially unexpected expansion of the form:

  x ? a: b & FLAG_TEST

which will result in a different result to:

  (x ? a: b) & FLAG_TEST.

The macros should wrap each of the parameters in brackets to ensure the
correct result on expansion.

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 2e53b0b450246044efd27418c5d05ad6919deb87
      
https://github.com/qemu/qemu/commit/2e53b0b450246044efd27418c5d05ad6919deb87
  Author: Jinhao Fan <fanjinhao21s@ict.ac.cn>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M hw/nvme/ctrl.c
    M hw/nvme/nvme.h

  Log Message:
  -----------
  hw/nvme: Use ioeventfd to handle doorbell updates

Add property "ioeventfd" which is enabled by default. When this is
enabled, updates on the doorbell registers will cause KVM to signal
an event to the QEMU main loop to handle the doorbell updates.
Therefore, instead of letting the vcpu thread run both guest VM and
IO emulation, we now use the main loop thread to do IO emulation and
thus the vcpu thread has more cycles for the guest VM.

Since ioeventfd does not tell us the exact value that is written, it is
only useful when shadow doorbell buffer is enabled, where we check
for the value in the shadow doorbell buffer when we get the doorbell
update event.

IOPS comparison on Linux 5.19-rc2: (Unit: KIOPS)

qd           1   4  16  64
qemu        35 121 176 153
ioeventfd   41 133 258 313

Changes since v3:
 - Do not deregister ioeventfd when it was not enabled on a SQ/CQ

Signed-off-by: Jinhao Fan <fanjinhao21s@ict.ac.cn>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>


  Commit: 0ebf76aae58324b8f7bf6af798696687f5f4c2a9
      
https://github.com/qemu/qemu/commit/0ebf76aae58324b8f7bf6af798696687f5f4c2a9
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2022-07-15 (Fri, 15 Jul 2022)

  Changed paths:
    M docs/system/devices/nvme.rst
    M hw/nvme/ctrl.c
    M hw/nvme/ns.c
    M hw/nvme/nvme.h
    M hw/nvme/trace-events
    M include/block/nvme.h

  Log Message:
  -----------
  Merge tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme into 
staging

hw/nvme updates

performance improvements by Jinhao
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* shadow doorbells
* ioeventfd

plus some misc fixes (Darren, Niklas).

# gpg: Signature made Fri 15 Jul 2022 09:42:20 BST
# gpg:                using RSA key 522833AA75E2DCE6A24766C04DE1AF316D4F0DE9
# gpg: Good signature from "Klaus Jensen <its@irrelevant.dk>" [unknown]
# gpg:                 aka "Klaus Jensen <k.jensen@samsung.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: DDCA 4D9C 9EF9 31CC 3468  4272 63D5 6FC5 E55D A838
#      Subkey fingerprint: 5228 33AA 75E2 DCE6 A247  66C0 4DE1 AF31 6D4F 0DE9

* tag 'nvme-next-pull-request' of git://git.infradead.org/qemu-nvme:
  hw/nvme: Use ioeventfd to handle doorbell updates
  nvme: Fix misleading macro when mixed with ternary operator
  hw/nvme: force nvme-ns param 'shared' to false if no nvme-subsys node
  hw/nvme: fix example serial in documentation
  hw/nvme: Add trace events for shadow doorbell buffer
  hw/nvme: Implement shadow doorbell buffer support

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/44bfcf628b15...0ebf76aae583



reply via email to

[Prev in Thread] Current Thread [Next in Thread]