All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about next_module() function
@ 2016-09-24  0:36 조현권
  2016-10-04 17:51 ` Julien Grall
  0 siblings, 1 reply; 2+ messages in thread
From: 조현권 @ 2016-09-24  0:36 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1202 bytes --]

Hi

I am experimenting Xen with my embedded system environment and got a
question in next_module() function.

*static paddr_t __init next_module(paddr_t s, paddr_t *end)*
*{*
*    struct bootmodules *mi = &bootinfo.modules;*
*    paddr_t lowest = ~(paddr_t)0;*
*    int i;*

*    for ( i = 0; i < mi->nr_mods; i++ )*
*    {*
*        paddr_t mod_s = mi->module[i].start;*
*        paddr_t mod_e = mod_s + mi->module[i].size;*

*        if ( !mi->module[i].size )*
*            continue;*

*        if ( mod_s < s )*
*            continue;*
*        if ( mod_s > lowest )*
*            continue;*
*        if ( mod_s > *end )*
*            continue;*
*        lowest = mod_s;*
*        *end = min(*end, mod_e);*
*    }*
*    return lowest;*
*}*

The job of next_module() function is excluding module exist RAM range
between s and *end and finding empty space which can be heap space.

But Its function does not work if module range is bigger than s and *end
range.
(Case when module range is mod_s <= s and mod_e >= *end)

*        if ( mod_s < s )*
*            continue;*

Above condition passes the case and xen consider range s and *end is free
space.

Is it expected result or mistake?

Thank you.

[-- Attachment #1.2: Type: text/html, Size: 1984 bytes --]

[-- Attachment #2: Type: text/plain, Size: 127 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

* Re: Question about next_module() function
  2016-09-24  0:36 Question about next_module() function 조현권
@ 2016-10-04 17:51 ` Julien Grall
  0 siblings, 0 replies; 2+ messages in thread
From: Julien Grall @ 2016-10-04 17:51 UTC (permalink / raw)
  To: 조현권, xen-devel; +Cc: Stefano Stabellini

On 23/09/2016 17:36, 조현권 wrote:
> Hi

Hello,

Sorry for the late reply.

> I am experimenting Xen with my embedded system environment and got a
> question in next_module() function.
> /
> /
> /static paddr_t __init next_module(paddr_t s, paddr_t *end)/
> /{/
> /    struct bootmodules *mi = &bootinfo.modules;/
> /    paddr_t lowest = ~(paddr_t)0;/
> /    int i;/
> /
> /
> /    for ( i = 0; i < mi->nr_mods; i++ )/
> /    {/
> /        paddr_t mod_s = mi->module[i].start;/
> /        paddr_t mod_e = mod_s + mi->module[i].size;/
> /
> /
> /        if ( !mi->module[i].size )/
> /            continue;/
> /
> /
> /        if ( mod_s < s )/
> /            continue;/
> /        if ( mod_s > lowest )/
> /            continue;/
> /        if ( mod_s > *end )/
> /            continue;/
> /        lowest = mod_s;/
> /        *end = min(*end, mod_e);/
> /    }/
> /    return lowest;/
> /}/
>
> The job of next_module() function is excluding module exist RAM range
> between s and *end and finding empty space which can be heap space.
>
> But Its function does not work if module range is bigger than s and *end
> range.
> (Case when module range is mod_s <= s and mod_e >= *end)
>
> /        if ( mod_s < s )/
> /            continue;/
> /
> /
> Above condition passes the case and xen consider range s and *end is
> free space.
>
> Is it expected result or mistake?

The code is assuming that the module will always fit in a bank. I am not 
sure why you would want to have the module crossing the boundary between 
2 banks.

Can you provide the list of banks and the position of the modules?

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-10-04 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-24  0:36 Question about next_module() function 조현권
2016-10-04 17:51 ` Julien Grall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.