[edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV

Wendy Liao via groups.io posted 1 patch 12 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c | 1 +
1 file changed, 1 insertion(+)
[edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by Wendy Liao via groups.io 12 months ago

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




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104592): https://edk2.groups.io/g/devel/message/104592
Mute This Topic: https://groups.io/mt/98810132/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by gaoliming via groups.io 12 months ago
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
> 
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104643): https://edk2.groups.io/g/devel/message/104643
Mute This Topic: https://groups.io/mt/98819385/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by Wendy Liao via groups.io 12 months ago
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
>>
>>
>>
>>
>> 
>>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104657): https://edk2.groups.io/g/devel/message/104657
Mute This Topic: https://groups.io/mt/98819385/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
回复: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by gaoliming via groups.io 12 months ago
Wendy:
  I understand the problem now. Your fix is correct. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

  This is a bug fix. I suggest to merge it for this stable tag 202305. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Wendy Liao
> via groups.io
> 发送时间: 2023年5月11日 10:23
> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> 抄送: 'Leon Chen' <leon.chen@insyde.com>; 'Tim Lewis'
> <tim.lewis@insyde.com>
> 主题: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set
> AprioriCount=0 before walking through next FV
> 
> 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
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104659): https://edk2.groups.io/g/devel/message/104659
Mute This Topic: https://groups.io/mt/98820431/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: 回复: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by Wendy Liao via groups.io 11 months, 3 weeks ago
Hi Liming,

Merged https://github.com/tianocore/edk2/pull/4397
Thank you.

Best Regards,

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

gaoliming 於 2023/05/11 上午 10:53 寫道:
> Wendy:
>    I understand the problem now. Your fix is correct. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
>    This is a bug fix. I suggest to merge it for this stable tag 202305.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Wendy Liao
>> via groups.io
>> 发送时间: 2023年5月11日 10:23
>> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
>> 抄送: 'Leon Chen' <leon.chen@insyde.com>; 'Tim Lewis'
>> <tim.lewis@insyde.com>
>> 主题: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set
>> AprioriCount=0 before walking through next FV
>>
>> 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
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>> 
>>
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104868): https://edk2.groups.io/g/devel/message/104868
Mute This Topic: https://groups.io/mt/98820431/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] 回复: 回复: 回复: [edk2-stable202305] [PATCH] MdeModulePkg/Core/Pei: set AprioriCount=0 before walking through next FV
Posted by gaoliming via groups.io 11 months, 3 weeks ago
Wendy:
  I agree this is bug fix in PeiCore to support more than one FV images those all have apriori list.

  If no other comments, I will merge it for this stable tag 202305. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Wendy Liao
> via groups.io
> 发送时间: 2023年5月15日 13:18
> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> 抄送: 'Leon Chen' <leon.chen@insyde.com>; 'Tim Lewis'
> <tim.lewis@insyde.com>
> 主题: Re: 回复: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set
> AprioriCount=0 before walking through next FV
> 
> Hi Liming,
> 
> Merged https://github.com/tianocore/edk2/pull/4397
> Thank you.
> 
> Best Regards,
> 
> Wendy Liao
> Insyde Software Corp.
> Phone: +886-2-6608-3688 Ext.8731
> 
> gaoliming 於 2023/05/11 上午 10:53 寫道:
> > Wendy:
> >    I understand the problem now. Your fix is correct. Reviewed-by: Liming
> Gao <gaoliming@byosoft.com.cn>
> >
> >    This is a bug fix. I suggest to merge it for this stable tag 202305.
> >
> > Thanks
> > Liming
> >> -----邮件原件-----
> >> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Wendy
> Liao
> >> via groups.io
> >> 发送时间: 2023年5月11日 10:23
> >> 收件人: gaoliming <gaoliming@byosoft.com.cn>; devel@edk2.groups.io
> >> 抄送: 'Leon Chen' <leon.chen@insyde.com>; 'Tim Lewis'
> >> <tim.lewis@insyde.com>
> >> 主题: Re: 回复: [edk2-devel] [PATCH] MdeModulePkg/Core/Pei: set
> >> AprioriCount=0 before walking through next FV
> >>
> >> 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
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >>
> >
> >
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104905): https://edk2.groups.io/g/devel/message/104905
Mute This Topic: https://groups.io/mt/98918118/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-