From nobody Sat May 4 05:12:15 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1601838677; cv=none; d=zohomail.com; s=zohoarc; b=KJHLfDJdIu9QA19WNZu0ZfniQg8mcXIZVjw4zLpf9Bi7HI2TJHmrr2l7/CckqvSyEaxZrXLXlGZC2GSnAQ2/R+QlFQjtTEHOpVwwxTn2xnJ5J9R8gFJW9LMsRteBHbJORUflngBWNnTiav0Op1v1zsHo0B8JtmIul1ESimvGZog= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601838677; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=JfiQHaeWOaWkLhB0ajHWJHzikOsLr0bcyYUCo1Vf8vU=; b=Q65TqqoafuGZF9bBOjlb/PkfGScCilj9YITR6NMvxanOtLs0UVdmszNEXRHszkJlTl5KFYFQH3mzAa+NCU2vWaByf4xUzXW0VU/AdfFbOPoapfUefu87LYTI/PsRZtCPSK+FQ76HwHnXhzewhs4tO6koA50q1xMio4rGZvAqZhw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 16018386778661.8155316141389903; Sun, 4 Oct 2020 12:11:17 -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-353-c1fZGflYNUOHLi8XiREbng-1; Sun, 04 Oct 2020 15:11:14 -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 7C634107465A; Sun, 4 Oct 2020 19:11:08 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76E7F19C78; Sun, 4 Oct 2020 19:11:07 +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 3D99F44A48; Sun, 4 Oct 2020 19:11:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 094JB5vF011922 for ; Sun, 4 Oct 2020 15:11:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 006C51974D; Sun, 4 Oct 2020 19:11:05 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-112-83.rdu2.redhat.com [10.10.112.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DD0419C78; Sun, 4 Oct 2020 19:11:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601838676; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JfiQHaeWOaWkLhB0ajHWJHzikOsLr0bcyYUCo1Vf8vU=; b=TCQkL1u3Ch2J3XTp7hlxh4PlSwhaL+C+YJp3HK0qxxYk9QPbKA+FdLOZwdxQC8W/KPqJde 6D9sn+mLg3FlBAaM9id68XJL7bE3SS5eriYTmFLUTho6h0qy2AEazigakZU7slCX65xcNg nHcpRThV7PU3MfUyIMQFtJ1yd5+M2Ow= X-MC-Unique: c1fZGflYNUOHLi8XiREbng-1 From: Cole Robinson To: libvir-list@redhat.com Subject: [PATCH] qemu: Taint cpu host-passthrough only after migration Date: Sun, 4 Oct 2020 15:10:52 -0400 Message-Id: <5ef467661a99fe73df1008e41ef75bba43705387.1601838652.git.crobinso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Cole Robinson 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" >From a discussion last year[1], Dan recommended libvirt drop the tain flag for cpu host-passthrough, unless the VM has been migrated. This repurposes the existing host-cpu taint flag to do just that. [1]: https://www.redhat.com/archives/virt-tools-list/2019-February/msg00041= .html https://bugzilla.redhat.com/show_bug.cgi?id=3D1673098 Signed-off-by: Cole Robinson Reviewed-by: Daniel P. Berrang=C3=A9 --- src/conf/domain_conf.h | 2 +- src/qemu/qemu_domain.c | 7 +++++-- src/qemu/qemu_domain.h | 3 ++- src/qemu/qemu_process.c | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9a44315519..450686dfb5 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2736,7 +2736,7 @@ typedef enum { VIR_DOMAIN_TAINT_SHELL_SCRIPTS, /* Network configuration using opaq= ue shell scripts */ VIR_DOMAIN_TAINT_DISK_PROBING, /* Relying on potentially unsafe di= sk format probing */ VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH, /* Externally launched guest domain= */ - VIR_DOMAIN_TAINT_HOST_CPU, /* Host CPU passthrough in use */ + VIR_DOMAIN_TAINT_HOST_CPU, /* Host CPU passthrough in use afte= r migration */ VIR_DOMAIN_TAINT_HOOK, /* Domain (possibly) changed via ho= ok script */ VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */ VIR_DOMAIN_TAINT_CUSTOM_DTB, /* Custom device tree blob was spec= ified */ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0331fd55e0..ed4bdbd7fb 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6115,7 +6115,8 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, =20 void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, - qemuDomainLogContextPtr logCtxt) + qemuDomainLogContextPtr logCtxt, + bool incomingMigration) { size_t i; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); @@ -6144,7 +6145,9 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, log= Ctxt); } =20 - if (obj->def->cpu && obj->def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASS= THROUGH) + if (obj->def->cpu && + obj->def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH && + incomingMigration) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt= ); =20 for (i =3D 0; i < obj->def->ndisks; i++) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index ec776ced72..9bf32e16c9 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -567,7 +567,8 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, =20 void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, - qemuDomainLogContextPtr logCtxt); + qemuDomainLogContextPtr logCtxt, + bool incomingMigration); void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, virDomainDiskDefPtr disk, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9122069cc9..57d764014a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6856,7 +6856,7 @@ qemuProcessLaunch(virConnectPtr conn, =20 qemuLogOperation(vm, "starting up", cmd, logCtxt); =20 - qemuDomainObjCheckTaint(driver, vm, logCtxt); + qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming !=3D NULL); =20 qemuDomainLogContextMarkPosition(logCtxt); =20 --=20 2.28.0