public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* __pa() versus virt_to_phys()
@ 2006-07-06 16:41 moreau francis
  2006-07-06 17:05 ` Jiri Slaby
  2006-07-06 17:58 ` Lukas Jelinek
  0 siblings, 2 replies; 3+ messages in thread
From: moreau francis @ 2006-07-06 16:41 UTC (permalink / raw)
  To: linux-kernel

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __pa() versus virt_to_phys()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2006-07-06 17:05 UTC (permalink / raw)
  To: moreau francis; +Cc: linux-kernel

moreau francis napsal(a):
> Could anybody tell me the difference between these two symbols ?

Google should.

regards,
-- 
Jiri Slaby        www.fi.muni.cz/~xslaby/
\_.-^-._   jirislaby@gmail.com   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E
<a href="http://www.fi.muni.cz/~xslaby/">Jiri Slaby</a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: __pa() versus virt_to_phys()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Lukas Jelinek @ 2006-07-06 17:58 UTC (permalink / raw)
  To: moreau francis; +Cc: linux-kernel

> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-06 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox