From patchwork Fri May 22 17:17:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 11566025 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9517A1391 for ; Fri, 22 May 2020 17:21:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A844206C3 for ; Fri, 22 May 2020 17:21:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cUmx9dJp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A844206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:58162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcBMF-0002B9-Lm for patchwork-qemu-devel@patchwork.kernel.org; Fri, 22 May 2020 13:21:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46822) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcBJg-0006P8-PE for qemu-devel@nongnu.org; Fri, 22 May 2020 13:18:40 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:34006 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jcBJf-0000iy-VF for qemu-devel@nongnu.org; Fri, 22 May 2020 13:18:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590167918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IUvdZ9WOLD61EuJIHtGb6cIb8n0l3/qyiO43STZSrdY=; b=cUmx9dJpdM225LGWo+dNa+nfYhNfdwv4z69PADj30Za4Q8q8WvU9Kd8ulwFgC47wNZl3aK ijBhbh2mtJxhWlZL8mBDFxGyB0SQ+O7TEt5T1tb7AXQODcpz4am1fW4H+SoO7asjSFfDyf zn/fDJ6FxHetWOhOhEdbtCQ25UPjxEk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-943U-aW1MuaIJyqJiK7W1w-1; Fri, 22 May 2020 13:18:37 -0400 X-MC-Unique: 943U-aW1MuaIJyqJiK7W1w-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF1F88005AA; Fri, 22 May 2020 17:18:35 +0000 (UTC) Received: from localhost (ovpn-112-243.ams2.redhat.com [10.36.112.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id D69857820A; Fri, 22 May 2020 17:18:23 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH 5/5] virtio: enable VIRTIO_F_RING_PACKED for all devices Date: Fri, 22 May 2020 18:17:26 +0100 Message-Id: <20200522171726.648279-6-stefanha@redhat.com> In-Reply-To: <20200522171726.648279-1-stefanha@redhat.com> References: <20200522171726.648279-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.61; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/22 11:11:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MIME_BASE64_TEXT=1.741, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Laurent Vivier , Thomas Huth , Eduardo Habkost , qemu-block@nongnu.org, "Michael S. Tsirkin" , jasowang@redhat.com, cohuck@redhat.com, Stefan Hajnoczi , "Dr. David Alan Gilbert" , Raphael Norwitz , "Gonglei \(Arei\)" , Gerd Hoffmann , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Fam Zheng , Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The packed virtqueue layout was introduced in VIRTIO 1.1. It is a single ring instead of a split avail/used ring design. There are CPU cache advantages to this layout and it is also suited better to hardware implementation. The vhost-net backend has already supported packed virtqueues for some time. Performance benchmarks show that virtio-blk performance on NVMe drives is also improved. Go ahead and enable this feature for all VIRTIO devices. Keep it disabled for QEMU 5.0 and earlier machine types. Signed-off-by: Stefan Hajnoczi Reviewed-by: Dr. David Alan Gilbert --- include/hw/virtio/virtio.h | 2 +- hw/core/machine.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b69d517496..fd5b4a2044 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -292,7 +292,7 @@ typedef struct VirtIORNGConf VirtIORNGConf; DEFINE_PROP_BIT64("iommu_platform", _state, _field, \ VIRTIO_F_IOMMU_PLATFORM, false), \ DEFINE_PROP_BIT64("packed", _state, _field, \ - VIRTIO_F_RING_PACKED, false) + VIRTIO_F_RING_PACKED, true) hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); bool virtio_queue_enabled(VirtIODevice *vdev, int n); diff --git a/hw/core/machine.c b/hw/core/machine.c index bb3a7b18b1..3598c3c825 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -28,7 +28,23 @@ #include "hw/mem/nvdimm.h" #include "migration/vmstate.h" -GlobalProperty hw_compat_5_0[] = {}; +GlobalProperty hw_compat_5_0[] = { + { "vhost-user-blk", "packed", "off" }, + { "vhost-user-fs-device", "packed", "off" }, + { "vhost-vsock-device", "packed", "off" }, + { "virtio-9p-device", "packed", "off" }, + { "virtio-balloon-device", "packed", "off" }, + { "virtio-blk-device", "packed", "off" }, + { "virtio-crypto-device", "packed", "off" }, + { "virtio-gpu-device", "packed", "off" }, + { "virtio-input-device", "packed", "off" }, + { "virtio-iommu-device", "packed", "off" }, + { "virtio-net-device", "packed", "off" }, + { "virtio-pmem", "packed", "off" }, + { "virtio-rng-device", "packed", "off" }, + { "virtio-scsi-common", "packed", "off" }, + { "virtio-serial-device", "packed", "off" }, +}; const size_t hw_compat_5_0_len = G_N_ELEMENTS(hw_compat_5_0); GlobalProperty hw_compat_4_2[] = {