On Fri, Nov 14, 2014 at 08:30:35AM +0000, Chen, Fan wrote:
> On Fri, 2014-11-14 at 08:11 +0000, Fan, Jeff wrote: 
> > Sounds good idea to send INIT IPI to APs to let it be wait for SIPI state.
> 
> Yes, this idea looks simple. so I just now did a Win2012R2 installing
> test, it caused a 0x00000c4 error (see attached file). so I made a
> code as jordan's suggestion to fix it. and then installing test works
> ok.
> 
> Gabriel,
> 
> please use the attached patch to test your osx env.

Yep, that fixed it for me -- Thanks !

Tested-by: Gabriel Somlo <so...@cmu.edu>

--Gabriel

> > 
> > Jeff
> > -----Original Message-----
> > From: Justen, Jordan L 
> > Sent: Friday, November 14, 2014 3:57 PM
> > To: Fan, Jeff; edk2-devel@lists.sourceforge.net
> > Subject: RE: [edk2] qemu + osx + smp vs. 
> > dee9376ffc6e5522bb5e50512b521952a5421fa5
> > 
> > On 2014-11-13 23:18:43, Fan, Jeff wrote:
> > > 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.
> > 
> > Can the BSP use SendInitIpiAllExcludingSelf to put the APs back into wait 
> > for SIPI mode?
> > 
> > Then we could avoid the extra complexity of separate runtime memory 
> > allocated page tables for the APs.
> > 
> > -Jordan
> > 
> > > -----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-9
> > > > 53
> > > > 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
> 


> diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
> index c9df4e1..a7eb881 100644
> --- a/UefiCpuPkg/CpuDxe/CpuDxe.c
> +++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
> @@ -826,6 +826,24 @@ IdleLoopEventCallback (
>    CpuSleep ();
>  }
>  
> +/**
> +  Callback function for ExitBootService.
> +
> +  @param  Event                 Event whose notification function is being 
> invoked.
> +  @param  Context               The pointer to the notification function's 
> context,
> +                                which is implementation-dependent.
> +
> +**/
> +VOID
> +EFIAPI
> +ExitBootServicesCallback (
> +  IN EFI_EVENT                Event,
> +  IN VOID                     *Context
> +  )
> +{
> +  SendInitIpiAllExcludingSelf();
> +}
> +
>  
>  /**
>    Initialize the state information for the CPU Architectural Protocol.
> @@ -847,6 +865,7 @@ InitializeCpu (
>  {
>    EFI_STATUS  Status;
>    EFI_EVENT   IdleLoopEvent;
> +  EFI_EVENT   ExitBootServicesEvent;
>  
>    InitializeFloatingPointUnits ();
>  
> @@ -900,6 +919,15 @@ InitializeCpu (
>  
>    InitializeMpSupport ();
>  
> +  Status = gBS->CreateEvent (
> +                  EVT_SIGNAL_EXIT_BOOT_SERVICES,
> +                  TPL_CALLBACK,
> +                  ExitBootServicesCallback,
> +                  NULL,
> +                  &ExitBootServicesEvent
> +                  );
> +  ASSERT_EFI_ERROR (Status);
> +
>    return Status;
>  }
>  


------------------------------------------------------------------------------
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