From: Lukas Jelinek <info@kernel-api.org>
To: moreau francis <francis_moreau2000@yahoo.fr>
Cc: linux-kernel@vger.kernel.org
Subject: Re: __pa() versus virt_to_phys()
Date: Thu, 06 Jul 2006 19:58:12 +0200 [thread overview]
Message-ID: <44AD4F34.1080307@kernel-api.org> (raw)
In-Reply-To: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com>
> Could anybody tell me the difference between these two symbols ?
>
> I know that one is a macro and the other one is an inline function,
> so the latter performs type checkings but I don't see anything else.
>
> thanks
>
> Francis
>
Here is the answer (by Dave Hansen, 2004):
__pa() is simply supposed to be the addr-PAGE_OFFSET calculation.
virt_to_phys() will be guaranteed to take care of any layout changes if
kernel addresses ever fail to be mapped flat, and 1:1 with the physical
address layout.
So, let's say that someone is working on ... say ... memory hotplug.
They will be modifying the virt_to_phys() function to make up for any
weird mappings that are going on. But, they'll leave __{v,p}a alone,
because those are used for stuff that occurs very early, even at compile
time.
More virt_to_phys() and less __pa() will save me lots of auditing later
on :) If you're not in early boot, or really know what you're doing,
use virt_to_phys() and cousins.
Plus, it's more type safe.
Lukas Jelinek
prev parent reply other threads:[~2006-07-06 17:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-06 16:41 __pa() versus virt_to_phys() moreau francis
2006-07-06 17:05 ` Jiri Slaby
2006-07-06 17:58 ` Lukas Jelinek [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44AD4F34.1080307@kernel-api.org \
--to=info@kernel-api.org \
--cc=francis_moreau2000@yahoo.fr \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox