On Thu, Jan 03, 2008 at 05:08:23PM +0100, Geert Uytterhoeven wrote:
> I think he means how to handle the following from include/linux/gfp.h in
> valgrind:
> 
>     struct page *alloc_pages(gfp_t gfp_mask, unsigned int order);
>     unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
> 
>     void __free_pages(struct page *page, unsigned int order);
>     void free_pages(unsigned long addr, unsigned int order);

Oh yeah, good point.

The unsigned long ones are easy - they are addresses disguised as
numbers.

You have to tell valgrind somehow that the object size is
        (1 << order) * PAGE_SIZE

About the struct page ones - I see two possibilities.

1 - You communicate to valgrind somehow that there is a mapping
between the page struct and the virtual address it represents.  There
is a is no page_to_virt (although there is a virt_to_page), but one
would be easy to add.  For UML, it amounts to
        uml_physmem + (page - mem_map) * PAGE_SIZE

2 - You can insist that UML defines WANT_PAGE_VIRTUAL which, if I'm
reading the code correctly, will set page->virtual to the address
represented by the page.  Valgrind then somehow has to know how to
reach into the page struct and get the address.

                                Jeff

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to