On Mon, Feb 19, 2024 at 02:34:42AM +0000, Ni, Ray wrote:
> > +  for (GuidHob = GetFirstGuidHob (&mMpHandOffGuid);
> > +       GuidHob != NULL;
> > +       GuidHob = GetNextGuidHob (&mMpHandOffGuid, GET_NEXT_HOB
> > (GuidHob)))
> > +  {
> >      MpHandOff = (MP_HAND_OFF *)GET_GUID_HOB_DATA (GuidHob);
> > +    if (MpHandOff->ProcessorIndex == ProcessorIndex) {
> > +      return MpHandOff;
> > +    }
> 
> Gerd,
> The code is doing correctly but I have concerns about the performance impact.
> 
> With the prototype GetMpHandOffHob(), callers call it multiple times to 
> enumerate all HOB instances.
> 
> But every call is a HOB list enumeration from top of the HOB list which may 
> be slow in a platform
> that contains lots of HOB items and the MpHandOff HOB instances happen to be 
> in the very bottom.
> 
> How about add another parameter "HobStart" to GetMpHandOffHob()? So that only 
> the first call to
> GetMpHandOffHob() is a HOB list enumeration from top, latter calls start from 
> the next HOB of the previous
> found MpHandOff HOB instance.

That will only work if the HOBs are returned in ProcessorIndex order.

That happens to be the case in my testing; the HOBs are returned in the
same order they are created by patch #5 of this series.

Is that behavior guaranteed?  MdePkg/Include/Library/HobLib.h doesn't
say anything about the ordering.

take care,
  Gerd



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115588): https://edk2.groups.io/g/devel/message/115588
Mute This Topic: https://groups.io/mt/104369841/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to