From patchwork Thu Oct 14 08:41:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jin Dongming X-Patchwork-Id: 67791 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 945781007D3 for ; Thu, 14 Oct 2010 19:41:44 +1100 (EST) Received: from localhost ([127.0.0.1]:60401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6JNd-0005Fv-Mf for incoming@patchwork.ozlabs.org; Thu, 14 Oct 2010 04:41:41 -0400 Received: from [140.186.70.92] (port=59082 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6JLi-0004sF-Hp for qemu-devel@nongnu.org; Thu, 14 Oct 2010 04:39:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6JLh-0002B3-Fh for qemu-devel@nongnu.org; Thu, 14 Oct 2010 04:39:42 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:40828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6JLh-0002Ap-13 for qemu-devel@nongnu.org; Thu, 14 Oct 2010 04:39:41 -0400 Received: from m6.gw.fujitsu.co.jp ([10.0.50.76]) by fgwmail7.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o9E8dc13028554 for (envelope-from jin.dongming@np.css.fujitsu.com); Thu, 14 Oct 2010 17:39:38 +0900 Received: from smail (m6 [127.0.0.1]) by outgoing.m6.gw.fujitsu.co.jp (Postfix) with ESMTP id 4DD1745DE4F for ; Thu, 14 Oct 2010 17:39:38 +0900 (JST) Received: from s6.gw.fujitsu.co.jp (s6.gw.fujitsu.co.jp [10.0.50.96]) by m6.gw.fujitsu.co.jp (Postfix) with ESMTP id 316E545DE4E for ; Thu, 14 Oct 2010 17:39:38 +0900 (JST) Received: from s6.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s6.gw.fujitsu.co.jp (Postfix) with ESMTP id 1A06F1DB8016 for ; Thu, 14 Oct 2010 17:39:38 +0900 (JST) Received: from m002.s.css.fujitsu.com (m002.s.css.fujitsu.com [10.23.4.32]) by s6.gw.fujitsu.co.jp (Postfix) with ESMTP id D15FA1DB8014 for ; Thu, 14 Oct 2010 17:39:37 +0900 (JST) Received: from m002.css.fujitsu.com (m002 [127.0.0.1]) by m002.s.css.fujitsu.com (Postfix) with ESMTP id B8F8750EBC7; Thu, 14 Oct 2010 17:39:37 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.101.76]) by m002.s.css.fujitsu.com (Postfix) with ESMTP id 86DF750EBC2; Thu, 14 Oct 2010 17:39:37 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.5.1 Message-ID: <4CB6C21F.8000303@np.css.fujitsu.com> Date: Thu, 14 Oct 2010 17:41:03 +0900 From: Jin Dongming User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ja; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 MIME-Version: 1.0 To: KVM list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Hidetoshi Seto , Dean Nelson , Marcelo Tosatti , "qemu-devel@nongnu.org" , Avi Kivity , Huang Ying Subject: [Qemu-devel] [PATCH 01/11] kvm, x86: ignore SRAO only when MCG_SER_P is available X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org And restruct this block to call kvm_mce_in_exception() only when it is required. Signed-off-by: Hidetoshi Seto Tested-by: Jin Dongming --- qemu-kvm.c | 15 +++++++++------ 1 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qemu-kvm.c b/qemu-kvm.c index e78d850..6f62973 100644 --- a/qemu-kvm.c +++ b/qemu-kvm.c @@ -1903,12 +1903,15 @@ static void kvm_do_inject_x86_mce(void *_data) struct kvm_x86_mce_data *data = _data; int r; - /* If there is an MCE excpetion being processed, ignore this SRAO MCE */ - r = kvm_mce_in_exception(data->env); - if (r == -1) { - fprintf(stderr, "Failed to get MCE status\n"); - } else if (r && !(data->mce->status & MCI_STATUS_AR)) { - return; + /* If there is an MCE exception being processed, ignore this SRAO MCE */ + if ((data->env->mcg_cap & MCG_SER_P) && + !(data->mce->status & MCI_STATUS_AR)) { + r = kvm_mce_in_exception(data->env); + if (r == -1) { + fprintf(stderr, "Failed to get MCE status\n"); + } else if (r) { + return; + } } r = kvm_set_mce(data->env, data->mce); if (r < 0) {