From nobody Sat Feb 7 09:30:28 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16458692817161015.2308175646228; Sat, 26 Feb 2022 01:54:41 -0800 (PST) Received: from localhost ([::1]:57022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nNtmh-0003G1-Hs for importer@patchew.org; Sat, 26 Feb 2022 04:54:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43172) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNtl1-0002ZX-Ed for qemu-devel@nongnu.org; Sat, 26 Feb 2022 04:52:55 -0500 Received: from eage.unicloud.com ([220.194.70.58]:14523 helo=spam.unicloud.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nNtkx-0001hW-Cd for qemu-devel@nongnu.org; Sat, 26 Feb 2022 04:52:54 -0500 Received: from eage.unicloud.com ([220.194.70.35]) by spam.unicloud.com with ESMTP id 21Q9qZ68097417; Sat, 26 Feb 2022 17:52:35 +0800 (GMT-8) (envelope-from luofei@unicloud.com) Received: from zgys-ex-mb09.Unicloud.com (10.10.0.24) by zgys-ex-mb09.Unicloud.com (10.10.0.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Sat, 26 Feb 2022 17:52:34 +0800 Received: from zgys-ex-mb09.Unicloud.com ([fe80::eda0:6815:ca71:5aa]) by zgys-ex-mb09.Unicloud.com ([fe80::eda0:6815:ca71:5aa%16]) with mapi id 15.01.2375.017; Sat, 26 Feb 2022 17:52:34 +0800 From: =?gb2312?B?wt63yQ==?= To: qemu-devel Subject: =?gb2312?B?tPC4tDogW1BBVENIXSBpMzg2OiBTZXQgTUNHX1NUQVRVU19SSVBWIGJpdCBm?= =?gb2312?Q?or_mce_SRAR_error?= Thread-Topic: [PATCH] i386: Set MCG_STATUS_RIPV bit for mce SRAR error Thread-Index: AQHYDdpiM0Sj+cD120OyD4W4YWbm6ayl0VSf Date: Sat, 26 Feb 2022 09:52:34 +0000 Message-ID: References: <20220120084634.131450-1-luofei@unicloud.com> In-Reply-To: <20220120084634.131450-1-luofei@unicloud.com> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.1.7] Content-Type: multipart/alternative; boundary="_000_ba36a73514754da4ade170a1b39064d8unicloudcom_" MIME-Version: 1.0 X-DNSRBL: X-MAIL: spam.unicloud.com 21Q9qZ68097417 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=220.194.70.58; envelope-from=luofei@unicloud.com; helo=spam.unicloud.com X-Spam_score_int: 37 X-Spam_score: 3.7 X-Spam_bar: +++ X-Spam_report: (3.7 / 5.0 requ) BAYES_00=-1.9, CHARSET_FARAWAY_HEADER=3.2, HTML_MESSAGE=0.001, MIME_CHARSET_FARAWAY=2.45, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Marcelo Tosatti , "kvm@vger.kernel.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1645869283438100001 --_000_ba36a73514754da4ade170a1b39064d8unicloudcom_ Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" ping https://patchew.org/QEMU/20220120084634.131450-1-luofei@unicloud.com/ ________________________________ =E5=8F=91=E4=BB=B6=E4=BA=BA: =E7=BD=97=E9=A3=9E =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2022=E5=B9=B41=E6=9C=8820=E6=97=A5 16= :46:34 =E6=94=B6=E4=BB=B6=E4=BA=BA: qemu-devel =E6=8A=84=E9=80=81: Paolo Bonzini; Marcelo Tosatti; kvm@vger.kernel.org; = =E7=BD=97=E9=A3=9E =E4=B8=BB=E9=A2=98: [PATCH] i386: Set MCG_STATUS_RIPV bit for mce SRAR error In the physical machine environment, when a SRAR error occurs, the IA32_MCG_STATUS RIPV bit is set, but qemu does not set this bit. When qemu injects an SRAR error into virtual machine, the virtual machine kernel just call do_machine_check() to kill the current task, but not call memory_failure() to isolate the faulty page, which will cause the faulty page to be allocated and used repeatedly. If used by the virtual machine kernel, it will cause the virtual machine to crash Signed-off-by: luofei --- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 2c8feb4a6f..14655577f0 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -537,7 +537,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, i= nt code) if (code =3D=3D BUS_MCEERR_AR) { status |=3D MCI_STATUS_AR | 0x134; - mcg_status |=3D MCG_STATUS_EIPV; + mcg_status |=3D MCG_STATUS_RIPV | MCG_STATUS_EIPV; } else { status |=3D 0xc0; mcg_status |=3D MCG_STATUS_RIPV; -- 2.27.0 --_000_ba36a73514754da4ade170a1b39064d8unicloudcom_ Content-Type: text/html; charset="gb2312" Content-Transfer-Encoding: quoted-printable

=B7=A2=BC=FE=C8=CB: =C2= =DE=B7=C9
=B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA1=D4=C220=C8=D5 16:46:34
=CA=D5=BC=FE=C8=CB: qemu-devel
=B3=AD=CB=CD: Paolo Bonzini; Marcelo Tosatti; kvm@vger.kernel.org; = =C2=DE=B7=C9
=D6=F7=CC=E2: [PATCH] i386: Set MCG_STATUS_RIPV bit for mce SRAR err= or
 
In the physical machine environment, when a SRAR e= rror occurs,
the IA32_MCG_STATUS RIPV bit is set, but qemu does not set this
bit. When qemu injects an SRAR error into virtual machine, the
virtual machine kernel just call do_machine_check() to kill the
current task, but not call memory_failure() to isolate the faulty
page, which will cause the faulty page to be allocated and used
repeatedly. If used by the virtual machine kernel, it will cause
the virtual machine to crash

Signed-off-by: luofei <luofei@unicloud.com>
---
 target/i386/kvm/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 2c8feb4a6f..14655577f0 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -537,7 +537,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr padd= r, int code)
 
     if (code =3D=3D BUS_MCEERR_AR) {
         status |=3D MCI_STATUS_AR = | 0x134;
-        mcg_status |=3D MCG_STATUS_EIPV= ;
+        mcg_status |=3D MCG_STATUS_= RIPV | MCG_STATUS_EIPV;
     } else {
         status |=3D 0xc0;
         mcg_status |=3D MCG_STATUS= _RIPV;
--
2.27.0

--_000_ba36a73514754da4ade170a1b39064d8unicloudcom_--