Received: by 10.223.185.116 with SMTP id b49csp5445246wrg; Wed, 7 Mar 2018 11:53:40 -0800 (PST) X-Google-Smtp-Source: AG47ELs8dgsQJra2vsXvZwu1qKM//i04mdMGtvHIyLDeavWwt9myI2Cgfu9gHNeNDb0Qb3txi7+S X-Received: by 10.99.110.70 with SMTP id j67mr19038357pgc.202.1520452420169; Wed, 07 Mar 2018 11:53:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520452420; cv=none; d=google.com; s=arc-20160816; b=ngZtEHRHuiP4X12vFHgaY8oFUdoXMs8kKoRd1+M7r0tHmUM3a15fMNIRbsSzHmLWY9 U5XvH0tqX53UVN2G7Xa1h/B87xstwrJzcura8GQUX5PgTaPu6Vc9m/Oj+TmdCj70WPae 0Nw9GTtY2vzrWpSKakiyFEMmNSAITNWfK20GnMZJx5GKlttc9C8zr5lVF1ubAzTGDJDW 9eJJtsY8Y7pu3UhYLWnRx7Y1zJpVbaII2862LLypKqJQYgyFYXoj1hmbr8w8rz1JrR/6 OhlCNuM1oUFwIID0+LnEi60dFvswEL6qG+MWqg8Rnd9UhgxFKZlkLQj6QPUSSObNwTZv UPwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=JoK7RHZWr75GOKhsr9Tz/qBeMCy/NsXqjFBlCjMyFQQ=; b=I/8SdsBiHH0aC3OeO+t/Gag3syxOGUV6wJe3xN8c/NeqEweiDgFkideBy5GkTM7GGN Ur4bNzqhZd0/0cwK/1xmFIl4mu3fvHSk5OS1TH3QD3WxF+YxroMAuyPlXNqET2FLFRTl aehHS3o0OqRxoyAjXxq1m4Gn/osRij0mCC7MMr0tJxYtegPjfXa8pDm14I+6HobVoVyv rGotyIKTwyCOnbLDwtSYMddRnjlUaVgbdthf6etrX6DyyTvPTUzFc/Pa6cGutCH0UdsM oc3VCa+AnkCzuBYKVpQZ0RPBcWYZBRZHUMMIu4zvB3PIndKgVj6brymdn+X1DqvXeIyH oh0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l2si11857863pgu.691.2018.03.07.11.53.25; Wed, 07 Mar 2018 11:53:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965860AbeCGTr7 (ORCPT + 99 others); Wed, 7 Mar 2018 14:47:59 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45202 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965564AbeCGTrz (ORCPT ); Wed, 7 Mar 2018 14:47:55 -0500 Received: from localhost (unknown [185.236.200.248]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 91B131116; Wed, 7 Mar 2018 19:47:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liran Alon , Paolo Bonzini Subject: [PATCH 4.14 100/110] KVM: x86: move LAPIC initialization after VMCS creation Date: Wed, 7 Mar 2018 11:39:23 -0800 Message-Id: <20180307191052.654831952@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307191039.748351103@linuxfoundation.org> References: <20180307191039.748351103@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Paolo Bonzini commit 0b2e9904c15963e715d33e5f3f1387f17d19333a upstream. The initial reset of the local APIC is performed before the VMCS has been created, but it tries to do a vmwrite: vmwrite error: reg 810 value 4a00 (err 18944) CPU: 54 PID: 38652 Comm: qemu-kvm Tainted: G W I 4.16.0-0.rc2.git0.1.fc28.x86_64 #1 Hardware name: Intel Corporation S2600CW/S2600CW, BIOS SE5C610.86B.01.01.0003.090520141303 09/05/2014 Call Trace: vmx_set_rvi [kvm_intel] vmx_hwapic_irr_update [kvm_intel] kvm_lapic_reset [kvm] kvm_create_lapic [kvm] kvm_arch_vcpu_init [kvm] kvm_vcpu_init [kvm] vmx_create_vcpu [kvm_intel] kvm_vm_ioctl [kvm] Move it later, after the VMCS has been created. Fixes: 4191db26b714 ("KVM: x86: Update APICv on APIC reset") Cc: stable@vger.kernel.org Cc: Liran Alon Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/lapic.c | 1 - arch/x86/kvm/x86.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2107,7 +2107,6 @@ int kvm_create_lapic(struct kvm_vcpu *vc */ vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ - kvm_lapic_reset(vcpu, false); kvm_iodevice_init(&apic->dev, &apic_mmio_ops); return 0; --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7779,6 +7779,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu if (r) return r; kvm_vcpu_reset(vcpu, false); + kvm_lapic_reset(vcpu, false); kvm_mmu_setup(vcpu); vcpu_put(vcpu); return r;