Yes. SIPI is simple way to wakeup APs without touch IDT table. But APs need to start from real mode. But Don't worry about SIPI performance. Per our experience. There are a few tasks assigned to APs during POST phase. The Ersek's issue will not exist.
For fixed IPI solution, it's also good idea. We could use CpuArch->RegisterInterruptHandler() instead of update IVT table directly. Jeff -----Original Message----- From: Andrew Fish [mailto:af...@apple.com] Sent: Thursday, November 27, 2014 10:05 AM To: Justen, Jordan L Cc: edk2-devel@lists.sourceforge.net; Fan, Jeff Subject: Re: [edk2] UefiCpuPkg CpuMp improvement idea - Put APs to sleep when not busy > On Nov 26, 2014, at 1:47 PM, Jordan Justen <jordan.l.jus...@intel.com> wrote: > > On 2014-11-26 12:56:06, Andrew Fish wrote: >> >> On Nov 26, 2014, at 11:10 AM, Jordan Justen <jordan.l.jus...@intel.com> >> wrote: >> One idea I have is to initialize the interrupt vector table on the >> APs, and then allow the APs to run the CpuSleep function. >> >> Like IdleLoopEventCallback does for the BSP, this should put the APs >> into a lower power state while they are not working. >> >> Then the BSP can send the APs an 'interrupt IPI' when needed to wake >> the APs to do work. (I think SendFixedIpiAllExcludingSelf?) >> >> I think the DXE Core installs the IVT (Interrupt Vector Table) by >> calling InitializeCpuExceptionHandlers, and CpuDxe modifies the >> interrupt handler entries. >> >> But for the simpler situation of the APs, this might be more than >> needed. Instead maybe just setting up the IVT and calling AsmWriteIdtr >> would be all that is needed. >> >> One easy way to see if this is working is to run 'top' while using >> qemu with smp. In the current state the APs will cause a few threads >> to use 100% of the cpu while they busy-wait for something to do. (This >> only applies to OVMF boot, and the UEFI Shell, since once the OS >> manages the APs, they will be handled more efficiently.) >> >> Do you need an IDT to “make it work”. Just send a SIPI. I’m assuming >> the IPI would wake the processor out of the hlt? > > I'm not sure, but I thought that SIPI is ignored, unless the processor > is in 'wait-for-sipi'. (Which can be reset with the init-ipi.) > > But, doesn't SIPI always mean setting up the real-mode entry point? I > think redo'ing init-ipi+sipi every time the APs were called upon would > have a lot more latency than an interrupt ipi. > I was thinking there was an IPI mode that did not require a vector, but from looking at the manual the only option is the SIPI. > If SIPI on an already woken AP will wake it from the hlt, without > requiring an interrupt table setup, then that would be simpler. > Yea, short term that may be an option. Seems like cloning a version of the CpuExecptionHandlerLib that is MP safe would be a simple solution for the APs. Thanks, Andrew Fish > -Jordan ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel