All of lore.kernel.org
 help / color / mirror / Atom feed
* why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
@ 2012-12-10 14:02 asad raza
  2012-12-10 15:06 ` Ian Campbell
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: asad raza @ 2012-12-10 14:02 UTC (permalink / raw)
  To: xen-devel

void init_domheap_pages(paddr_t ps, paddr_t pe)
{
    unsigned long smfn, emfn;

    ASSERT(!in_irq());

    smfn = round_pgup(ps) >> PAGE_SHIFT;
    emfn = round_pgdown(pe) >> PAGE_SHIFT;

    init_heap_pages(mfn_to_page(smfn), emfn - smfn);
}

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

* Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
  2012-12-10 14:02 why we need to convert "mfn_to_page(smfn)" in page_alloc.c? asad raza
@ 2012-12-10 15:06 ` Ian Campbell
  2012-12-10 15:08 ` Stefano Stabellini
  2012-12-10 15:15 ` Mats Petersson
  2 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2012-12-10 15:06 UTC (permalink / raw)
  To: asad raza; +Cc: xen-devel

Once again please read
http://wiki.xen.org/wiki/Asking_Xen_Devel_Questions

I'm afraid that very few people are going to be able to spend the time
spoon-feeding you through the code without some indication as to why
they should invest that time in you.

Ian.

On Mon, 2012-12-10 at 14:02 +0000, asad raza wrote:
> void init_domheap_pages(paddr_t ps, paddr_t pe)
> {
>     unsigned long smfn, emfn;
> 
>     ASSERT(!in_irq());
> 
>     smfn = round_pgup(ps) >> PAGE_SHIFT;
>     emfn = round_pgdown(pe) >> PAGE_SHIFT;
> 
>     init_heap_pages(mfn_to_page(smfn), emfn - smfn);
> }
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
  2012-12-10 14:02 why we need to convert "mfn_to_page(smfn)" in page_alloc.c? asad raza
  2012-12-10 15:06 ` Ian Campbell
@ 2012-12-10 15:08 ` Stefano Stabellini
  2012-12-10 15:15 ` Mats Petersson
  2 siblings, 0 replies; 4+ messages in thread
From: Stefano Stabellini @ 2012-12-10 15:08 UTC (permalink / raw)
  To: asad raza; +Cc: xen-devel

On Mon, 10 Dec 2012, asad raza wrote:
> void init_domheap_pages(paddr_t ps, paddr_t pe)
> {
>     unsigned long smfn, emfn;
> 
>     ASSERT(!in_irq());
> 
>     smfn = round_pgup(ps) >> PAGE_SHIFT;
>     emfn = round_pgdown(pe) >> PAGE_SHIFT;
> 
>     init_heap_pages(mfn_to_page(smfn), emfn - smfn);
> }

if you look the definition of init_heap_pages and mfn_to_page:

void init_heap_pages(struct page_info *pg, unsigned long nr_pages)
#define mfn_to_page(mfn)  (frame_table + (pfn_to_pdx(mfn) - frametable_base_mfn))

you should be able to understand why we need to call mfn_to_page

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

* Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
  2012-12-10 14:02 why we need to convert "mfn_to_page(smfn)" in page_alloc.c? asad raza
  2012-12-10 15:06 ` Ian Campbell
  2012-12-10 15:08 ` Stefano Stabellini
@ 2012-12-10 15:15 ` Mats Petersson
  2 siblings, 0 replies; 4+ messages in thread
From: Mats Petersson @ 2012-12-10 15:15 UTC (permalink / raw)
  To: xen-devel

On 10/12/12 14:02, asad raza wrote:
> void init_domheap_pages(paddr_t ps, paddr_t pe)
> {
>      unsigned long smfn, emfn;
>
>      ASSERT(!in_irq());
>
>      smfn = round_pgup(ps) >> PAGE_SHIFT;
>      emfn = round_pgdown(pe) >> PAGE_SHIFT;
>
>      init_heap_pages(mfn_to_page(smfn), emfn - smfn);
> }
Becasue "init_heap_pages" takes struct page_info, rather than a page 
number?

The init_heap_pages does convert the start page to a mfn, but not all 
callers of init_heap_pages has a mfn in the first place, so I gues it's 
just "we have to do this anyways.

--
Mats
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
>

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

end of thread, other threads:[~2012-12-10 15:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-10 14:02 why we need to convert "mfn_to_page(smfn)" in page_alloc.c? asad raza
2012-12-10 15:06 ` Ian Campbell
2012-12-10 15:08 ` Stefano Stabellini
2012-12-10 15:15 ` Mats Petersson

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.