virtio-scsi: dataplane: suppress guest notification

This patch uses vring_should_notify() to suppress
guest notification, and looks notification frequency
can be decreased from ~33K/sec to ~2K/sec in my test
environment.

Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Ming Lei 2014-11-12 11:24:35 +08:00 committed by Paolo Bonzini
parent c9cf45c1a4
commit 6012ca8159

View File

@ -92,10 +92,15 @@ VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s,
void virtio_scsi_vring_push_notify(VirtIOSCSIReq *req) void virtio_scsi_vring_push_notify(VirtIOSCSIReq *req)
{ {
VirtIODevice *vdev = VIRTIO_DEVICE(req->vring->parent);
vring_push(&req->vring->vring, &req->elem, vring_push(&req->vring->vring, &req->elem,
req->qsgl.size + req->resp_iov.size); req->qsgl.size + req->resp_iov.size);
if (vring_should_notify(vdev, &req->vring->vring)) {
event_notifier_set(&req->vring->guest_notifier); event_notifier_set(&req->vring->guest_notifier);
} }
}
static void virtio_scsi_iothread_handle_ctrl(EventNotifier *notifier) static void virtio_scsi_iothread_handle_ctrl(EventNotifier *notifier)
{ {