Yes. 

Placing APs in one hlt-loop is better in one ExitBootServices callback function 
registered by CpuDxe driver.

In long mode, page table still be required to run hlt-loop instruction. To 
avoid page table (in Boot Service Data range also) crashed, we could place APs 
hlt in protected mode.

Jeff

-----Original Message-----
From: Justen, Jordan L 
Sent: Friday, November 14, 2014 3:02 PM
To: Fan, Jeff; edk2-devel@lists.sourceforge.net
Subject: RE: [edk2] qemu + osx + smp vs. 
dee9376ffc6e5522bb5e50512b521952a5421fa5

On 2014-11-13 22:10:42, Fan, Jeff wrote:
> Gabriel,
> 
> After APs initialized, APs will run one loop in
> ProcessorToIdleState() to check the if BSP assigned task to them.
> 
> After ExitBootService() invoked, the boot services data will not be 
> safe and the AP running code maybe corrupted.
> 
> Could you check if ExitBootService() is invoked or not when issue 
> happened?

Hmm, I notice CpuDxe doesn't have an ExitBootServices callback yet.

If 1 or more APs are found we should consider having the BSP put the APs back 
into the wait-for-sipi state at ExitBootServices.

Otherwise, these will continue to loop using boot services code and data memory.

-Jordan

> -----Original Message-----
> From: Gabriel Somlo [mailto:gso...@gmail.com]
> Sent: Friday, November 14, 2014 1:15 PM
> To: Justen, Jordan L
> Cc: edk2-devel@lists.sourceforge.net
> Subject: [edk2] qemu + osx + smp vs. 
> dee9376ffc6e5522bb5e50512b521952a5421fa5
> 
> Jordan,
> 
> Commit dee9376ffc6e5522bb5e50512b521952a5421fa5 appears to break osx smp mode 
> (single-cpu on Mavericks seems to still work fine).
> 
> Fedora 20 and 21 live still work fine in either single- or multi-cpu 
> configurations.
> 
> I realize this must be an annoying bug report, since starting a qemu osx 
> guest requires not-yet-committed patches (e.g. Reza's pending ahci series, 
> and another bunch of osx specific stuff)...
> 
> For the record, my command line is:
> 
> bin/qemu-system-x86_64 -enable-kvm -m 2048 -cpu core2duo -smp 4,cores=2 \
>   -machine q35 -device ide-drive,bus=ide.2,drive=MacHDD \
>   -drive id=MacHDD,if=none,snapshot=on,file=./mac_10.9.img \
>   -device isa-applesmc,osk="secret-smc-osk-string" \
>   -netdev user,id=usr0 -device e1000-82545em,netdev=usr0,id=vnet0 \
>   -usb -device usb-kbd -device usb-mouse \
>   -bios OVMF.fd \
>   -smbios type=0,vendor="ovmf",version="svn.16189",date="09/29/14",uefi=on \
>   -debugcon file:debug.log -global isa-debugcon.iobase=0x402 \
>   -monitor stdio
> 
> And it hangs right before switching to graphics mode (so probably during 
> apple's boot.efi) with the following message:
> 
> 
> efiboot loaded from device: 
> Acpi(PNP0A03,0)/Pci(1F|2)/SATA(2,0)/HD(Part2,SigF402FAFD-C5D8-49C3-953
> C-91354746C321)
> boot file path:
> .Loading kernel cache file
> 'System\Library\Caches\com.apple.kext.caches\Startup\kernelcache'.....
> root device uuid is 'D3720931-EC86-377F-8606-DB54F76A1050'
> 
> 
> To boot with PIIX instead of q35, simply
> 
>    s/-machine q35/-device ahci,id=ide/
> 
> in the command line above. Then, it reboots after logging a similar message.
> 
> 
> The patch in question is a one-liner adding a "StartApsStackless()"
> call to UefiCpuPkg/CpuDxe/CpuMp.c, and osx obviously dislikes
> *something* about the state of the APs when it finds them, but beyond that I 
> have no idea what might be wrong.
> 
> 
> Jordan, if by any chance you have a hunch and would like me to test an 
> alternative way of doing things for qemu/osx guest compatibility, I'd be 
> happy to.
> 
> 
> Otherwise, this should serve as a heads-up for Reza: now that ovmf q35 
> support is upstream, once your ahci patches are applied, this will be 
> something you'll end up running into when submitting osx patches next 
> :)
> 
> Thanks again,
> --Gabriel
> 
> ----------------------------------------------------------------------
> -------- Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.
> clktrk _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to