Re: Will __pa(vmalloc()) ever work?

From: Brian Gerst
Date: Tue May 31 2005 - 15:48:14 EST


Timur Tabi wrote:
Gerd Knorr wrote:

Can you fix that? If so, try that. Would be the best.


No, I cannot. The memory is passed to my driver from some other driver that I do not
control.

What kind of driver are you writing, and what other driver is giving you this address?

I think you can't. What is "anywhere else"? Does that include
userspace addresses?

No, but it might include the stack.

Not sure how portable that is, but comparing the vaddr against
the vmalloc address space could work. There are macros for
that, VMALLOC_START & VMALLOC_END IIRC.


Thanks, I'll try that.

I still haven't gotten an answer to my question about whether pgd/pud/pmd/pte_offset will obtain the physical address for a kmalloc'd buffer.

Walking the page tables isn't guaranteed to work for all addresses on all arches. On some you have to deal with large pages, on others you have parts of the address space that are mapped by different mechanisms. This isn't something that drivers should be getting involved in.

--
Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/