From patchwork Fri Sep 23 04:59:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Herongguang (Stephen)" X-Patchwork-Id: 9347399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 736A3607F2 for ; Fri, 23 Sep 2016 05:00:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 639962A9CF for ; Fri, 23 Sep 2016 05:00:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 564192A9D4; Fri, 23 Sep 2016 05:00:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A01BC2A9CF for ; Fri, 23 Sep 2016 05:00:19 +0000 (UTC) Received: from localhost ([::1]:39948 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnIaw-0001UT-Dq for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Sep 2016 01:00:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnIaf-0001U5-SV for qemu-devel@nongnu.org; Fri, 23 Sep 2016 01:00:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnIab-00047f-4D for qemu-devel@nongnu.org; Fri, 23 Sep 2016 01:00:01 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:21797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnIaa-00046X-FP for qemu-devel@nongnu.org; Fri, 23 Sep 2016 00:59:57 -0400 Received: from 172.24.1.137 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.137]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DNO14878; Fri, 23 Sep 2016 12:59:33 +0800 (CST) Received: from localhost (10.177.19.20) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Fri, 23 Sep 2016 12:59:21 +0800 From: herongguang To: , , , , , Date: Fri, 23 Sep 2016 12:59:11 +0800 Message-ID: <1474606751-17100-1-git-send-email-herongguang.he@huawei.com> X-Mailer: git-send-email 1.8.4.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.19.20] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090204.57E4B6B6.0051, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: a205f38d3c7af2b912c644819d9bd752 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Subject: [Qemu-devel] [PATCH] KVM: x86: handle KVM_SET_VCPU_EVENTS/KVM_VCPUEVENT_VALID_SMM properly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arei.gonglei@huawei.com, weidong.huang@huawei.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: He Rongguang handle KVM_VCPUEVENT_VALID_SMM properly, or kvm-kmod/kernel will crash in migration destination in gfn_to_rmap() since kvm_memslots_for_spte_role is false, whilst (vcpu->arch.hflags & HF_SMM_MASK) is true Signed-off-by: herongguang --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 699f872..7ebcb59 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3028,6 +3028,7 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, else clear_bit(KVM_APIC_INIT, &vcpu->arch.apic->pending_events); } + kvm_mmu_reset_context(vcpu); } kvm_make_request(KVM_REQ_EVENT, vcpu);