From nobody Sat May 4 03:08:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=bytedance.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635318299158185.8114971995426; Wed, 27 Oct 2021 00:04:59 -0700 (PDT) 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-437-djeCOaS0MqifyX44wXkgxQ-1; Wed, 27 Oct 2021 03:04:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E21CD802B52; Wed, 27 Oct 2021 07:04:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 307D619729; Wed, 27 Oct 2021 07:04:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 940551800FDD; Wed, 27 Oct 2021 07:04:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19R74hhQ014456 for ; Wed, 27 Oct 2021 03:04:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D81840D2962; Wed, 27 Oct 2021 07:04:43 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88BFF40D1B9D for ; Wed, 27 Oct 2021 07:04:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 709E7802C15 for ; Wed, 27 Oct 2021 07:04:43 +0000 (UTC) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-LkDgD1ThMKOnzMK9su1qWw-1; Wed, 27 Oct 2021 03:04:41 -0400 Received: by mail-pl1-f172.google.com with SMTP id t11so1321269plq.11 for ; Wed, 27 Oct 2021 00:04:41 -0700 (PDT) Received: from libai.bytedance.net ([61.120.150.71]) by smtp.gmail.com with ESMTPSA id lr18sm3197886pjb.39.2021.10.27.00.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 00:04:39 -0700 (PDT) X-MC-Unique: djeCOaS0MqifyX44wXkgxQ-1 X-MC-Unique: LkDgD1ThMKOnzMK9su1qWw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rfLeSvFJt6y2wrdyxZV1VNOS5zGo5ZHc0dwyMsmabTA=; b=LdCPq0p8r06q50S/SGvPdAvw2Cz8H8RBF/JUAmulms4d2Tj4NtByDX2F4DlHQEkHjj Z9BKOU94gfftLDbJM4w5aRqEKbiDa9fkIuJLUi4DqYETMQCoUe76KMjtaZlBmlQaOrN0 myiHVinPBSDmOx9VOmYNyfpfir0SLNPdUXl++5dCGg/nMLB5ylEQ1yjNUkPAg76dI/qz oMpIn15wuylxm+HiPfsrnkmyRT4uT0ZIF0VhyMiTJYIq+zo5zXVKQnQqZG6S3525ivyZ 29FjHhcrzMJUPs5T536L769pUPGvGfjG+0Z9L+ZyP2G19JV9uFL2elpLcjqn9GYwH/0C ZXLg== X-Gm-Message-State: AOAM533HARhfsfGfEMJcl6i0tir+GYJxg3X80fWya5PY1rTZNZrG5p86 daT1moLT0HjutkqZw0xAJ8jTXA== X-Google-Smtp-Source: ABdhPJy5M+n1kTvMd/mlA617aC2TfmNGpH0VIwoqiFeP8FHA/q/M+KNdWcNZuT8tNkEn+BeILkA2WQ== X-Received: by 2002:a17:90b:4a48:: with SMTP id lb8mr4010555pjb.236.1635318280299; Wed, 27 Oct 2021 00:04:40 -0700 (PDT) From: zhenwei pi To: mprivozn@redhat.com, berrange@redhat.com Subject: [PATCH] qemu: support kvm-pv-ipi off Date: Wed, 27 Oct 2021 15:04:30 +0800 Message-Id: <20211027070430.376672-1-pizhenwei@bytedance.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, zhenwei pi X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1635318301480100001 Content-Type: text/plain; charset="utf-8" QEMU version 3.1 introduced PV_SEND_IPI CPUID feature bit under commit 7f710c32bb8 (target-i386: adds PV_SEND_IPI CPUID feature bit). This patch adds a new KVM feature 'pv-ipi' to disable this feature (enabled by default). Newer CPU platform (Ex, AMD Zen2) supports hardware accelation for IPI in guest, to use this feature to get better performance in some scenarios. Detailed about the discussion: https://lkml.org/lkml/2021/10/20/423 To disable kvm-pv-ipi and have libvirt add "-cpu host,kvm-pv-ipi=3Doff" to the QEMU command line, the following XML code needs to be added to the guest's domain description: Signed-off-by: zhenwei pi Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 2 ++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 3 +++ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 5 +++++ 5 files changed, 16 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 58768f7e5e..8ff833bbd2 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1842,6 +1842,7 @@ Hypervisors may allow certain CPU / machine features = to be toggled on/off. + @@ -1930,6 +1931,7 @@ are: hidden Hide the KVM hypervisor from standard MSR based discover= y on, off :since:`1.2.8 (QEMU 2.1.0)` hint-dedicated Allows a guest to enable optimizations when running on d= edicated vCPUs on, off :since:`5.7.0 (QEMU 2.12.0)` poll-control Decrease IO completion latency by introducing a grace pe= riod of busy waiting on, off :since:`6.10.0 (QEMU 4.2)` + pv-ipi Paravirtualized send IPIs = on, off :since:`7.10.0 (QEMU 3.1)` =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 ``xen`` diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f71e375a33..67df13d90d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -7177,6 +7177,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 48c6ee9865..c8868de577 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -204,6 +204,7 @@ VIR_ENUM_IMPL(virDomainKVM, "hidden", "hint-dedicated", "poll-control", + "pv-ipi", ); =20 VIR_ENUM_IMPL(virDomainXen, @@ -21789,6 +21790,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef = *src, case VIR_DOMAIN_KVM_HIDDEN: case VIR_DOMAIN_KVM_DEDICATED: case VIR_DOMAIN_KVM_POLLCONTROL: + case VIR_DOMAIN_KVM_PVIPI: if (src->kvm_features[i] !=3D dst->kvm_features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of KVM feature '%s' differs: " @@ -27821,6 +27823,7 @@ virDomainDefFormatFeatures(virBuffer *buf, case VIR_DOMAIN_KVM_HIDDEN: case VIR_DOMAIN_KVM_DEDICATED: case VIR_DOMAIN_KVM_POLLCONTROL: + case VIR_DOMAIN_KVM_PVIPI: if (def->kvm_features[j]) virBufferAsprintf(&childBuf, "<%s state=3D'%s'/>\n= ", virDomainKVMTypeToString(j), diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f4be5c84f0..cb6d8975b8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2073,6 +2073,7 @@ typedef enum { VIR_DOMAIN_KVM_HIDDEN =3D 0, VIR_DOMAIN_KVM_DEDICATED, VIR_DOMAIN_KVM_POLLCONTROL, + VIR_DOMAIN_KVM_PVIPI, =20 VIR_DOMAIN_KVM_LAST } virDomainKVM; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 7374b2beca..f7c19246d8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6848,6 +6848,11 @@ qemuBuildCpuCommandLine(virCommand *cmd, virBufferAddLit(&buf, ",kvm-poll-control=3Don"); break; =20 + case VIR_DOMAIN_KVM_PVIPI: + if (def->kvm_features[i] =3D=3D VIR_TRISTATE_SWITCH_OFF) + virBufferAddLit(&buf, ",kvm-pv-ipi=3Doff"); + break; + case VIR_DOMAIN_KVM_LAST: break; } --=20 2.25.1