aboutsummaryrefslogtreecommitdiff
path: root/hw/nvme/nvme.h
diff options
context:
space:
mode:
authorJinhao Fan <fanjinhao21s@ict.ac.cn>2022-07-05 22:24:03 +0800
committerKlaus Jensen <k.jensen@samsung.com>2022-07-15 10:40:33 +0200
commit2e53b0b450246044efd27418c5d05ad6919deb87 (patch)
tree6f3af9fae825f294e1aa513fe9290175bc0c7de5 /hw/nvme/nvme.h
parent43f76aac49c439ea79c125d1befd9d5d7057dbb4 (diff)
downloadqemu-2e53b0b450246044efd27418c5d05ad6919deb87.zip
qemu-2e53b0b450246044efd27418c5d05ad6919deb87.tar.gz
qemu-2e53b0b450246044efd27418c5d05ad6919deb87.tar.bz2
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>
Diffstat (limited to 'hw/nvme/nvme.h')
-rw-r--r--hw/nvme/nvme.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 0711b97..79f5c28 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -376,6 +376,8 @@ typedef struct NvmeSQueue {
uint64_t db_addr;
uint64_t ei_addr;
QEMUTimer *timer;
+ EventNotifier notifier;
+ bool ioeventfd_enabled;
NvmeRequest *io_req;
QTAILQ_HEAD(, NvmeRequest) req_list;
QTAILQ_HEAD(, NvmeRequest) out_req_list;
@@ -395,6 +397,8 @@ typedef struct NvmeCQueue {
uint64_t db_addr;
uint64_t ei_addr;
QEMUTimer *timer;
+ EventNotifier notifier;
+ bool ioeventfd_enabled;
QTAILQ_HEAD(, NvmeSQueue) sq_list;
QTAILQ_HEAD(, NvmeRequest) req_list;
} NvmeCQueue;
@@ -417,6 +421,7 @@ typedef struct NvmeParams {
uint8_t zasl;
bool auto_transition_zones;
bool legacy_cmb;
+ bool ioeventfd;
uint8_t sriov_max_vfs;
uint16_t sriov_vq_flexible;
uint16_t sriov_vi_flexible;