From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=17.171.2.31; helo=mail-in21.apple.com; envelope-from=afish@apple.com; receiver=edk2-devel@lists.01.org Received: from mail-in21.apple.com (mail-out21.apple.com [17.171.2.31]) (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 58ADE21130034 for ; Thu, 14 Jun 2018 07:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; d=apple.com; s=mailout2048s; c=relaxed/simple; q=dns/txt; i=@apple.com; t=1528987949; x=2392901549; h=From:Sender:Reply-To:Subject:Date:Message-id:To:Cc:MIME-version:Content-type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-reply-to:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kJNMPHfRWVGUztOPFNTPwJaQurGaactKPNI7ILJ6OYE=; b=byq6+vp6kEP/Ji26dufRQ85KAfFmP4YhhpJwtpQkkIDb5StJEQpLeFDIx+Z/uhBy 9SvTqzxz2qJ6veFT4pVhqx+sZxlnahQYCJZSrKeYYleoQw/PbFcBfiHdE0sY4AgJ DH6sJ/bqj8jhrwxHjRH3ZlYm915mfoFgT6Qjynqa1W/V7sPw+Hz86wbsBv8RqNfm UEfHN8n0MZze0Jrel80CwwKCyBnaF+nlTeT1Zh0/sEdxlbmxFQVZ+FrfQoM+IdbB AczA9EN8TK/PDkMkxjtYPwW+fdrAPWjsnexx/IvM1iEMmqfgNIfGdRPpuhm3kB6+ HLieO/zo3nDQ17IOsyLICA==; X-AuditID: 11ab0215-217ff70000002a18-6e-5b22812c4c7c Received: from mr2-mtap-s01.rno.apple.com (mr2-mtap-s01.rno.apple.com [17.179.226.133]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail-in21.apple.com (Apple Secure Mail Relay) with SMTP id 0A.ED.10776.C21822B5; Thu, 14 Jun 2018 07:52:29 -0700 (PDT) MIME-version: 1.0 Received: from ma1-mmpp-sz09.apple.com (ma1-mmpp-sz09.apple.com [17.171.128.183]) by mr2-mtap-s01.rno.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180329 64bit (built Mar 29 2018)) with ESMTPS id <0PAB00DK5INFCN80@mr2-mtap-s01.rno.apple.com>; Thu, 14 Jun 2018 07:52:28 -0700 (PDT) Received: from [17.234.177.65] (unknown [17.234.177.65]) by ma1-mmpp-sz09.apple.com (Oracle Communications Messaging Server 8.0.2.2.20180403 64bit (built Apr 3 2018)) with ESMTPSA id <0PAB00DBOINC2O20@ma1-mmpp-sz09.apple.com>; Thu, 14 Jun 2018 07:52:28 -0700 (PDT) X-Va-A: X-Va-T-CD: 81ca60fce39c2560b6c4a7e5841f9b8f X-Va-E-CD: f3a84d7e311949f4bbb0c8c3f52bc5aa X-Va-R-CD: fc312482e548b1e9689037f24aaea52e X-Va-CD: 0 X-Va-ID: 223f18db-cb7a-4db9-bc45-57dce8a1b55d X-V-A: X-V-T-CD: b5b932e696498d2aa4957883a9737ec0 X-V-E-CD: f3a84d7e311949f4bbb0c8c3f52bc5aa X-V-R-CD: fc312482e548b1e9689037f24aaea52e X-V-CD: 0 X-V-ID: d60e7d3f-b5de-42b3-a68c-ae7ed756014a X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-06-14_05:,, signatures=0 X-Proofpoint-Scanner-Instance: ma-grpmailp-qapp23.corp.apple.com-10000_instance1 Sender: afish@apple.com From: Andrew Fish Message-id: Date: Thu, 14 Jun 2018 07:52:23 -0700 In-reply-to: Cc: Laszlo Ersek , "edk2-devel@lists.01.org" , "Singh, Brijesh" , Jordan Justen , Liming Gao , Paolo Bonzini , Jeff Fan To: "Duran, Leo" References: <1528920674-24912-1-git-send-email-leo.duran@amd.com> <1528920674-24912-2-git-send-email-leo.duran@amd.com> <9e2b3f74-c37e-06d9-293e-04976713ce8c@redhat.com> X-Mailer: Apple Mail (2.3445.6.18) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgleLIzCtJLcpLzFFi42IR3PyoVVe3USna4OYrAYuZm/oYLfYcOsps cXL9EkaLHdf6WSy6n59kt1h2bAeLxYp7G9gt9m/7x+rA4dF66S+bx+I9L5k8umf/Y/F4v+8q WwBLFJdNSmpOZllqkb5dAlfGvO+rGQuWHWCs2PQ3soGxdyVjFyMHh4SAicSnJzpdjFwcQgIH mSTmn1nH3sXIycErICjxY/I9FpAaZoEwiVM7lSBq1jNJnDyxkAXCmcgkcf7lRmaQBgkBdok/ v3awQNjaEku/LmCGWKAtMXVVKEz43rl1UCVcEgu2nmaFsHUl/mw6yQRhs0msP7EEytaSOLit B86+NW0pK8RILYnX3YkQYU6J818mskPYOhKL2n6xQZRkS8zZwg0RDpBYs/AnI4gtLCAu8e7M JrCD2QSUJVbM/wD1rY3Eslk7mSFqMiWOTj8FFmcRUJXomtoKDilOgXiJzmZFkMeZBeYySVzY +QXsExEBFYlv058wQUKkgUni8OsfUC8qSfzfdYR5AqPcLKQQnYUIUZAwM9Az3x+1QoXlJQ6e l4UIa0o8u/eJHcLWlnjy7gLrAka2VYzCuYmZObqZeUaGeokFBTmpesn5uZsYQUlnNZPoDsb5 rwwPMQpwMCrx8BoUKEULsSaWFVfmHmKU5mBREuf9uEssWkggPbEkNTs1tSC1KL6oNCe1+BAj EwenVAOj56GTTglK69PC/r+xPSPpvGt9YtUt6bhzh7ef9V8tb9wTw2LAp6B15uSiO6VCx3IC mDeJ3V7Z3uXWzqkQKnc5y6HQbKv0YreZuoXN/8uSP4R4Hnc7k/pFO+P1i2kvZpvv29O5QzQo Z8Uuw3Tmb807hdW8e+z4Fh09csy1OOmY4PwD8hYRN4uVWIozEg21mIuKEwHVwiJBGwMAAA== X-Content-Filtered-By: Mailman/MimeDel 2.1.26 Subject: Re: [PATCH] UefiCpuPkg/LocalApicLib: Exclude second SendIpi sequence on AMD processors. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2018 14:52:30 -0000 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT > On Jun 14, 2018, at 7:08 AM, Duran, Leo wrote: > > > >> -----Original Message----- >> From: Laszlo Ersek > >> Sent: Wednesday, June 13, 2018 3:50 PM >> To: Duran, Leo >; edk2-devel@lists.01.org >> Cc: Jordan Justen >; Jeff Fan >> >; Liming Gao >; Singh, Brijesh >> >; Paolo Bonzini >; Igor >> Mammedov > >> Subject: Re: [edk2] [PATCH] UefiCpuPkg/LocalApicLib: Exclude second >> SendIpi sequence on AMD processors. >> >> Hello Leo, >> >> On 06/13/18 22:11, Leo Duran wrote: >>> On AMD processors the second SendIpi in the SendInitSipiSipi and >>> SendInitSipiSipiAllExcludingSelf routines is not required, and may >>> cause undesired side-effects during MP initialization. >>> >>> This patch leverages the StandardSignatureIsAuthenticAMD check to >>> exclude the second SendIpi and its associated MicroSecondDelay (200). >> >> QEMU and KVM emulate some AMD processors too; of particular interest is >> the recent EPYC addition, I believe (for SME/SEV, minimally). >> >> Did you check whether the StandardSignatureIsAuthenticAMD() check >> applies to those QEMU VCPU models, and if so, whether omitting the second >> Startup IPI interferes with *V*CPU startup in OVMF guests? (In >> multiprocessing modules, such as CpuMpPei, CpuDxe, and >> PiSmmCpuDxeSmm.) >> >> Adding Brijesh, Paolo and Igor. >> >> Thanks! >> Laszlo > > Hi Lazlo, > > My understanding is that hypervisors simply ignore the second SIPI, so a single (or double) SIPI should be fine. > In any event, I'm checking with Brijesh on your specific question. > My understanding is the 2nd SIPI was for an Intel processor bug in the mid 1990's and it has not been required since. People are just scared to change it since all the Operating Systems have been historically validated against INT SIPI SIPI. One of my co-works removed our extra SIPI, not knowing the history, and everything worked. Well we booted a little faster without the extra SIPI. If people still have the compatibility concern can we make the 2nd SIPI configurable via a PCD. But given the StandardSignatureIsAuthenticAMD() data point we should default the 2nd SIPI to off and move the world forward? What do folks think? Thanks, Andrew Fish PS If I'm remembering correctly Mark Doran (of UEFI Fame) help lead the MP Spec back in the 1990s that 1st documented the INIT SIPI SIPI so we could get some more history from him if needed. > Leo. > >> >>> >>> Contributed-under: TianoCore Contribution Agreement 1.1 >>> Signed-off-by: Leo Duran >>> Cc: Jordan Justen >>> Cc: Jeff Fan >>> Cc: Liming Gao >>> --- >>> UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 12 ++++++++---- >>> UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 12 >>> ++++++++---- >>> 2 files changed, 16 insertions(+), 8 deletions(-) >>> >>> diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c >>> b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c >>> index b0b7e32..6e80536 100644 >>> --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c >>> +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c >>> @@ -554,8 +554,10 @@ SendInitSipiSipi ( >>> IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_STARTUP; >>> IcrLow.Bits.Level = 1; >>> SendIpi (IcrLow.Uint32, ApicId); >>> - MicroSecondDelay (200); >>> - SendIpi (IcrLow.Uint32, ApicId); >>> + if (!StandardSignatureIsAuthenticAMD()) { >>> + MicroSecondDelay (200); >>> + SendIpi (IcrLow.Uint32, ApicId); >>> + } >>> } >>> >>> /** >>> @@ -588,8 +590,10 @@ SendInitSipiSipiAllExcludingSelf ( >>> IcrLow.Bits.Level = 1; >>> IcrLow.Bits.DestinationShorthand = >> LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF; >>> SendIpi (IcrLow.Uint32, 0); >>> - MicroSecondDelay (200); >>> - SendIpi (IcrLow.Uint32, 0); >>> + if (!StandardSignatureIsAuthenticAMD()) { >>> + MicroSecondDelay (200); >>> + SendIpi (IcrLow.Uint32, 0); >>> + } >>> } >>> >>> /** >>> diff --git >>> a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c >>> b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c >>> index 1f4dcf7..5d82836 100644 >>> --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c >>> +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c >>> @@ -649,8 +649,10 @@ SendInitSipiSipi ( >>> IcrLow.Bits.DeliveryMode = LOCAL_APIC_DELIVERY_MODE_STARTUP; >>> IcrLow.Bits.Level = 1; >>> SendIpi (IcrLow.Uint32, ApicId); >>> - MicroSecondDelay (200); >>> - SendIpi (IcrLow.Uint32, ApicId); >>> + if (!StandardSignatureIsAuthenticAMD()) { >>> + MicroSecondDelay (200); >>> + SendIpi (IcrLow.Uint32, ApicId); >>> + } >>> } >>> >>> /** >>> @@ -683,8 +685,10 @@ SendInitSipiSipiAllExcludingSelf ( >>> IcrLow.Bits.Level = 1; >>> IcrLow.Bits.DestinationShorthand = >> LOCAL_APIC_DESTINATION_SHORTHAND_ALL_EXCLUDING_SELF; >>> SendIpi (IcrLow.Uint32, 0); >>> - MicroSecondDelay (200); >>> - SendIpi (IcrLow.Uint32, 0); >>> + if (!StandardSignatureIsAuthenticAMD()) { >>> + MicroSecondDelay (200); >>> + SendIpi (IcrLow.Uint32, 0); >>> + } >>> } >>> >>> /** >>> > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel