From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 160A081EA2 for ; Thu, 10 Nov 2016 22:32:16 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP; 10 Nov 2016 22:32:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,620,1473145200"; d="scan'208";a="30026045" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga006.fm.intel.com with ESMTP; 10 Nov 2016 22:32:19 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 10 Nov 2016 22:32:19 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 10 Nov 2016 22:32:19 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.239]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.142]) with mapi id 14.03.0248.002; Fri, 11 Nov 2016 14:32:17 +0800 From: "Fan, Jeff" To: Paolo Bonzini , "edk2-devel@lists.01.org" Thread-Topic: [edk2] [PATCH 0/2] Put AP into safe hlt-loop code on S3 path Thread-Index: AQHSOxjbkdt035rVakW6TmOFdPQo2qDRddIAgAHeKkA= Date: Fri, 11 Nov 2016 06:32:16 +0000 Message-ID: <542CF652F8836A4AB8DBFAAD40ED192A4A2DA4D5@shsmsx102.ccr.corp.intel.com> References: <20161110060708.13932-1-jeff.fan@intel.com> <0a4293eb-29bb-92fd-4e16-a9337f7b4f5c@redhat.com> In-Reply-To: <0a4293eb-29bb-92fd-4e16-a9337f7b4f5c@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmFlMGZiMTUtMGVmMy00YTcyLTgxMjQtNDZkNDM0YTI2ZTk0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkRUTERVbng1YXJEOWxhRzRLRncxMTJPT2x5ZTY2Mk5JUEtIQ1ZMMVRlNXc9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 0/2] Put AP into safe hlt-loop code on S3 path X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2016 06:32:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Paolo, I added patch #3 in v2 to do InterlockedDecrement (&mNumberToFinish) in the= safe code.=20 This is very good comment to eliminate this gap. Thanks! Jeff -----Original Message----- From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo Bon= zini Sent: Thursday, November 10, 2016 5:59 PM To: Fan, Jeff; edk2-devel@lists.01.org Subject: Re: [edk2] [PATCH 0/2] Put AP into safe hlt-loop code on S3 path On 10/11/2016 07:07, Jeff Fan wrote: > On S3 path, we will wake up APs to restore CPU context in=20 > PiSmmCpuDxeSmm driver. In case, one NMI or SMI happens, APs may exit=20 > from hlt state and execute the instruction after HLT instruction. >=20 > But APs are not running on safe code, it leads OVMF S3 boot unstable. >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D216 >=20 > I tested real platform with 64bit DXE. >=20 > Jeff Fan (2): > UefiCpuPkg/PiSmmCpuDxeSmm: Put AP into safe hlt-loop code on S3 path > UefiCpuPkg/PiSmmCpuDxeSmm: Place AP to 32bit protected mode on S3=20 > path >=20 > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 31 ++++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 25 ++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 13 ++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 59=20 > +++++++++++++++++++++++++++ > 4 files changed, 128 insertions(+) >=20 Reviewed-by: Paolo Bonzini It would be slightly more robust to do the "InterlockedDecrement (&mNumberT= oFinish);" while in safe state, but the race window is really really small. Paolo