On Sep 16, 2014, at 11:42 PM, Chen, Fan <[email protected]> wrote:

> hi Andrew,
> 
> On Thu, 2014-09-11 at 06:59 -0700, Andrew Fish wrote:
>> 
>> On Sep 11, 2014, at 2:43 AM, Chen, Fan <[email protected]>
>> wrote:
>> 
>>>>> 
>>>>> Why did you get rid of sending IPI to wake up APs? Do you
>>>>> encounter any issue with it?
>>>>> From your patch, I don't know why StarupThisAP () cannot work
>>>>> correctly.  Could you send me your AP routine test code and test
>>>>> procedure?
>>> [Chen] I use the StartCorePkg to test Mp service. which is located
>>> at
>>> https://svn.code.sf.net/p/edk2-startcore/code/StartCorePkg
>>> 
>>> I found that after APs run a period of time, they failed assert at  
>>> MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c: (163)
>>> I don't know why. but if I got rid of frequent lock requests.
>>> at Ap-loop. it can largely reduce the chance of assertion. 
>> 
>> The issue is the IoLib depends on the DebugLib. If the DebugLib
>> instance in your driver is not MP safe (no a module type of BASE) then
>> the code is not MP safe.
>> 
>> 
>> 
>> 
>> https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Library/BaseIoLibIntrinsic/IoLibGcc.c
>> UINT32
>> EFIAPI
>> IoRead32 (
>>  IN      UINTN                     Port
>>  )
>> {
>>  UINT32   Data;
>> 
>>  ASSERT ((Port & 3) == 0);
>>  __asm__ __volatile__ ("inl %w1,%0" : "=a" (Data) : "d" ((UINT16)Port));
>>  return Data;
>> }
>> https://svn.code.sf.net/p/edk2/code/trunk/edk2/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf
>> [LibraryClasses]
>>  DebugLib
>>  BaseLib
>> If you add --report-file=build.log to the build command you can see
>> what instance of the DebugLib is being used with your driver in the
>> build.log file.
>> 
> I had built edk2 as you said. and in the build.log file, I only can
> found:
> 
> 
> 887 
> /home/chenfan/data/edk2/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
> 888 {DebugLib:  C = PlatformDebugLibIoPortConstructor}
> 
> Does this indicates the PlatformDebugLibIoPortConstructor() is not MP
> safe?

There are no indications that things are not MP safe, as by default everything 
is NOT MP safe. 

> and I found the PlatformDebugLibIoPortConstructor() is always
> return RFI_SUCCESS. have I something wrong? Please let me know.
> 

If you look at 
https://svn.code.sf.net/p/edk2/code/trunk/edk2/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
You will see that this library consumes the following libraries: 
[LibraryClasses]
  BaseMemoryLib
  IoLib
  PcdLib
  PrintLib
  BaseLib
  DebugPrintErrorLevelLib
And it also consumes the following PCDs:
[Pcd]
  gUefiOvmfPkgTokenSpaceGuid.PcdDebugIoPort                ## CONSUMES
  gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue        ## CONSUMES
  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask            ## CONSUMES

Thus you need to check what types the PCDs were set to. A Dynamic PCD type 
means they are calling a protocol that is not MP safe, a fixed type means they 
are using a local global variable and should be OK. 

You have to check the instance of the other library classes to make sure they 
are not calling any NON MP safe code too. The flattened list of all the library 
instances is in the build.log. 

Thanks,

Andrew Fish

> Thanks,
> Chen
> 
> 
> 
>> 
>> Thanks,
>> 
>> 
>> Andrew Fish

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to