Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1582131ybt; Thu, 9 Jul 2020 10:16:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH0KlD4D8lp5MXmlOvBDrqoHdC8J7wlrpRfE71P3GycBVySvbRECJteXWgNU5zCJdR6K6k X-Received: by 2002:a17:906:71d4:: with SMTP id i20mr60878493ejk.533.1594314964032; Thu, 09 Jul 2020 10:16:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594314964; cv=none; d=google.com; s=arc-20160816; b=cf6L3Fovn0mb/LqwA3bdukDkoIzdz52gw0OKAARpZHlEGFjJgXA1NP9r1Ei6C+hxmh 24MKNG+ldeGRS1KiqQ17pvFn1uacFFwq4jF5RNH9BP1n/pGpBIEqPuYdTb8uFRra4vC2 sCTVTRImvbhYum2zhpdV5AJvxDopoOrdN/av/85IKhKokIIrMJvh5bjbWJTDIEKCjUPp FmojdVYzR5a/C3F1ympdY0MQN4/EhZB/9mgugEwS8w+KcetUAkLnU995LjkfdqeYl+IF i1PAmlN+b5v1agvGv1J4dCrapeNbLL5uUnyIiGD/Ekw1JX0icBoDQKooueHNs8M/qXHu YlRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rxmyluFqhYgjlE8gknBB9LIu9DuavODGBVATYaytN8k=; b=iuK0Mt53d/ptq8VZ8+uCYr75zz3Hxn3AsLT/WYr5y+cGJbaEJi8T/+WObEgqP+8ad+ zOGWEA3to8Lnw9a7W1Xn6ZOA5wAjTbs5aLILO4arYNJx1C+G2K9XBJ29OOpB1tpvtmAu FQa7KKUxRZ4dlyYupt3GoWi+MhjcOG3sY8X981OGTtgC/4wD88jNvYQThm5Qq/In9Krp EGlMGIHmbjCRU+SgNjX8vT3Uuv7q2SF7Ph7f/OqWCPmLTTwC1RhIdMzaEsmwM/Arsmpi N+TuuX67prpngCvnqXmQBwavR44LHDPpMnAEzjBJXOUG9zrCx2kqFK3Jx5s7SiyFOtKp hiDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UojFW3bn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si2477068edq.65.2020.07.09.10.15.41; Thu, 09 Jul 2020 10:16:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UojFW3bn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727947AbgGIRPS (ORCPT + 99 others); Thu, 9 Jul 2020 13:15:18 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:54873 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727003AbgGIRPR (ORCPT ); Thu, 9 Jul 2020 13:15:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594314915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rxmyluFqhYgjlE8gknBB9LIu9DuavODGBVATYaytN8k=; b=UojFW3bnOnJtqYBFkQgwfTVwKXYiIZUpqYm7lnzlIHmzDlvmq3B9YbJEypKn6ZfBEbfSYw hw7QZ+nY5haReJj3xdMWXZM9/eqyDGprna4l3dUNOcwcSHMkBa6X0jzFp4PlbzY8xS2jCb rg8fG6FlxjoqIdeKb0x7H9IKY0K2rwE= 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-157-yE6sFXMCM8qmyFHsuVY5lw-1; Thu, 09 Jul 2020 13:15:14 -0400 X-MC-Unique: yE6sFXMCM8qmyFHsuVY5lw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C3E810059A2; Thu, 9 Jul 2020 17:15:13 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4CF8610F2; Thu, 9 Jul 2020 17:15:08 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: bsd@redhat.com, Makarand Sonare Subject: [PATCH] KVM: nVMX: fixes for preemption timer migration Date: Thu, 9 Jul 2020 13:15:07 -0400 Message-Id: <20200709171507.1819-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration", 2020-06-01) accidentally broke nVMX live migration from older version by changing the userspace ABI. Restore it and, while at it, ensure that vmx->nested.has_preemption_timer_deadline is always initialized according to the KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE flag. Cc: Makarand Sonare Fixes: 850448f35aaf ("KVM: nVMX: Fix VMX preemption timer migration") Signed-off-by: Paolo Bonzini --- arch/x86/include/uapi/asm/kvm.h | 5 +++-- arch/x86/kvm/vmx/nested.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/uapi/asm/kvm.h b/arch/x86/include/uapi/asm/kvm.h index 17c5a038f42d..0780f97c1850 100644 --- a/arch/x86/include/uapi/asm/kvm.h +++ b/arch/x86/include/uapi/asm/kvm.h @@ -408,14 +408,15 @@ struct kvm_vmx_nested_state_data { }; struct kvm_vmx_nested_state_hdr { - __u32 flags; __u64 vmxon_pa; __u64 vmcs12_pa; - __u64 preemption_timer_deadline; struct { __u16 flags; } smm; + + __u32 flags; + __u64 preemption_timer_deadline; }; struct kvm_svm_nested_state_data { diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index b26655104d4a..3fc2411edc92 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6180,7 +6180,8 @@ static int vmx_set_nested_state(struct kvm_vcpu *vcpu, vmx->nested.has_preemption_timer_deadline = true; vmx->nested.preemption_timer_deadline = kvm_state->hdr.vmx.preemption_timer_deadline; - } + } else + vmx->nested.has_preemption_timer_deadline = false; if (nested_vmx_check_controls(vcpu, vmcs12) || nested_vmx_check_host_state(vcpu, vmcs12) || -- 2.26.2