From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1D86F81DFF for ; Thu, 10 Nov 2016 01:59:02 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id a20so2023445wme.2 for ; Thu, 10 Nov 2016 01:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=s6PLEumjDfWtgP7wWM4tXszK33/UjPcwV3PgQKy0HD4=; b=f/9Z/EM6k4zWR+9AWC60iwno0T7KEgYtS76g36a8/Py6qyD7faOEDiJOK2oqS/HBVG i0HUrgetUPiu8Rt7L86RsGydryqzXE+RnswECvBlhbZAGsNULnNyWJimLaJQXnwQtPK/ KPdS65R8lC+N3WoErsL29gWvWwfBFrokH6hEWvRYSLmVloxmF7AyomoUlRA4awFZwbhv O+X4CDMRyAg71Plj3NzNArjeqYBC1sT/REKhUsY39EqgC04uL+BcsqfWRYrz0652D8N3 LbvnNaVLG3W7rfcCLsreiAwc4hNuIg3dUDdObRTSN17xIxdMbC6yPQEEnTAti21xmsoY qRyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=s6PLEumjDfWtgP7wWM4tXszK33/UjPcwV3PgQKy0HD4=; b=gX4+2m+gByiGQB0TImWdPGInjzkSB12eftO11SKZ8f5X6+0/qqYifqbkoq8vK2XvyT u41RCfoNABfxLjNp7GYavCRLCvRl7wRmCMohs4DGPh09wcxQa5pb5ovK/BOrwaxsIndx xfk/zuE4AWxbv7fZ18T30V+8APlZ8U0792MsYBd2HtQ6a6vEIMMfNomNhQb7TLoRhhPf EYZKhRTDtFyiJ6ItrqdXm8bi2MiX6e0CDAkaaU91Xvrp2zCP2wWHRhFpwzdn8386oOhX 3gGJC6nGCEReXxBuZ6CgH+PcxBy6wEO1zvOX4C4sBrx6bmmchUrUYXaC7dIcsDJbdomV +jHA== X-Gm-Message-State: ABUngvfP7Z0YyyAoEE4/DNUaunukxhO4hZYSnsDdZ1LdUhYJNHqxfguetiirLECAljV6xg== X-Received: by 10.28.47.196 with SMTP id v187mr6398553wmv.75.1478771944042; Thu, 10 Nov 2016 01:59:04 -0800 (PST) Received: from [192.168.10.165] (94-39-185-129.adsl-ull.clienti.tiscali.it. [94.39.185.129]) by smtp.googlemail.com with ESMTPSA id n72sm11986538wmd.11.2016.11.10.01.59.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Nov 2016 01:59:03 -0800 (PST) Sender: Paolo Bonzini To: Jeff Fan , edk2-devel@lists.01.org References: <20161110060708.13932-1-jeff.fan@intel.com> From: Paolo Bonzini Message-ID: <0a4293eb-29bb-92fd-4e16-a9337f7b4f5c@redhat.com> Date: Thu, 10 Nov 2016 10:59:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161110060708.13932-1-jeff.fan@intel.com> 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: Thu, 10 Nov 2016 09:59:02 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit On 10/11/2016 07:07, Jeff Fan wrote: > On S3 path, we will wake up APs to restore CPU context in PiSmmCpuDxeSmm > driver. In case, one NMI or SMI happens, APs may exit from hlt state and > execute the instruction after HLT instruction. > > But APs are not running on safe code, it leads OVMF S3 boot unstable. > > https://bugzilla.tianocore.org/show_bug.cgi?id=216 > > I tested real platform with 64bit DXE. > > 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 path > > UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 31 ++++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 25 ++++++++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 13 ++++++ > UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c | 59 +++++++++++++++++++++++++++ > 4 files changed, 128 insertions(+) > Reviewed-by: Paolo Bonzini It would be slightly more robust to do the "InterlockedDecrement (&mNumberToFinish);" while in safe state, but the race window is really really small. Paolo