On 2014-11-13 17:34:59, Chen, Fan wrote: > On Thu, 2014-11-13 at 10:42 -0800, Jordan Justen wrote: > > On 2014-11-06 17:23:01, Fan, Jeff wrote: > > > Chen, > > > > > > Thanks your contribution. I will check-in your patch if there is no > > > further comments from other guys. > > > > > > Reviewed-by: Jeff Fan <jeff....@intel.com> > > > > Chen, > > > > I committed your series (r16345-r16371) for Jeff (to preserve the > > separate patches). > > > > Thanks for all your work on this! > > > > Let me know if you are interested in working on some follow up MP > > tasks. (I have 2 ideas. :) > Of course, I hope to help improve the MP.
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.) I think this task would be fairly challenging depending on your background experience with x86 processor interrupts. If anyone else on the list thinks we should take a different approach, please speak up! -Jordan > > > -----Original Message----- > > > From: Chen, Fan [mailto:chen.fan.f...@cn.fujitsu.com] > > > Sent: Thursday, November 06, 2014 5:13 PM > > > To: Fan, Jeff > > > Cc: Izumi, Taku; edk2-devel@lists.sourceforge.net; Jordan Justen > > > Subject: Re: [RFC PATCH V7 00/27] Introduce Mp Service protocol to > > > UefiCpuPkg > > > > > > On Thu, 2014-11-06 at 06:11 +0000, Fan, Jeff wrote: > > > > Chen, > > > > > > > > Thanks your updating. I attached one addition updating based on you're > > > > the latest patches. Please evaluate and sync it into your patches. > > > > > > > > BTW, please delete ApStartup.asm from CpuDxe, it seems to be one dummy > > > > file. > > > Thanks for you review. > > > I had merged the changes to my patches as you attachment said. see at: > > > https://github.com/ChenFanFnst/edk2/tree/cpu-mp-service > > > > > > and as for file ApStartup.asm, I moved the asm code to ApStartup.c as > > > comments for guiding to create startup code, then deleted ApStartup.asm. > > > > > > > > > Thanks, > > > Chen > > > > > > > > > > > > > > Thanks! > > > > Jeff > > > > -----Original Message----- > > > > From: Chen Fan [mailto:chen.fan.f...@cn.fujitsu.com] > > > > Sent: Tuesday, November 04, 2014 5:59 PM > > > > To: edk2-devel@lists.sourceforge.net > > > > Cc: Jordan Justen; Fan, Jeff; izumi.t...@jp.fujitsu.com > > > > Subject: [RFC PATCH V7 00/27] Introduce Mp Service protocol to > > > > UefiCpuPkg > > > > > > > > This series patchsets try to implement Mp Service protocol in > > > > UefiCpuPkg, Jordan had implemented the startup APs code, and I try to > > > > add more initialization code to let all APs work up, this Mp Service > > > > protocol's implementation used EmulatorPkg/MpService for reference. > > > > this patches works on my github: > > > > https://github.com/ChenFanFnst/edk2/tree/cpu-mp-service > > > > > > > > and made StartCorePkg app for testing Mp Service Protocol on: > > > > https://github.com/ChenFanFnst/edk2/tree/startcore > > > > > > > > I had tested the Mp protocol with the test code, and all cases passed. > > > > > > > > v6-v7: > > > > 1. fix some trivial bugs pointed out by Jeff. > > > > 2. free unused cpu buffer data. > > > > > > > > v5-v6: > > > > 1. using only one timer to check all APs status instead of timers for > > > > each AP. > > > > 2. cancel timer each time avoid timer handler reentrancy. > > > > 3. some bug fix. > > > > > > > > v4-v5: > > > > 1. introduce PcdCpuMaxLogicalProcessorNumber to pre-allocate > > > > stack buffer before starting the APs. > > > > 2. implement the function that if procedure routine timeout, > > > > reset AP by sending init ipi. > > > > 3. some bug fix. > > > > > > > > v3-v4: > > > > 1. change the order of the patches. > > > > 2. update some minor format suggested by Jeff. > > > > 3. add a PCD value to configure StackSize. > > > > 4. the last patch add assembly code for MSFT, but didn't > > > > test. > > > > > > > > V3-V3.1: > > > > 1. use AcquireSpinLockOrFail() intead of AcquireSpinLock() > > > > to avoid ASSERT sugguested by Jeff. > > > > > > > > V2-V3: > > > > 1. rebase codes due to Jordan'tree updated: > > > > https://github.com/jljusten/edk2/tree/ap-startup-example > > > > 2. add supported on Ia32 arch > > > > 3. add a new Lock to replace present SpinLock mechanisms in mutilple > > > > processors, maybe the SpinLock mechanisms is not MP safe. > > > > 4. add function header > > > > 5. add StartupAllAPs() supported > > > > 6. add SwitchBSP() function, which is unsupported. > > > > > > > > V1-V2: > > > > 1. do not call anything EFI API from APs. > > > > 2. add AP busy-wait for task assignment from BSP and get rid of > > > > IPI sent mechanism. > > > > > > > > Chen Fan (22): > > > > UefiCpuPkg/CpuDxe: introduce two PCD value > > > > UefiCpuPkg/CpuDxe: Switch Ap Stack to NewStack > > > > UefiCpuPkg/CpuDxe: introduce EFI_MP_SERVICES_PROTOCOL > > > > UefiCpuPkg/CpuDxe: introduce MP_SYSTEM_DATA for Mp Service Protocol > > > > UefiCpuPkg/CpuDxe: implement Mp Protocol: WhoAmI() > > > > UefiCpuPkg/CpuDxe: implement Mp Protocol:GetNumberOfProcessors() > > > > UefiCpuPkg/CpuDxe: implement Mp Services:GetProcessorInfo() > > > > UefiCpuPkg/CpuDxe: implement Mp Protocol:EnableDisableAP() > > > > UefiCpuPkg/CpuDxe: implement Mp Protocol:StartupThisAP() > > > > UefiCpuPkg/CpuDxe: implement Mp Services:StartupAllAPs() > > > > UefiCpuPkg/CpuDxe: implement Mp Services:SwitchBSP() > > > > UefiCpuPkg/CpuDxe: Ap do loop routine to execute procedure > > > > UefiCpuPkg/MpService: move settimer out to InitMpSystemData > > > > UefiCpuPkg/MpService: Simply Lock usage > > > > UefiCpuPkg/MpService: avoid next timer getting into > > > > CheckAllAPsStatus() > > > > UefiCpuPkg/CpuDxe: split out StartupCode from StartApsStackless() > > > > UefiCpuPkg/CpuDxe: introduce ResetApStackless() > > > > UefiCpuPkg/MpService: free the unused cpu data buffer > > > > UefiCpuPkg/MpService: avoid reset AP still hold a lock > > > > UefiCpuPkg/MpService: avoid dead lock caused by CheckAllAPsStatus > > > > UefiCpuPkg/CpuDxe: Startup APs > > > > UefiCpuPkg/CpuDxe: install Mp Service protocol > > > > > > > > Jordan Justen (5): > > > > UefiCpuPkg/CpuDxe: Add no-op InitializeMpSupport > > > > UefiCpuPkg/CpuDxe: Add ApEntryPointInC > > > > UefiCpuPkg/CpuDxe: Add stackless assembly AP entry points > > > > UefiCpuPkg/CpuDxe: Move GDT structures into CpuGdt.h > > > > UefiCpuPkg/CpuDxe: Add StartApsStackless routine > > > > > > > > UefiCpuPkg/CpuDxe/ApStartup.asm | 111 +++ > > > > UefiCpuPkg/CpuDxe/ApStartup.c | 252 ++++++ > > > > UefiCpuPkg/CpuDxe/CpuDxe.c | 3 + > > > > UefiCpuPkg/CpuDxe/CpuDxe.h | 1 + > > > > UefiCpuPkg/CpuDxe/CpuDxe.inf | 17 + > > > > UefiCpuPkg/CpuDxe/CpuGdt.c | 52 +- > > > > UefiCpuPkg/CpuDxe/CpuGdt.h | 72 ++ > > > > UefiCpuPkg/CpuDxe/CpuMp.c | 1534 > > > > +++++++++++++++++++++++++++++++++++++ > > > > UefiCpuPkg/CpuDxe/CpuMp.h | 642 ++++++++++++++++ > > > > UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm | 75 ++ > > > > UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm | 68 ++ > > > > UefiCpuPkg/CpuDxe/X64/MpAsm.asm | 76 ++ > > > > UefiCpuPkg/CpuDxe/X64/MpAsm.nasm | 70 ++ > > > > UefiCpuPkg/UefiCpuPkg.dec | 7 + > > > > UefiCpuPkg/UefiCpuPkg.dsc | 1 + > > > > 15 files changed, 2930 insertions(+), 51 deletions(-) create mode > > > > 100644 UefiCpuPkg/CpuDxe/ApStartup.asm create mode 100644 > > > > UefiCpuPkg/CpuDxe/ApStartup.c create mode 100644 > > > > UefiCpuPkg/CpuDxe/CpuGdt.h create mode 100644 > > > > UefiCpuPkg/CpuDxe/CpuMp.c create mode 100644 > > > > UefiCpuPkg/CpuDxe/CpuMp.h create mode 100644 > > > > UefiCpuPkg/CpuDxe/Ia32/MpAsm.asm create mode 100644 > > > > UefiCpuPkg/CpuDxe/Ia32/MpAsm.nasm create mode 100644 > > > > UefiCpuPkg/CpuDxe/X64/MpAsm.asm create mode 100644 > > > > UefiCpuPkg/CpuDxe/X64/MpAsm.nasm > > > > > > > > -- > > > > 1.9.3 > > > > > > > > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > > > edk2-devel mailing list > > > edk2-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/edk2-devel > ------------------------------------------------------------------------------ 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