From patchwork Mon Nov 29 15:38:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 364392 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oATFd9jr013013 for ; Mon, 29 Nov 2010 15:39:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754643Ab0K2Pix (ORCPT ); Mon, 29 Nov 2010 10:38:53 -0500 Received: from tx2ehsobe003.messaging.microsoft.com ([65.55.88.13]:2156 "EHLO TX2EHSOBE005.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754140Ab0K2Pig (ORCPT ); Mon, 29 Nov 2010 10:38:36 -0500 Received: from mail110-tx2-R.bigfish.com (10.9.14.253) by TX2EHSOBE005.bigfish.com (10.9.40.25) with Microsoft SMTP Server id 14.1.225.8; Mon, 29 Nov 2010 15:38:32 +0000 Received: from mail110-tx2 (localhost.localdomain [127.0.0.1]) by mail110-tx2-R.bigfish.com (Postfix) with ESMTP id 0BB00132015C; Mon, 29 Nov 2010 15:38:32 +0000 (UTC) X-SpamScore: -2 X-BigFish: VPS-2(zzbb2cKzz1202hzz8275bhz32i691h668h67dh61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:ausb3twp02.amd.com; RD:none; EFVD:NLI Received: from mail110-tx2 (localhost.localdomain [127.0.0.1]) by mail110-tx2 (MessageSwitch) id 1291045111771146_2666; Mon, 29 Nov 2010 15:38:31 +0000 (UTC) Received: from TX2EHSMHS006.bigfish.com (unknown [10.9.14.242]) by mail110-tx2.bigfish.com (Postfix) with ESMTP id AF7BB1250050; Mon, 29 Nov 2010 15:38:31 +0000 (UTC) Received: from ausb3twp02.amd.com (163.181.249.109) by TX2EHSMHS006.bigfish.com (10.9.99.106) with Microsoft SMTP Server id 14.1.225.8; Mon, 29 Nov 2010 15:38:31 +0000 X-WSS-ID: 0LCNKS2-02-8UG-02 X-M-MSG: Received: from sausexedgep01.amd.com (sausexedgep01-ext.amd.com [163.181.249.72]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 295C5C855E; Mon, 29 Nov 2010 09:38:25 -0600 (CST) Received: from sausexhtp02.amd.com (163.181.3.152) by sausexedgep01.amd.com (163.181.36.54) with Microsoft SMTP Server (TLS) id 8.3.106.1; Mon, 29 Nov 2010 09:39:55 -0600 Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp02.amd.com (163.181.3.152) with Microsoft SMTP Server (TLS) id 8.3.83.0; Mon, 29 Nov 2010 09:38:29 -0600 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.3.83.0; Mon, 29 Nov 2010 10:38:28 -0500 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id BDF2B49C256; Mon, 29 Nov 2010 15:38:27 +0000 (GMT) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 30F75100FA5; Mon, 29 Nov 2010 16:38:28 +0100 (CET) From: Joerg Roedel To: Avi Kivity , Marcelo Tosatti CC: , , Joerg Roedel Subject: [PATCH 3/3] KVM: X86: Don't report L2 emulation failures to user-space Date: Mon, 29 Nov 2010 16:38:10 +0100 Message-ID: <1291045090-2714-4-git-send-email-joerg.roedel@amd.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1291045090-2714-1-git-send-email-joerg.roedel@amd.com> References: <1291045090-2714-1-git-send-email-joerg.roedel@amd.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 29 Nov 2010 15:39:09 +0000 (UTC) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 410d2d1..78329dd 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4320,13 +4320,19 @@ EXPORT_SYMBOL_GPL(kvm_inject_realmode_interrupt); static int handle_emulation_failure(struct kvm_vcpu *vcpu) { + int r = EMULATE_DONE; + ++vcpu->stat.insn_emulation_fail; trace_kvm_emulate_insn_failed(vcpu); - vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; - vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; - vcpu->run->internal.ndata = 0; + if (!kvm_vcpu_is_gm(vcpu)) { + vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; + vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; + vcpu->run->internal.ndata = 0; + r = EMULATE_FAIL; + } kvm_queue_exception(vcpu, UD_VECTOR); - return EMULATE_FAIL; + + return r; } static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)