Re: [patch] bootmem-2.3.25-A0

Linus Torvalds (torvalds@transmeta.com)
Wed, 3 Nov 1999 09:07:31 -0800 (PST)


On Wed, 3 Nov 1999, Ingo Molnar wrote:
>
> i've fixed this already in my tree (patch attached) - but i do not think
> this should make any difference. bootmem.c does not deal with vmalloced or
> ioremapped memory, so __pa/__va should be identical to virt_to_phys /
> phys_to_virt.

NONE of virt_to_phys/phys_to_virt/__pa/__va should EVER know about vmalloc
or ioremap.

virt_to_phys() is IDENTICAL with __va(), except for the fact that
(a) __va is not supposed to be used by anything but internal header files
as a shorthand to handle the common cases where virt_to_phys nd
virt_to_bus() etc are all the same.
(b) __va does no argument type checking and may re-use the argument
multiple times (exactly because of (a)).

You should never EVER use __va/__pa in any real code. I'm inclined to
remove it, just because of the confusion.

And stop this confusion about virtual mappings. ioremap/vmalloc have
nothing at all to do with this. You cannot get the physical mapping of a
virtual mapping done that way - a driver (who is the only one that should
care) should have just remembered what the mapping was all about on its
ownand what it maps, not try to figure it out later.

It seems that the m68k port does some strange magic for some strange m68k
architecture, and that's their problem (probably because the code is from
before the PageSkip thing to handle discontiguous memory architectures).
It's not an excuse for using __pa/__va anywhere.

Linus

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