From patchwork Sun Oct 4 19:10:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 314034 Delivered-To: patch@linaro.org Received: by 2002:a92:d603:0:0:0:0:0 with SMTP id w3csp716028ilm; Sun, 4 Oct 2020 12:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZYEi07Cp5XTV05WCyrpV71upeXsr4eVluCILWbh4+JmH4safXlU/89lsdEyK4JqGjTD0B X-Received: by 2002:a50:d591:: with SMTP id v17mr13804182edi.92.1601838677784; Sun, 04 Oct 2020 12:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601838677; cv=none; d=google.com; s=arc-20160816; b=ujnVhQd9qcj0IFBERv2ndAj2JLWPT7pA+Yi6aLFnpIIp+m+SK7Vlv6+xM2kyC9/2zh EFvcivtoNkHVChFyV6k8NZQra4caJ55ptVs3xf0fi2yMPFkleFB5VSEZ8KrBRE5KhPfa joG0ZcsNjC3b0dl7ExcvdTDpuVqUxf+tz+zbP+QgFlEPxW/4OnzIqKE0q5EMmWR4dk7L F+gPXuZ1nXGC+w7GxnSHpZ+ePF0xW+ulF6BPkYzY/HVkwacbVdM5aKD5SgaHvwGjL9lg 8OD0pFv4TzJ9679Ez8J5rdNXBzVuEHD4UNmX0zlwoVKFgqjB78QVA1xi5J4zfnE5q00P BfSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:errors-to:sender:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:cc :mime-version:message-id:date:subject:to:from:delivered-to :dkim-signature; bh=JfiQHaeWOaWkLhB0ajHWJHzikOsLr0bcyYUCo1Vf8vU=; b=Hx6y8pADEBXL+kdj7J9iKz9oIJLOQeSGv6qNKjllnlbt1WMIJ3FkPTNF7MsKxhEE66 4lEsgVP7sukzRjwycfTHzK9Nof/Ry4D9A7vKFlKmKvgbVX3lgRNzdycjFfOqLnzL7RDM gPQidt2m8ByBQCQLwiORwzWXqkGOdpBniqFfmyQyBq5OO3G67HtDNnvpak5zA1phCjhx s+a57+zHjigwVQljh2WTuin6ELiJ3amK3WBhq4khznX6cJFJ6dlfOyx2TTqfiMMdmInG N4gbX5Ql9QSXiPyaCi2o0/e/tsXophbIwKXS8F1IjXlA+dxXvM+QZq+notpP9VpvnXvO rdOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TCQkL1u3; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com. [216.205.24.124]) by mx.google.com with ESMTPS id n10si5446893ejb.405.2020.10.04.12.11.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Oct 2020 12:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TCQkL1u3; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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= 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 X-MC-Unique: c1fZGflYNUOHLi8XiREbng-1 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) Delivered-To: libvir-list@redhat.com 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) 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 >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=1673098 Signed-off-by: Cole Robinson --- 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(-) -- 2.28.0 Reviewed-by: Daniel P. Berrangé 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 opaque shell scripts */ VIR_DOMAIN_TAINT_DISK_PROBING, /* Relying on potentially unsafe disk 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 after migration */ VIR_DOMAIN_TAINT_HOOK, /* Domain (possibly) changed via hook script */ VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */ VIR_DOMAIN_TAINT_CUSTOM_DTB, /* Custom device tree blob was specified */ 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, void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, - qemuDomainLogContextPtr logCtxt) + qemuDomainLogContextPtr logCtxt, + bool incomingMigration) { size_t i; g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); @@ -6144,7 +6145,9 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt); } - if (obj->def->cpu && obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) + if (obj->def->cpu && + obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH && + incomingMigration) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt); for (i = 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, 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, qemuLogOperation(vm, "starting up", cmd, logCtxt); - qemuDomainObjCheckTaint(driver, vm, logCtxt); + qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming != NULL); qemuDomainLogContextMarkPosition(logCtxt);