Received: by 10.223.185.116 with SMTP id b49csp1248506wrg; Fri, 23 Feb 2018 14:44:51 -0800 (PST) X-Google-Smtp-Source: AH8x224MHPadzLYdfgTL1R6B0VkQfOMU7dZ9W57jtdijgEfRd4qqI3shJBl7nGp6xCSV11x6i2iF X-Received: by 10.98.144.213 with SMTP id q82mr3218714pfk.37.1519425891101; Fri, 23 Feb 2018 14:44:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519425891; cv=none; d=google.com; s=arc-20160816; b=ZvvnawE3l304QUQ68t3aelo3ns3JUZLDhpgd5EcRav0yrgMaL55TWHaCv0H2pWg/Tz ozI8Z/hg529TLBCLb8CiLDJCc4PilvgVS5p9qHvNQ7LtQlpmivpx8/Iawk42O43c/Lvi P5/Ug2ZQ3vo4hkXw/K27w10LL+f+O1mY5GsuxL7r7sl98kfHrKFUQB27LU+qcrcpZnD/ NKna6rrp2+VUQ8PbGSWR1E6KvGfIVwnkxKPwR8kizslxNH/Bab9FmXGEIWDcW3BrSnzd zQIQ8vshqsm/NGrbFc0eORl1DxfqTcpTLLg0t+sqB6/RR6n6vkS8N+uTdGUwFozycCxE FEXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Xm/3iY+0Hex9V3kZtBYH6VHNKSjMWsOJo121DND8OEE=; b=v7R/U6FfA/dHhiMjGO7tTSAP5CzcH3t5iewKsR8dcHPRd/Hb0bAHFwvfj+95aidGaC I7wUQTMtMzZEd1Hk0NnNqRs+VEzTxpWPfaxX8prRXAfZI4FA0l6KKUjUbPvF+oJ6wPKO p/RsYDdY5sfYMe33pxtVhE/BatRZtCexiVmKPEC2kMsl1yawPshHMLTZW4r6JFw0iT9F oNgIuY7r8LekaC38sIaUrc0h8m2UBo7PRpp4tTsicDi736GOdeu07U22DzNTrSX4y9LO UZJzxO5SpXRd/Na6JO/Lw3SW6ZNrEGmqtkHtC3NmYVxtNDnSxfAOH6YsRg3QkCnR/pzT TQYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=B//m/qc6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj2-v6si2447056plb.286.2018.02.23.14.44.37; Fri, 23 Feb 2018 14:44:51 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=B//m/qc6; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbeBWWnO (ORCPT + 99 others); Fri, 23 Feb 2018 17:43:14 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:36183 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbeBWWnI (ORCPT ); Fri, 23 Feb 2018 17:43:08 -0500 Received: by mail-wr0-f194.google.com with SMTP id v111so3376454wrb.3; Fri, 23 Feb 2018 14:43:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=Xm/3iY+0Hex9V3kZtBYH6VHNKSjMWsOJo121DND8OEE=; b=B//m/qc6F9NApIeXEqCNZbZ/iLo6HXQxv6auS5Dng4yFMF1bGlitADi4n3oJprBf3R gQPEleRUfP/dSPR0BYsHmH5WlnGtxQqRlepvJ6mUKUSZnn5FMmWuhMv7iE5fKGAhUxOh G3v8zAxA7cLo4WuY6Yb6hjQ4Rbl73J/H7uRw1kYZ1kbdR3FxtTTv2dqnCqskvplK12El y17fP9FuQmioLg89vBZ7JHwlW8YQ11w/KmvFAOr2Tl39KMnjDERK9fBSE34LaQVot9vj TBqeu87KuhgqPL08fkOtXH++IuyCWBYflRvKswA3ec/GGAcEPBseV2j9O/I7KKr01B+n ULsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Xm/3iY+0Hex9V3kZtBYH6VHNKSjMWsOJo121DND8OEE=; b=HrAZyed5lT0RlasFe/duGgRX0O/Cclk9FBfcHRyzPtl+FIkX/8l2HZuylBebUUsU36 Z38BlbOixWRnclmUvKCYLKbk+xQ43odJMiC2dQfwUBwwOaDyrkLQpN9t4aJTRBUBk6+g aQMD6kVbBGaRw9sXUKQBGSxhccW9tHjE02z5WygKMzHw4S1QQ8edCcZ864ak3sfq4hKG n43H0OUXMaoh/f93cAx/fNcmgXThgIqAekl3k2o1jp19qLx2Hb6lFN59BX94Jn6Rgjq+ 1ruI8W0v3xsKK393svplINFQvCfCUiv/6TqNMjK2KQlG4S0Os5kTZjGsumY/vFvJD34q sZLQ== X-Gm-Message-State: APf1xPCZHb7MjqaFnsrHpMp+TvL+lI6PeuET6WkdEHd5Xw04eG2bKhAv ktB9bPirt6t3gho/T2pZoYE1EB9N X-Received: by 10.223.177.194 with SMTP id r2mr13358wra.89.1519425787097; Fri, 23 Feb 2018 14:43:07 -0800 (PST) Received: from 640k.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id z7sm3985206wrg.1.2018.02.23.14.43.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 14:43:05 -0800 (PST) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: liran.alon@oracle.com Subject: [PATCH] KVM: x86: move LAPIC initialization after VMCS creation Date: Fri, 23 Feb 2018 23:43:02 +0100 Message-Id: <1519425782-44820-1-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: 851c1a18c5412fd321e387cfe60739387cdbf37d Cc: Liran Alon Signed-off-by: Paolo Bonzini --- arch/x86/kvm/lapic.c | 1 - arch/x86/kvm/x86.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 924ac8ce9d50..cc5fe7a50dde 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2165,7 +2165,6 @@ int kvm_create_lapic(struct kvm_vcpu *vcpu) */ 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; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c8a0b545ac20..ca90d9515137 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7975,6 +7975,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) kvm_vcpu_mtrr_init(vcpu); vcpu_load(vcpu); kvm_vcpu_reset(vcpu, false); + kvm_lapic_reset(vcpu, false); kvm_mmu_setup(vcpu); vcpu_put(vcpu); return 0; -- 1.8.3.1