Hugh Dickins wrote:
On Thu, 16 Mar 2006, Nick Piggin wrote:How about the case where one wants to map pages from dma_alloc_coherent() into userspace? It seems one should do get_page() in .nopage, and then the driver can do dma_free_coherent() when the vma is released.I think so, provided you set VM_IO on the vma. You need VM_IO to ensure that get_user_pages callers can't hijack your page's lifetime rulesOnce __GFP_COMP is passed to the dma_alloc_coherent, as it needs to be (unless going VM_PFNMAP), get_user_pages will be safe: no need for VM_IO.
But it doesn't look like dma_alloc_coherent is guaranteed to return memory allocated from the regular page allocator, nor even memory backed by a struct page. For example, I see one that returns kmalloc()ed memory. If the pages for the slab are already allocated then __GFP_COMP will not do anything there. i386 looks like it has a path that uses ioremap... Now I haven't looked through all these closely like you will have, but I'd like to know how __GFP_COMP solves all the potential problems I see. -- SUSE Labs, Novell Inc.Send instant messages to your online friends http://au.messenger.yahoo.com -
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Hugh Dickins <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- References:
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Andrew Morton <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Andrew Morton <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: "Bryan O'Sullivan" <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Andrew Morton <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Roland Dreier <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Nick Piggin <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- From: Hugh Dickins <[email protected]>
- Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- Prev by Date: Re: [patch] mspec - special memory driver and do_no_pfn handler
- Next by Date: Re: [PATCH] (-mm) drivers/pci/msi: explicit declaration of msi_register
- Previous by thread: Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- Next by thread: Re: [PATCH 10 of 20] ipath - support for userspace apps using core driver
- Index(es):