asad raza
2012-Dec-10 14:02 UTC
why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
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); }
Ian Campbell
2012-Dec-10 15:06 UTC
Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
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
Stefano Stabellini
2012-Dec-10 15:08 UTC
Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
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
Mats Petersson
2012-Dec-10 15:15 UTC
Re: why we need to convert "mfn_to_page(smfn)" in page_alloc.c?
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 > >