public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [edk2-discuss] Attempted runtime pool allocation returns non-runtime pool
       [not found] <CAB8Y2ryo86XH2s=avss4s4nC8sp68rWv1NsnJHqv+qvxGWEkuA@mail.gmail.com>
@ 2024-12-04 12:31 ` Leif Lindholm via groups.io
  2024-12-04 15:39   ` Oliver Smith-Denny via groups.io
  0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm via groups.io @ 2024-12-04 12:31 UTC (permalink / raw)
  To: discuss, adwags, devel

Hi Adam,

I think this topic is better for the "devel" group, rather then
"discuss". I've added it to cc.

I don't see why you would get back a valid pointer if the request
failed. That would feel like a bug in AllocateRuntimeZeroPool.
But there could be some subtlety involving pool allocations I'm missing here.

You could always allocate memory with AllocatePages directly instead,
to cut out the middle man,
and if nothing else see if that turns up some other issue.

Regards,

Leif

On Wed, 4 Dec 2024 at 04:21, Adam Wagner via groups.io
<adwags=gmail.com@groups.io> wrote:
>
> Hello,
>
> I have a DXE runtime driver that is attempting to allocate runtime pool
> (via AllocateRuntimeZeroPool). I'm getting back a non-NULL pointer, but it
> isn't in the runtime memory map so ConvertPointer fails later. It looks
> like the returned address is in a memory region of "conventional" type
> which if I understand correctly is where free memory lives?
>
> I think I may be hitting the "Attempt to find free pages in the default
> allocation bin" case here...
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Mem/Page.c#L1281
>
> Is there a way to "relocate" or "promote" this to the runtime pool or
> otherwise get it into the runtime memory map? Sorry if my terminology is
> wrong, I'm obviously a newb. I poked around on the groups here and on
> bugzilla but couldn't find anything related.
>
> Thanks,
> Adam
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120867): https://edk2.groups.io/g/devel/message/120867
Mute This Topic: https://groups.io/mt/109918571/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [edk2-discuss] Attempted runtime pool allocation returns non-runtime pool
  2024-12-04 12:31 ` [edk2-devel] [edk2-discuss] Attempted runtime pool allocation returns non-runtime pool Leif Lindholm via groups.io
@ 2024-12-04 15:39   ` Oliver Smith-Denny via groups.io
  2024-12-05  1:31     ` 回复: " gaoliming via groups.io
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Smith-Denny via groups.io @ 2024-12-04 15:39 UTC (permalink / raw)
  To: devel, leif.lindholm, discuss, adwags

Hi Adam,

> On Wed, 4 Dec 2024 at 04:21, Adam Wagner via groups.io
> <adwags=gmail.com@groups.io> wrote:
>>
>> Hello,
>>
>> I have a DXE runtime driver that is attempting to allocate runtime pool
>> (via AllocateRuntimeZeroPool). I'm getting back a non-NULL pointer, but it
>> isn't in the runtime memory map so ConvertPointer fails later. It looks
>> like the returned address is in a memory region of "conventional" type
>> which if I understand correctly is where free memory lives?
>>
>> I think I may be hitting the "Attempt to find free pages in the default
>> allocation bin" case here...
>> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Mem/Page.c#L1281
>>

This piece is fine if it doesn't hit the normal memory bin, it will
still get the type converted in the call to CoreConvertPages. I agree
with Leif that AllocateRuntimeZeroPool should not be returning the
memory if anything failed; what I would recommend is adding some prints
or using a debugger to tell if the memory is getting the correct type
on that allocate call and then checking if it is getting freed later
by some entity.

Oliver



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120871): https://edk2.groups.io/g/devel/message/120871
Mute This Topic: https://groups.io/mt/109918571/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* 回复: [edk2-devel] [edk2-discuss] Attempted runtime pool allocation returns non-runtime pool
  2024-12-04 15:39   ` Oliver Smith-Denny via groups.io
@ 2024-12-05  1:31     ` gaoliming via groups.io
  0 siblings, 0 replies; 3+ messages in thread
From: gaoliming via groups.io @ 2024-12-05  1:31 UTC (permalink / raw)
  To: devel, osde, leif.lindholm, discuss, adwags

Adam:
  Coud you show the code and boot log for this problem? How do you verify whether the allocated memory space is runtime memory?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Oliver
> Smith-Denny via groups.io
> 发送时间: 2024年12月4日 23:40
> 收件人: devel@edk2.groups.io; leif.lindholm@oss.qualcomm.com;
> discuss@edk2.groups.io; adwags@gmail.com
> 主题: Re: [edk2-devel] [edk2-discuss] Attempted runtime pool allocation
> returns non-runtime pool
> 
> Hi Adam,
> 
> > On Wed, 4 Dec 2024 at 04:21, Adam Wagner via groups.io
> > <adwags=gmail.com@groups.io> wrote:
> >>
> >> Hello,
> >>
> >> I have a DXE runtime driver that is attempting to allocate runtime pool
> >> (via AllocateRuntimeZeroPool). I'm getting back a non-NULL pointer, but it
> >> isn't in the runtime memory map so ConvertPointer fails later. It looks
> >> like the returned address is in a memory region of "conventional" type
> >> which if I understand correctly is where free memory lives?
> >>
> >> I think I may be hitting the "Attempt to find free pages in the default
> >> allocation bin" case here...
> >>
> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/
> Mem/Page.c#L1281
> >>
> 
> This piece is fine if it doesn't hit the normal memory bin, it will
> still get the type converted in the call to CoreConvertPages. I agree
> with Leif that AllocateRuntimeZeroPool should not be returning the
> memory if anything failed; what I would recommend is adding some prints
> or using a debugger to tell if the memory is getting the correct type
> on that allocate call and then checking if it is getting freed later
> by some entity.
> 
> Oliver
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120877): https://edk2.groups.io/g/devel/message/120877
Mute This Topic: https://groups.io/mt/109932354/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-05  1:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAB8Y2ryo86XH2s=avss4s4nC8sp68rWv1NsnJHqv+qvxGWEkuA@mail.gmail.com>
2024-12-04 12:31 ` [edk2-devel] [edk2-discuss] Attempted runtime pool allocation returns non-runtime pool Leif Lindholm via groups.io
2024-12-04 15:39   ` Oliver Smith-Denny via groups.io
2024-12-05  1:31     ` 回复: " gaoliming via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox