From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597766970; cv=none; d=zohomail.com; s=zohoarc; b=R5jJbroc/Ius02auFyGEOcJ2VVGpTnuWYRc+TIlK6xC1yd95aoGkWBB8/oruLTxVy7j3lBvjCE+sX+llZC9HucN6ETnYDne+ze47rY+P4G/ELfOUIKVMHYoN8Nzp8obf8rkq7t7QByDSIxiffOeCzayJ5ZakX/UF/lQ57XHR62A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597766970; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kaTbMGanT71s89DsJoOZGDCpWg1RR6kbH+cjUVEgFgU=; b=nmwTKumfYAuU1O6/6j7XG3NbeYJtb6r9HoJximqQziPsaqoKY500jzbDvvD1F/tf7ftR7FEAIixufF7lovJ2TwhBc8bCBw7/LDCj4JArLYxtQ6cMIO0TfHp6wnG2vbhdWuF4s0qyQgs4qSK48Y3KSjnz+03CzZzVqJOzFmWDBZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597766970144922.2843584980405; Tue, 18 Aug 2020 09:09:30 -0700 (PDT) Received: from localhost ([::1]:59208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83Xv-00056p-G2 for importer@patchew.org; Tue, 18 Aug 2020 11:29:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39332) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82gz-0004rF-RY for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24110) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k82gv-0002Sc-TY for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:25 -0400 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-241-TZ6N2GSJOE2UYmnKRps_6g-1; Tue, 18 Aug 2020 10:34:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CA11A8B8D22; Tue, 18 Aug 2020 14:34:04 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id E07C16B8E0; Tue, 18 Aug 2020 14:34:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761261; 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=kaTbMGanT71s89DsJoOZGDCpWg1RR6kbH+cjUVEgFgU=; b=bUCeU7YkZa9wDlAREaE7ZbGKkuilNzs0cdU6KodMvRZpOveHD8c4hRXww3ZtxD8MjEqgIx uxzF06mqCYM02XKl5RUIvsZ/5MSeWFt/3zFrZLZFjhX4AV5qfFFi0k6zgR7h4+Zm/oZGaX XYkVr1hsoTIek94oL9XE4Mbln/n7GMk= X-MC-Unique: TZ6N2GSJOE2UYmnKRps_6g-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 1/7] Open 5.2 development tree Date: Tue, 18 Aug 2020 15:33:42 +0100 Message-Id: <20200818143348.310613-2-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 03:22:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Peter Maydell Signed-off-by: Peter Maydell --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 831446cbd2..7d40cb9d36 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5.1.0 +5.1.50 --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597765369; cv=none; d=zohomail.com; s=zohoarc; b=SZ9iVzXm7ERkLcJDk6ozxO5GV2dyj6Karbi0bjNkPbUkHH320abrh7yf60rNv8iVQ+Fu0+a3fQ/3q+NNva8peYfCNundHARKgq269jNMXeE0z/9BGV66Spya1XSLdBnHCzce0E1BsxE1Eix3eCa/c/3aK5z40XTmwQKHXECHQGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597765369; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=HOG+ga21RN+jPe4nYGRhOF2dFDcBwB77Hby8t3ftink=; b=SL4Qz31PFOPQvyFa84otS+jcgLzA9P9ObfIO4J+9tkM1BsWCvlYZ/Om9hyrl4E9sFo7QN64a+6/OpHgHPRkxS97EtespEF+Dc59vfvuEzypfJ8aboOQw5WFnnN3xj5+1c54wFl6NpLxZwrXhZc9rg2Sz5erXbm9F4ZouHj0lphs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597765369306869.8580054131978; Tue, 18 Aug 2020 08:42:49 -0700 (PDT) Received: from localhost ([::1]:54536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83l9-000222-Ph for importer@patchew.org; Tue, 18 Aug 2020 11:42:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82gz-0004rJ-Tr for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k82gw-0002Sh-2H for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:25 -0400 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-121-b192owauMBqX7_Tk9_Djzg-1; Tue, 18 Aug 2020 10:34:19 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AF21106C100; Tue, 18 Aug 2020 14:34:07 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2AD7D1063426; Tue, 18 Aug 2020 14:34:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761261; 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=HOG+ga21RN+jPe4nYGRhOF2dFDcBwB77Hby8t3ftink=; b=OwiMgm7PDgUsCZigM8R2G1yRKVsFff4qKvKj3XHo4OzlAAzcv79+DOYcNGKrxux8lEvc4+ VuvE/CvqKUCKdFCvthZRJCbgHVLyH/oeG1yOIpSr3sTPncg80YDs2M3uKHe/nbwQKDlNTu QDJhTMp/khcQMVyFl3Ov6FGLWIJRNVQ= X-MC-Unique: b192owauMBqX7_Tk9_Djzg-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 2/7] hw: add 5.2 machine types and 5.1 compat options Date: Tue, 18 Aug 2020 15:33:43 +0100 Message-Id: <20200818143348.310613-3-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 03:22:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" arm, i386, ppc, and s390x have versioned machine types and associated compatibility options. Introduce new ones now that QEMU 5.1 has been released. Signed-off-by: Stefan Hajnoczi Reviewed-by: Igor Mammedov --- include/hw/boards.h | 3 +++ include/hw/i386/pc.h | 3 +++ hw/arm/virt.c | 9 ++++++++- hw/core/machine.c | 4 ++++ hw/i386/pc.c | 4 ++++ hw/i386/pc_piix.c | 14 +++++++++++++- hw/i386/pc_q35.c | 13 ++++++++++++- hw/ppc/spapr.c | 15 +++++++++++++-- hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++- 9 files changed, 73 insertions(+), 6 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 426ce5f625..bc5b82ad20 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -319,6 +319,9 @@ struct MachineState { } \ type_init(machine_initfn##_register_types) =20 +extern GlobalProperty hw_compat_5_1[]; +extern const size_t hw_compat_5_1_len; + extern GlobalProperty hw_compat_5_0[]; extern const size_t hw_compat_5_0_len; =20 diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 3d7ed3a55e..fe52e165b2 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -193,6 +193,9 @@ void pc_system_firmware_init(PCMachineState *pcms, Memo= ryRegion *rom_memory); void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid, const CPUArchIdList *apic_ids, GArray *entry); =20 +extern GlobalProperty pc_compat_5_1[]; +extern const size_t pc_compat_5_1_len; + extern GlobalProperty pc_compat_5_0[]; extern const size_t pc_compat_5_0_len; =20 diff --git a/hw/arm/virt.c b/hw/arm/virt.c index ecfee362a1..acf9bfbece 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -2546,10 +2546,17 @@ static void machvirt_machine_init(void) } type_init(machvirt_machine_init); =20 +static void virt_machine_5_2_options(MachineClass *mc) +{ +} +DEFINE_VIRT_MACHINE_AS_LATEST(5, 2) + static void virt_machine_5_1_options(MachineClass *mc) { + virt_machine_5_2_options(mc); + compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); } -DEFINE_VIRT_MACHINE_AS_LATEST(5, 1) +DEFINE_VIRT_MACHINE(5, 1) =20 static void virt_machine_5_0_options(MachineClass *mc) { diff --git a/hw/core/machine.c b/hw/core/machine.c index 8d1a90c6cf..a6f7e4e8d7 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -28,6 +28,10 @@ #include "hw/mem/nvdimm.h" #include "migration/vmstate.h" =20 +GlobalProperty hw_compat_5_1[] =3D { +}; +const size_t hw_compat_5_1_len =3D G_N_ELEMENTS(hw_compat_5_1); + GlobalProperty hw_compat_5_0[] =3D { { "pci-host-bridge", "x-config-reg-migration-enabled", "off" }, { "virtio-balloon-device", "page-poison", "false" }, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 47c5ca3e34..4afcf17f99 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -97,6 +97,10 @@ #include "fw_cfg.h" #include "trace.h" =20 +GlobalProperty pc_compat_5_1[] =3D { +}; +const size_t pc_compat_5_1_len =3D G_N_ELEMENTS(pc_compat_5_1); + GlobalProperty pc_compat_5_0[] =3D { }; const size_t pc_compat_5_0_len =3D G_N_ELEMENTS(pc_compat_5_0); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b789e83f9a..9ce1f9c5d6 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -426,7 +426,7 @@ static void pc_i440fx_machine_options(MachineClass *m) machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE); } =20 -static void pc_i440fx_5_1_machine_options(MachineClass *m) +static void pc_i440fx_5_2_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_machine_options(m); @@ -435,6 +435,18 @@ static void pc_i440fx_5_1_machine_options(MachineClass= *m) pcmc->default_cpu_version =3D 1; } =20 +DEFINE_I440FX_MACHINE(v5_2, "pc-i440fx-5.2", NULL, + pc_i440fx_5_2_machine_options); + +static void pc_i440fx_5_1_machine_options(MachineClass *m) +{ + pc_i440fx_machine_options(m); + m->alias =3D NULL; + m->is_default =3D false; + compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); + compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); +} + DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL, pc_i440fx_5_1_machine_options); =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index a3e607a544..4acaad557c 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -353,7 +353,7 @@ static void pc_q35_machine_options(MachineClass *m) m->max_cpus =3D 288; } =20 -static void pc_q35_5_1_machine_options(MachineClass *m) +static void pc_q35_5_2_machine_options(MachineClass *m) { PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_machine_options(m); @@ -361,6 +361,17 @@ static void pc_q35_5_1_machine_options(MachineClass *m) pcmc->default_cpu_version =3D 1; } =20 +DEFINE_Q35_MACHINE(v5_2, "pc-q35-5.2", NULL, + pc_q35_5_2_machine_options); + +static void pc_q35_5_1_machine_options(MachineClass *m) +{ + pc_q35_machine_options(m); + m->alias =3D NULL; + compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); + compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); +} + DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL, pc_q35_5_1_machine_options); =20 diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0ae293ec94..1c8d0981b3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -4579,15 +4579,26 @@ static void spapr_machine_latest_class_options(Mach= ineClass *mc) } \ type_init(spapr_machine_register_##suffix) =20 +/* + * pseries-5.2 + */ +static void spapr_machine_5_2_class_options(MachineClass *mc) +{ + /* Defaults for the latest behaviour inherited from the base class */ +} + +DEFINE_SPAPR_MACHINE(5_2, "5.2", true); + /* * pseries-5.1 */ static void spapr_machine_5_1_class_options(MachineClass *mc) { - /* Defaults for the latest behaviour inherited from the base class */ + spapr_machine_5_2_class_options(mc); + compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); } =20 -DEFINE_SPAPR_MACHINE(5_1, "5.1", true); +DEFINE_SPAPR_MACHINE(5_1, "5.1", false); =20 /* * pseries-5.0 diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e72c61d2ea..f4ea6a9545 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -801,14 +801,26 @@ bool css_migration_enabled(void) } = \ type_init(ccw_machine_register_##suffix) =20 +static void ccw_machine_5_2_instance_options(MachineState *machine) +{ +} + +static void ccw_machine_5_2_class_options(MachineClass *mc) +{ +} +DEFINE_CCW_MACHINE(5_2, "5.2", true); + static void ccw_machine_5_1_instance_options(MachineState *machine) { + ccw_machine_5_2_instance_options(machine); } =20 static void ccw_machine_5_1_class_options(MachineClass *mc) { + ccw_machine_5_2_class_options(mc); + compat_props_add(mc->compat_props, hw_compat_5_1, hw_compat_5_1_len); } -DEFINE_CCW_MACHINE(5_1, "5.1", true); +DEFINE_CCW_MACHINE(5_1, "5.1", false); =20 static void ccw_machine_5_0_instance_options(MachineState *machine) { --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597765515; cv=none; d=zohomail.com; s=zohoarc; b=MCPcbG8rNyqdkNrevwFa2LqdNNFxyYrIxsmYNviAuX/OxH41RegjoRJTSMP20fXIwHdA9kFIdZQXHS+Dr9D2jT10lm2Ld0D1AO3PRwCCTkCscAxdANFmqO1Z7jIoFel5CgtQIBrGakv180AMaVYJYqZ5WPC5xG6OqR5OZKH0ns8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597765515; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ENnQwlZiy2s0di8Jd6xc923V8L9TxtXZ4z/RSHMFSr8=; b=iyX6te40tu9/0Yr5TSB7binzhoLM18zdv+GElBgKFG+c/kzXtfFIwOu2xu0/oCSlDvN9a0nl+Wf0a3OL8DUNGT2lz6mu+aeDguvKenuLGaKY8hXMHYAFJ+clnYYowXpuvCJ9IKpQO4b45VKCflIvtq2Ic8luj1/RmiE+mt/bfEM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597765515179699.3687305737204; Tue, 18 Aug 2020 08:45:15 -0700 (PDT) Received: from localhost ([::1]:36128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83nV-00068i-Tn for importer@patchew.org; Tue, 18 Aug 2020 11:45:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82h4-0004xn-KY for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23125) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k82h1-0002UL-Eq for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:30 -0400 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-511-KZGcSDqNOqiXxGbvOPpf-Q-1; Tue, 18 Aug 2020 10:34:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8453AD32C; Tue, 18 Aug 2020 14:34:08 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34E712CFC6; Tue, 18 Aug 2020 14:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761266; 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=ENnQwlZiy2s0di8Jd6xc923V8L9TxtXZ4z/RSHMFSr8=; b=RgTT7fZnqe3Ifq8Tfxo2L3bbuSmHBDIeTIQe97wrJBx+ctUTLljLZox3Ck0JPrKND7mtX6 zfW7pugnWqwFzJwkCuBJPGDFothgHdmtJgwOaI56I0kZn0Xzb4Qxh1Zz6xEMcELp8IAAuI zrAZpHIVAZm02eE4XkxzNyQeqaWZFuQ= X-MC-Unique: KZGcSDqNOqiXxGbvOPpf-Q-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 3/7] virtio-pci: add virtio_pci_optimal_num_queues() helper Date: Tue, 18 Aug 2020 15:33:44 +0100 Message-Id: <20200818143348.310613-4-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 03:22:11 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H5=-1, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Multi-queue devices achieve the best performance when each vCPU has a dedicated queue. This ensures that virtqueue used notifications are handled on the same vCPU that submitted virtqueue buffers. When another vCPU handles the the notification an IPI will be necessary to wake the submission vCPU and this incurs a performance overhead. Provide a helper function that virtio-pci devices will use in later patches to automatically select the optimal number of queues. The function handles guests with large numbers of CPUs by limiting the number of queues to fit within the following constraints: 1. The maximum number of MSI-X vectors. 2. The maximum number of virtqueues. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck --- hw/virtio/virtio-pci.h | 9 +++++++++ hw/virtio/virtio-pci.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/hw/virtio/virtio-pci.h b/hw/virtio/virtio-pci.h index e2eaaa9182..91096f0291 100644 --- a/hw/virtio/virtio-pci.h +++ b/hw/virtio/virtio-pci.h @@ -243,4 +243,13 @@ typedef struct VirtioPCIDeviceTypeInfo { /* Register virtio-pci type(s). @t must be static. */ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t); =20 +/** + * virtio_pci_optimal_num_queues: + * @fixed_queues: number of queues that are always present + * + * Returns: The optimal number of queues for a multi-queue device, excludi= ng + * @fixed_queues. + */ +unsigned virtio_pci_optimal_num_queues(unsigned fixed_queues); + #endif diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index ccdf54e81c..fc69570dcc 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -19,6 +19,7 @@ =20 #include "exec/memop.h" #include "standard-headers/linux/virtio_pci.h" +#include "hw/boards.h" #include "hw/virtio/virtio.h" #include "migration/qemu-file-types.h" #include "hw/pci/pci.h" @@ -2058,6 +2059,37 @@ void virtio_pci_types_register(const VirtioPCIDevice= TypeInfo *t) g_free(base_name); } =20 +unsigned virtio_pci_optimal_num_queues(unsigned fixed_queues) +{ + /* + * 1:1 vq to vCPU mapping is ideal because the same vCPU that submitted + * virtqueue buffers can handle their completion. When a different vCPU + * handles completion it may need to IPI the vCPU that submitted the + * request and this adds overhead. + * + * Virtqueues consume guest RAM and MSI-X vectors. This is wasteful in + * guests with very many vCPUs and a device that is only used by a few + * vCPUs. Unfortunately optimizing that case requires manual pinning i= nside + * the guest, so those users might as well manually set the number of + * queues. There is no upper limit that can be applied automatically a= nd + * doing so arbitrarily would result in a sudden performance drop once= the + * threshold number of vCPUs is exceeded. + */ + unsigned num_queues =3D current_machine->smp.cpus; + + /* + * The maximum number of MSI-X vectors is PCI_MSIX_FLAGS_QSIZE + 1, bu= t the + * config change interrupt and the fixed virtqueues must be taken into + * account too. + */ + num_queues =3D MIN(num_queues, PCI_MSIX_FLAGS_QSIZE - fixed_queues); + + /* + * There is a limit to how many virtqueues a device can have. + */ + return MIN(num_queues, VIRTIO_QUEUE_MAX - fixed_queues); +} + /* virtio-pci-bus */ =20 static void virtio_pci_bus_new(VirtioBusState *bus, size_t bus_size, --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597765246; cv=none; d=zohomail.com; s=zohoarc; b=k8EjNT14AqFtk9G+toQrN8PaEFmZraGQYFFJmnApWVdpgTNfIRxy/SpM0DGq80Ey1P76dfaxxel6PeisrwNjfIAfdmf0t1WqPMOq6CVTBYUuIWBGeiJYZcPMaWAhHPrH2Cak9M7cuth1ix+2YSUd2J8OjllZIcOBBHYfXm8wQhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597765246; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uVeNRqM224/wT/cjolJi+5I426fp5SQFqRKucSZEUf4=; b=k2rUoRPkI9gg4mZuLHWiM3QpY3tzs/wxeckYCgSGXJZr+d6v/j7cleyYpsNn95hMcFUPdU5U9zIDQNHcT4n7Ru9fnpIknAZGwpWgKYd6rv0xQ4apmFibsYWyfM9SQlro+7mNze6M+tv3kCnnwkcx5tMiJjT7NMj3bjJe8g7sFYg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597765246704564.5308777630594; Tue, 18 Aug 2020 08:40:46 -0700 (PDT) Received: from localhost ([::1]:38144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83ZQ-00083v-RM for importer@patchew.org; Tue, 18 Aug 2020 11:30:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82h3-0004ul-IW for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:29 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:29844 helo=us-smtp-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 1k82h0-0002U7-QB for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:29 -0400 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-375-hmPlAJAIN0a_2xrCdgmijw-1; Tue, 18 Aug 2020 10:34:22 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7B121084C9D; Tue, 18 Aug 2020 14:34:10 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40CCE10013C2; Tue, 18 Aug 2020 14:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761265; 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=uVeNRqM224/wT/cjolJi+5I426fp5SQFqRKucSZEUf4=; b=RaHabO0YAAlvDrmxbA5gTf9thml4cCflDrDri7/lXP+W8W2e7OlweZi8mb3d99GOt6IU56 SDcE2f7LhULIqitHeeTUUmcgz1e3VFE3BlChNgQN9AlSAQH10ar6PcIP0sv2gf3xQ9LkW0 ZpdLRhLs3c2AAAzDv58eUy3srXwR2Cg= X-MC-Unique: hmPlAJAIN0a_2xrCdgmijw-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 4/7] virtio-scsi: introduce a constant for fixed virtqueues Date: Tue, 18 Aug 2020 15:33:45 +0100 Message-Id: <20200818143348.310613-5-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.003 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=stefanha@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 06:40:33 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The event and control virtqueues are always present, regardless of the multi-queue configuration. Define a constant so that virtqueue number calculations are easier to read. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Reviewed-by: Pankaj Gupta Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Raphael Norwitz --- include/hw/virtio/virtio-scsi.h | 3 +++ hw/scsi/vhost-user-scsi.c | 2 +- hw/scsi/virtio-scsi.c | 7 ++++--- hw/virtio/vhost-scsi-pci.c | 3 ++- hw/virtio/vhost-user-scsi-pci.c | 3 ++- hw/virtio/virtio-scsi-pci.c | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 24e768909d..9f293bcb80 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -36,6 +36,9 @@ #define VIRTIO_SCSI_MAX_TARGET 255 #define VIRTIO_SCSI_MAX_LUN 16383 =20 +/* Number of virtqueues that are always present */ +#define VIRTIO_SCSI_VQ_NUM_FIXED 2 + typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq; typedef struct virtio_scsi_cmd_resp VirtIOSCSICmdResp; typedef struct virtio_scsi_ctrl_tmf_req VirtIOSCSICtrlTMFReq; diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index f2e524438a..a8b821466f 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -114,7 +114,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, E= rror **errp) goto free_virtio; } =20 - vsc->dev.nvqs =3D 2 + vs->conf.num_queues; + vsc->dev.nvqs =3D VIRTIO_SCSI_VQ_NUM_FIXED + vs->conf.num_queues; vsc->dev.vqs =3D g_new0(struct vhost_virtqueue, vsc->dev.nvqs); vsc->dev.vq_index =3D 0; vsc->dev.backend_features =3D 0; diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index b49775269e..eecdd05af5 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -191,7 +191,7 @@ static void virtio_scsi_save_request(QEMUFile *f, SCSIR= equest *sreq) VirtIOSCSIReq *req =3D sreq->hba_private; VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(req->dev); VirtIODevice *vdev =3D VIRTIO_DEVICE(req->dev); - uint32_t n =3D virtio_get_queue_index(req->vq) - 2; + uint32_t n =3D virtio_get_queue_index(req->vq) - VIRTIO_SCSI_VQ_NUM_FI= XED; =20 assert(n < vs->conf.num_queues); qemu_put_be32s(f, &n); @@ -892,10 +892,11 @@ void virtio_scsi_common_realize(DeviceState *dev, sizeof(VirtIOSCSIConfig)); =20 if (s->conf.num_queues =3D=3D 0 || - s->conf.num_queues > VIRTIO_QUEUE_MAX - 2) { + s->conf.num_queues > VIRTIO_QUEUE_MAX - VIRTIO_SCSI_VQ_NUM_FIX= ED) { error_setg(errp, "Invalid number of queues (=3D %" PRIu32 "), " "must be a positive integer less than %d.", - s->conf.num_queues, VIRTIO_QUEUE_MAX - 2); + s->conf.num_queues, + VIRTIO_QUEUE_MAX - VIRTIO_SCSI_VQ_NUM_FIXED); virtio_cleanup(vdev); return; } diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c index 095af23f3f..06e814d30e 100644 --- a/hw/virtio/vhost-scsi-pci.c +++ b/hw/virtio/vhost-scsi-pci.c @@ -50,7 +50,8 @@ static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci_d= ev, Error **errp) VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; + vpci_dev->nvectors =3D vs->conf.num_queues + + VIRTIO_SCSI_VQ_NUM_FIXED + 1; } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pc= i.c index 4705cd54e8..ab6dfb71a9 100644 --- a/hw/virtio/vhost-user-scsi-pci.c +++ b/hw/virtio/vhost-user-scsi-pci.c @@ -56,7 +56,8 @@ static void vhost_user_scsi_pci_realize(VirtIOPCIProxy *v= pci_dev, Error **errp) VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; + vpci_dev->nvectors =3D vs->conf.num_queues + + VIRTIO_SCSI_VQ_NUM_FIXED + 1; } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c index c23a134202..3ff9eb7ef6 100644 --- a/hw/virtio/virtio-scsi-pci.c +++ b/hw/virtio/virtio-scsi-pci.c @@ -51,7 +51,8 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_= dev, Error **errp) char *bus_name; =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + 3; + vpci_dev->nvectors =3D vs->conf.num_queues + + VIRTIO_SCSI_VQ_NUM_FIXED + 1; } =20 /* --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597767325; cv=none; d=zohomail.com; s=zohoarc; b=jQStYv4COy7KWHetBNYB4WMD5HhoOG4AByTMXugmBMzPsA1BeL4EiYaqsAdV3X8K12w0qHS8PvcmjRqFQ7SGHqJFGbVROAzxEygcnuRYs/7etTj8kZOXgMVQOvkTfT2ukAtKrCb7FGAlS6x2EVBoA40S+PE8QI6QmUq/7i8PbC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597767325; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Wb1XamP5TGEehgB5L5m/KNklppAMpaQAEaCLfGMImwk=; b=PTsrgLOFal0KcNgdrY1e5T2RZmpqgqa0q2UYK39TE3SVFAK/OdX1Kg/q7QL5SOJwpzXUt/D4c3tdoM34J378MNE9VHjiA7cTKOvzveqmeDiP5Fbfq0TPkfrczvr9hT8ijc8Iy40joORTeYA4F9r/S8xiFG3zxyL4xjY5/MqrflI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597767325968778.4293438788424; Tue, 18 Aug 2020 09:15:25 -0700 (PDT) Received: from localhost ([::1]:45850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83bm-0002yC-Qo for importer@patchew.org; Tue, 18 Aug 2020 11:33:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82h8-000592-Cy for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:34 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:38472 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 1k82h4-0002VV-GG for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:33 -0400 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-457-KdqfaL5LNdiWN4ne7qESyQ-1; Tue, 18 Aug 2020 10:34:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA4658B5E64; Tue, 18 Aug 2020 14:34:12 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CC915D9DC; Tue, 18 Aug 2020 14:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761269; 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=Wb1XamP5TGEehgB5L5m/KNklppAMpaQAEaCLfGMImwk=; b=C75EeahUQhTEnL+tHHEyA5g2dThoaeDeb6dKzyEkCGLab5rwHMTY2wvIE7R7lE2xX7isYr +zgddJxyrjNPsJB40rv3F1+PLLwprIZtVjVnzYFCTMjU46nGkMVMVwUcW2+iOCn7n1sPUH C3CrzCBCjaGDl2TByiKi+RUebyomFik= X-MC-Unique: KdqfaL5LNdiWN4ne7qESyQ-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 5/7] virtio-scsi-pci: default num_queues to -smp N Date: Tue, 18 Aug 2020 15:33:46 +0100 Message-Id: <20200818143348.310613-6-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 08:01:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Automatically size the number of virtio-scsi-pci, vhost-scsi-pci, and vhost-user-scsi-pci request virtqueues to match the number of vCPUs. Other transports continue to default to 1 request virtqueue. A 1:1 virtqueue:vCPU mapping ensures that completion interrupts are handled on the same vCPU that submitted the request. No IPI is necessary to complete an I/O request and performance is improved. The maximum number of MSI-X vectors and virtqueues limit are respected. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Reviewed-by: Raphael Norwitz --- include/hw/virtio/virtio-scsi.h | 2 ++ hw/core/machine.c | 3 +++ hw/scsi/vhost-scsi.c | 3 ++- hw/scsi/vhost-user-scsi.c | 3 ++- hw/scsi/virtio-scsi.c | 6 +++++- hw/virtio/vhost-scsi-pci.c | 10 +++++++--- hw/virtio/vhost-user-scsi-pci.c | 10 +++++++--- hw/virtio/virtio-scsi-pci.c | 10 +++++++--- 8 files changed, 35 insertions(+), 12 deletions(-) diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scs= i.h index 9f293bcb80..c0b8e4dd7e 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -39,6 +39,8 @@ /* Number of virtqueues that are always present */ #define VIRTIO_SCSI_VQ_NUM_FIXED 2 =20 +#define VIRTIO_SCSI_AUTO_NUM_QUEUES UINT32_MAX + typedef struct virtio_scsi_cmd_req VirtIOSCSICmdReq; typedef struct virtio_scsi_cmd_resp VirtIOSCSICmdResp; typedef struct virtio_scsi_ctrl_tmf_req VirtIOSCSICtrlTMFReq; diff --git a/hw/core/machine.c b/hw/core/machine.c index a6f7e4e8d7..9ee2aa0f7b 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -29,6 +29,9 @@ #include "migration/vmstate.h" =20 GlobalProperty hw_compat_5_1[] =3D { + { "vhost-scsi", "num_queues", "1"}, + { "vhost-user-scsi", "num_queues", "1"}, + { "virtio-scsi-device", "num_queues", "1"}, }; const size_t hw_compat_5_1_len =3D G_N_ELEMENTS(hw_compat_5_1); =20 diff --git a/hw/scsi/vhost-scsi.c b/hw/scsi/vhost-scsi.c index 13b05af29b..a83ffeefc8 100644 --- a/hw/scsi/vhost-scsi.c +++ b/hw/scsi/vhost-scsi.c @@ -270,7 +270,8 @@ static Property vhost_scsi_properties[] =3D { DEFINE_PROP_STRING("vhostfd", VirtIOSCSICommon, conf.vhostfd), DEFINE_PROP_STRING("wwpn", VirtIOSCSICommon, conf.wwpn), DEFINE_PROP_UINT32("boot_tpgt", VirtIOSCSICommon, conf.boot_tpgt, 0), - DEFINE_PROP_UINT32("num_queues", VirtIOSCSICommon, conf.num_queues, 1), + DEFINE_PROP_UINT32("num_queues", VirtIOSCSICommon, conf.num_queues, + VIRTIO_SCSI_AUTO_NUM_QUEUES), DEFINE_PROP_UINT32("virtqueue_size", VirtIOSCSICommon, conf.virtqueue_= size, 128), DEFINE_PROP_BOOL("seg_max_adjust", VirtIOSCSICommon, conf.seg_max_adju= st, diff --git a/hw/scsi/vhost-user-scsi.c b/hw/scsi/vhost-user-scsi.c index a8b821466f..7c0631656c 100644 --- a/hw/scsi/vhost-user-scsi.c +++ b/hw/scsi/vhost-user-scsi.c @@ -162,7 +162,8 @@ static void vhost_user_scsi_unrealize(DeviceState *dev) static Property vhost_user_scsi_properties[] =3D { DEFINE_PROP_CHR("chardev", VirtIOSCSICommon, conf.chardev), DEFINE_PROP_UINT32("boot_tpgt", VirtIOSCSICommon, conf.boot_tpgt, 0), - DEFINE_PROP_UINT32("num_queues", VirtIOSCSICommon, conf.num_queues, 1), + DEFINE_PROP_UINT32("num_queues", VirtIOSCSICommon, conf.num_queues, + VIRTIO_SCSI_AUTO_NUM_QUEUES), DEFINE_PROP_UINT32("virtqueue_size", VirtIOSCSICommon, conf.virtqueue_= size, 128), DEFINE_PROP_UINT32("max_sectors", VirtIOSCSICommon, conf.max_sectors, diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index eecdd05af5..3a71ea7097 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -891,6 +891,9 @@ void virtio_scsi_common_realize(DeviceState *dev, virtio_init(vdev, "virtio-scsi", VIRTIO_ID_SCSI, sizeof(VirtIOSCSIConfig)); =20 + if (s->conf.num_queues =3D=3D VIRTIO_SCSI_AUTO_NUM_QUEUES) { + s->conf.num_queues =3D 1; + } if (s->conf.num_queues =3D=3D 0 || s->conf.num_queues > VIRTIO_QUEUE_MAX - VIRTIO_SCSI_VQ_NUM_FIX= ED) { error_setg(errp, "Invalid number of queues (=3D %" PRIu32 "), " @@ -964,7 +967,8 @@ static void virtio_scsi_device_unrealize(DeviceState *d= ev) } =20 static Property virtio_scsi_properties[] =3D { - DEFINE_PROP_UINT32("num_queues", VirtIOSCSI, parent_obj.conf.num_queue= s, 1), + DEFINE_PROP_UINT32("num_queues", VirtIOSCSI, parent_obj.conf.num_queue= s, + VIRTIO_SCSI_AUTO_NUM_QUEUES), DEFINE_PROP_UINT32("virtqueue_size", VirtIOSCSI, parent_obj.conf.virtqueue_size, 2= 56), DEFINE_PROP_BOOL("seg_max_adjust", VirtIOSCSI, diff --git a/hw/virtio/vhost-scsi-pci.c b/hw/virtio/vhost-scsi-pci.c index 06e814d30e..a6bb0dc60d 100644 --- a/hw/virtio/vhost-scsi-pci.c +++ b/hw/virtio/vhost-scsi-pci.c @@ -47,11 +47,15 @@ static void vhost_scsi_pci_realize(VirtIOPCIProxy *vpci= _dev, Error **errp) { VHostSCSIPCI *dev =3D VHOST_SCSI_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); + VirtIOSCSIConf *conf =3D &dev->vdev.parent_obj.parent_obj.conf; + + if (conf->num_queues =3D=3D VIRTIO_SCSI_AUTO_NUM_QUEUES) { + conf->num_queues =3D + virtio_pci_optimal_num_queues(VIRTIO_SCSI_VQ_NUM_FIXED); + } =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + - VIRTIO_SCSI_VQ_NUM_FIXED + 1; + vpci_dev->nvectors =3D conf->num_queues + VIRTIO_SCSI_VQ_NUM_FIXED= + 1; } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); diff --git a/hw/virtio/vhost-user-scsi-pci.c b/hw/virtio/vhost-user-scsi-pc= i.c index ab6dfb71a9..25e97ca54e 100644 --- a/hw/virtio/vhost-user-scsi-pci.c +++ b/hw/virtio/vhost-user-scsi-pci.c @@ -53,11 +53,15 @@ static void vhost_user_scsi_pci_realize(VirtIOPCIProxy = *vpci_dev, Error **errp) { VHostUserSCSIPCI *dev =3D VHOST_USER_SCSI_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); + VirtIOSCSIConf *conf =3D &dev->vdev.parent_obj.parent_obj.conf; + + if (conf->num_queues =3D=3D VIRTIO_SCSI_AUTO_NUM_QUEUES) { + conf->num_queues =3D + virtio_pci_optimal_num_queues(VIRTIO_SCSI_VQ_NUM_FIXED); + } =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + - VIRTIO_SCSI_VQ_NUM_FIXED + 1; + vpci_dev->nvectors =3D conf->num_queues + VIRTIO_SCSI_VQ_NUM_FIXED= + 1; } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c index 3ff9eb7ef6..fa4b3bfb50 100644 --- a/hw/virtio/virtio-scsi-pci.c +++ b/hw/virtio/virtio-scsi-pci.c @@ -46,13 +46,17 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpc= i_dev, Error **errp) { VirtIOSCSIPCI *dev =3D VIRTIO_SCSI_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); - VirtIOSCSICommon *vs =3D VIRTIO_SCSI_COMMON(vdev); DeviceState *proxy =3D DEVICE(vpci_dev); + VirtIOSCSIConf *conf =3D &dev->vdev.parent_obj.conf; char *bus_name; =20 + if (conf->num_queues =3D=3D VIRTIO_SCSI_AUTO_NUM_QUEUES) { + conf->num_queues =3D + virtio_pci_optimal_num_queues(VIRTIO_SCSI_VQ_NUM_FIXED); + } + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D vs->conf.num_queues + - VIRTIO_SCSI_VQ_NUM_FIXED + 1; + vpci_dev->nvectors =3D conf->num_queues + VIRTIO_SCSI_VQ_NUM_FIXED= + 1; } =20 /* --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597767715; cv=none; d=zohomail.com; s=zohoarc; b=IRjNqEIcbiaLqoDSLapJH2GPK66KQlxPYEu+Wm8cWhDyJFkE5dzSr1UmjCZ50ut1CrPyIB8aAWKxSBhVqG+pwglzaeX6AEgVwWtkhB+W8V6Z3Mt93i+oVc48mxRfLid1cyKKjuZx3dQAbeZuYirhksa2f8kxJNltoPbRJMZscQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597767715; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9gvVRr63NaVLTha3tZ0afugXNCMQNgh+pilq0gGN5Mc=; b=MWyPawitOQAB9NZLX+YkODtlGoj7VXNZvQpv5z2xYzGyitfsoYYUgELmnRYT+Km8a3E0IxUoVtRxzuohYbtr1JlaQBLyYJXW7orjVNC3FOUII4BrOUMkPZ8yBUY+AfWrVu3CICJPcR06349sxfJ4HIhDlwvfu4OwDALZ4ddoH+U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597767715057683.2289036655346; Tue, 18 Aug 2020 09:21:55 -0700 (PDT) Received: from localhost ([::1]:52340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83QA-0007Ge-7D for importer@patchew.org; Tue, 18 Aug 2020 11:21:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39550) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82h6-00052s-D5 for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:32 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:47945 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 1k82h2-0002Ui-8r for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:31 -0400 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-347-Dqkbuv7nP3OrUqcFGbZVSA-1; Tue, 18 Aug 2020 10:34:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C42C31015113; Tue, 18 Aug 2020 14:34:14 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F3CE10013C2; Tue, 18 Aug 2020 14:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761267; 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=9gvVRr63NaVLTha3tZ0afugXNCMQNgh+pilq0gGN5Mc=; b=LFA2K+qi4VHxQCRRpQTD9Nz1gt+ZCMSfhhcTzIji2JqDJZ3C0ygMhg3/ODXjeUaWATcnt2 o7w9a6VwVmnn1OuqF98relXbEtlL4fidgD5c0hSDE6aDfufA6U2Uf01Q8sE6huMJfO32jr TEaGhuuE3hErxsueBaYz7L1VrVoDRaE= X-MC-Unique: Dqkbuv7nP3OrUqcFGbZVSA-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 6/7] virtio-blk-pci: default num_queues to -smp N Date: Tue, 18 Aug 2020 15:33:47 +0100 Message-Id: <20200818143348.310613-7-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 08:01:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Automatically size the number of virtio-blk-pci request virtqueues to match the number of vCPUs. Other transports continue to default to 1 request virtqueue. A 1:1 virtqueue:vCPU mapping ensures that completion interrupts are handled on the same vCPU that submitted the request. No IPI is necessary to complete an I/O request and performance is improved. The maximum number of MSI-X vectors and virtqueues limit are respected. Performance improves from 78k to 104k IOPS on a 32 vCPU guest with 101 virtio-blk-pci devices (ioengine=3Dlibaio, iodepth=3D1, bs=3D4k, rw=3Drandr= ead with NVMe storage). Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Reviewed-by: Pankaj Gupta --- include/hw/virtio/virtio-blk.h | 2 ++ hw/block/virtio-blk.c | 6 +++++- hw/core/machine.c | 1 + hw/virtio/virtio-blk-pci.c | 7 ++++++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index b1334c3904..7539c2b848 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -30,6 +30,8 @@ struct virtio_blk_inhdr unsigned char status; }; =20 +#define VIRTIO_BLK_AUTO_NUM_QUEUES UINT16_MAX + struct VirtIOBlkConf { BlockConf conf; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 413783693c..2204ba149e 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -1147,6 +1147,9 @@ static void virtio_blk_device_realize(DeviceState *de= v, Error **errp) error_setg(errp, "Device needs media, but drive is empty"); return; } + if (conf->num_queues =3D=3D VIRTIO_BLK_AUTO_NUM_QUEUES) { + conf->num_queues =3D 1; + } if (!conf->num_queues) { error_setg(errp, "num-queues property must be larger than 0"); return; @@ -1281,7 +1284,8 @@ static Property virtio_blk_properties[] =3D { #endif DEFINE_PROP_BIT("request-merging", VirtIOBlock, conf.request_merging, = 0, true), - DEFINE_PROP_UINT16("num-queues", VirtIOBlock, conf.num_queues, 1), + DEFINE_PROP_UINT16("num-queues", VirtIOBlock, conf.num_queues, + VIRTIO_BLK_AUTO_NUM_QUEUES), DEFINE_PROP_UINT16("queue-size", VirtIOBlock, conf.queue_size, 256), DEFINE_PROP_BOOL("seg-max-adjust", VirtIOBlock, conf.seg_max_adjust, t= rue), DEFINE_PROP_LINK("iothread", VirtIOBlock, conf.iothread, TYPE_IOTHREAD, diff --git a/hw/core/machine.c b/hw/core/machine.c index 9ee2aa0f7b..7f65fa8743 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -31,6 +31,7 @@ GlobalProperty hw_compat_5_1[] =3D { { "vhost-scsi", "num_queues", "1"}, { "vhost-user-scsi", "num_queues", "1"}, + { "virtio-blk-device", "num-queues", "1"}, { "virtio-scsi-device", "num_queues", "1"}, }; const size_t hw_compat_5_1_len =3D G_N_ELEMENTS(hw_compat_5_1); diff --git a/hw/virtio/virtio-blk-pci.c b/hw/virtio/virtio-blk-pci.c index 849cc7dfd8..37c6e0aeb4 100644 --- a/hw/virtio/virtio-blk-pci.c +++ b/hw/virtio/virtio-blk-pci.c @@ -50,9 +50,14 @@ static void virtio_blk_pci_realize(VirtIOPCIProxy *vpci_= dev, Error **errp) { VirtIOBlkPCI *dev =3D VIRTIO_BLK_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); + VirtIOBlkConf *conf =3D &dev->vdev.conf; + + if (conf->num_queues =3D=3D VIRTIO_BLK_AUTO_NUM_QUEUES) { + conf->num_queues =3D virtio_pci_optimal_num_queues(0); + } =20 if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { - vpci_dev->nvectors =3D dev->vdev.conf.num_queues + 1; + vpci_dev->nvectors =3D conf->num_queues + 1; } =20 qdev_realize(vdev, BUS(&vpci_dev->bus), errp); --=20 2.26.2 From nobody Fri May 10 01:27:06 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597767829; cv=none; d=zohomail.com; s=zohoarc; b=cGiZAGN0zsw1Tht04SnCK55LiMRHdl6LyefMMeQDgto+aRb9RisDtHBSYuiL1ELO3bYe2NNn8hT5xgClZPIHZEtMFolvXHm4WzS0phjFNunxN73V6KvHWZ3vgy+fXT4OiRKZBXuNWGm+qebMKokrcatKo1iPzgQ1DdyVm0kYeHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597767829; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dg4wwNlM3UA8oFWJ+eNd0CyqfAcH8r5+f9d3B+KbHLw=; b=l1QSwxM47Ns1y5YDeIytMmVCnGp454lMu6bStStqCFzvnoFzEPqZvoMq24KVu0Ea7ZXwK0fTnXbg+TBQJkQ+eg7HK/kfyz3LtTpXdMgBsoaSpiFFTVlOydBuaMV3EUah/ZWuT33qxH8c0nAnu96+xkl7GOfygiUU+AmDqUb1Pwk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597767829021816.9276779149033; Tue, 18 Aug 2020 09:23:49 -0700 (PDT) Received: from localhost ([::1]:52854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k83dO-0005w0-T8 for importer@patchew.org; Tue, 18 Aug 2020 11:34:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k82hB-0005Ih-Qh for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:37 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:44975 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 1k82h9-0002WS-TJ for qemu-devel@nongnu.org; Tue, 18 Aug 2020 10:34:37 -0400 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-143-Tvo8x58pOMWIWCKJsuH7Ng-1; Tue, 18 Aug 2020 10:34:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D04C08DFFEB; Tue, 18 Aug 2020 14:34:16 +0000 (UTC) Received: from localhost (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B6445C70A; Tue, 18 Aug 2020 14:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597761275; 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=dg4wwNlM3UA8oFWJ+eNd0CyqfAcH8r5+f9d3B+KbHLw=; b=V1oi0wI1jarZKzLAuP09C7xY6XhK/aohpc73CbmfQsQvUwyPZeOxLs6uAI3Np7MblIHXkq JRkZMWrD9pVURkT+8AM+RE2Hu5FLQwVjmdyJfOkGiIryG8YHvfRzqgiCaxpE7zJrtDSv7l y1o72hS18ZVwYjqR28xzv5QkQspp6fE= X-MC-Unique: Tvo8x58pOMWIWCKJsuH7Ng-1 From: Stefan Hajnoczi To: qemu-devel@nongnu.org Subject: [PATCH v6 7/7] vhost-user-blk-pci: default num_queues to -smp N Date: Tue, 18 Aug 2020 15:33:48 +0100 Message-Id: <20200818143348.310613-8-stefanha@redhat.com> In-Reply-To: <20200818143348.310613-1-stefanha@redhat.com> References: <20200818143348.310613-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=stefanha@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 08:01:06 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no 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: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Max Reitz , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , Richard Henderson , Thomas Huth , Eduardo Habkost , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Stefan Hajnoczi , David Gibson , Kevin Wolf , Pankaj Gupta , cohuck@redhat.com, Raphael Norwitz , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Automatically size the number of request virtqueues to match the number of vCPUs. This ensures that completion interrupts are handled on the same vCPU that submitted the request. No IPI is necessary to complete an I/O request and performance is improved. The maximum number of MSI-X vectors and virtqueues limit are respected. Signed-off-by: Stefan Hajnoczi Reviewed-by: Cornelia Huck Reviewed-by: Raphael Norwitz --- include/hw/virtio/vhost-user-blk.h | 2 ++ hw/block/vhost-user-blk.c | 6 +++++- hw/core/machine.c | 1 + hw/virtio/vhost-user-blk-pci.c | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-u= ser-blk.h index 34ad6f0c0e..292d17147c 100644 --- a/include/hw/virtio/vhost-user-blk.h +++ b/include/hw/virtio/vhost-user-blk.h @@ -25,6 +25,8 @@ #define VHOST_USER_BLK(obj) \ OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK) =20 +#define VHOST_USER_BLK_AUTO_NUM_QUEUES UINT16_MAX + typedef struct VHostUserBlk { VirtIODevice parent_obj; CharBackend chardev; diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index a00b854736..39aec42dae 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -420,6 +420,9 @@ static void vhost_user_blk_device_realize(DeviceState *= dev, Error **errp) return; } =20 + if (s->num_queues =3D=3D VHOST_USER_BLK_AUTO_NUM_QUEUES) { + s->num_queues =3D 1; + } if (!s->num_queues || s->num_queues > VIRTIO_QUEUE_MAX) { error_setg(errp, "vhost-user-blk: invalid number of IO queues"); return; @@ -531,7 +534,8 @@ static const VMStateDescription vmstate_vhost_user_blk = =3D { =20 static Property vhost_user_blk_properties[] =3D { DEFINE_PROP_CHR("chardev", VHostUserBlk, chardev), - DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, 1), + DEFINE_PROP_UINT16("num-queues", VHostUserBlk, num_queues, + VHOST_USER_BLK_AUTO_NUM_QUEUES), DEFINE_PROP_UINT32("queue-size", VHostUserBlk, queue_size, 128), DEFINE_PROP_BIT("config-wce", VHostUserBlk, config_wce, 0, true), DEFINE_PROP_END_OF_LIST(), diff --git a/hw/core/machine.c b/hw/core/machine.c index 7f65fa8743..ea26d61237 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -30,6 +30,7 @@ =20 GlobalProperty hw_compat_5_1[] =3D { { "vhost-scsi", "num_queues", "1"}, + { "vhost-user-blk", "num-queues", "1"}, { "vhost-user-scsi", "num_queues", "1"}, { "virtio-blk-device", "num-queues", "1"}, { "virtio-scsi-device", "num_queues", "1"}, diff --git a/hw/virtio/vhost-user-blk-pci.c b/hw/virtio/vhost-user-blk-pci.c index 4f5d5cbf44..a62a71e067 100644 --- a/hw/virtio/vhost-user-blk-pci.c +++ b/hw/virtio/vhost-user-blk-pci.c @@ -54,6 +54,10 @@ static void vhost_user_blk_pci_realize(VirtIOPCIProxy *v= pci_dev, Error **errp) VHostUserBlkPCI *dev =3D VHOST_USER_BLK_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&dev->vdev); =20 + if (dev->vdev.num_queues =3D=3D VHOST_USER_BLK_AUTO_NUM_QUEUES) { + dev->vdev.num_queues =3D virtio_pci_optimal_num_queues(0); + } + if (vpci_dev->nvectors =3D=3D DEV_NVECTORS_UNSPECIFIED) { vpci_dev->nvectors =3D dev->vdev.num_queues + 1; } --=20 2.26.2