public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Wendy Liao <wendy.liao@insyde.com>
To: gaoliming <gaoliming@byosoft.com.cn>, devel@edk2.groups.io
Cc: 'Leon Chen' <leon.chen@insyde.com>, 'Tim Lewis' <tim.lewis@insyde.com>
Subject: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Date: Thu, 11 May 2023 10:22:49 +0800	[thread overview]
Message-ID: <50fc03ee-969b-49aa-3edd-e05c049c0b2e@insyde.com> (raw)
In-Reply-To: <009501d983a8$6295f740$27c1e5c0$@byosoft.com.cn>

Hi gaoliming,

DiscoverPeimsAndOrderWithApriori () will not reset Private->AprioriCount 
to Zero when CoreFileHandle->ScanFv = TRUE.
DiscoverPeimsAndOrderWithApriori () {
...
   if (CoreFileHandle->ScanFv) {
     Private->CurrentFvFileHandles = CoreFileHandle->FvFileHandles;
     return;
   }
...
}
After go through all FV and the last FV has one or more Apriori Peim, 
Private->AprioriCount will not be reset to 0 anymore.

Scan loop 1
[FV1]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
2, CoreFileHandle->ScanFv = TRUE
[FV2]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 2, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
0, CoreFileHandle->ScanFv = TRUE
...
[FVn]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 0, 
CoreFileHandle->ScanFv = FALSE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
1, CoreFileHandle->ScanFv = TRUE

Scan loop 2
[FV1]
Before DiscoverPeimsAndOrderWithApriori () : Private->AprioriCount = 1, 
CoreFileHandle->ScanFv = TRUE
After DiscoverPeimsAndOrderWithApriori ()    : Private->AprioriCount = 
1, CoreFileHandle->ScanFv = TRUE

Best Regards,

Wendy Liao
Insyde Software Corp.
Phone: +886-2-6608-3688 Ext.8731

gaoliming 於 2023/05/11 上午 09:32 寫道:
> Wendy:
>    DiscoverPeimsAndOrderWithApriori () has the logic to reset Private->AprioriCount as zero.
>    It will set the real AprioriCount for each FV when this FV first scans, then dispatch the peims in the apriori list.
>    So, I don't think there is the issue here. Do you find the real functionality issue?
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Wendy Liao
>> via groups.io
>> 发送时间: 2023年5月10日 14:23
>> 收件人: devel@edk2.groups.io
>> 抄送: Leon Chen <leon.chen@insyde.com>; Tim Lewis
>> <tim.lewis@insyde.com>
>> 主题: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0
>> before walking through next FV
>>
>>
>> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4438
>>
>> The main dispatch loop in PeiDispatcher() goes through each FV and
>> calls DiscoverPeimsAndOrderWithApriori() to search Apriori file to
>> reorder all PEIMs then do the PEIM dispatched.
>>
>> DiscoverPeimsAndOrderWithApriori() calculates Apriori file count for
>> every FV once and set Private->AprioriCount, but Private->AprioriCount
>> doesn't be set to 0 before dispatch loop walking through the next FV.
>>
>> It causes the peim which sort on less than Private->AprioriCount and
>> depex is not satisfied would be dispatched when dispatch loop go through
>> to a scaned FV, even the peim is not set in APRIORI file.
>>
>> Cc: Leon Chen <leon.chen@insyde.com>
>> Cc: Tim Lewis <tim.lewis@insyde.com>
>> Reported-by: Esther Lee <esther.lee@insyde.com>
>> Signed-off-by: Wendy Liao <wendy.liao@insyde.com>
>>
>> ---
>>    MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
>>    1 file changed, 1 insertion(+)
>>
>> diff --git a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
>> b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
>> index d8284f9f4f..5f32ebb560 100644
>> --- a/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
>> +++ b/MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
>> @@ -1630,6 +1630,7 @@ PeiDispatcher (
>>          Private->CurrentFileHandle    = NULL;
>>          Private->CurrentPeimCount     = 0;
>>          Private->CurrentFvFileHandles = NULL;
>> +      Private->AprioriCount         = 0;
>>        }
>>
>>        //
>> --
>> 2.29.2.windows.2
>>
>>
>>
>>
>> 
>>
>
>

  reply	other threads:[~2023-05-11  2:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10  6:22 [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV Wendy Liao
2023-05-11  1:32 ` 回复: [edk2-devel] " gaoliming
2023-05-11  2:22   ` Wendy Liao [this message]
2023-05-11  2:53     ` 回复: " gaoliming
2023-05-15  5:18       ` Wendy Liao
2023-05-16  1:23         ` 回复: 回复: 回复: [edk2-stable202305] " gaoliming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50fc03ee-969b-49aa-3edd-e05c049c0b2e@insyde.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox