From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965109AbWGFQlJ (ORCPT ); Thu, 6 Jul 2006 12:41:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965160AbWGFQlJ (ORCPT ); Thu, 6 Jul 2006 12:41:09 -0400 Received: from web25806.mail.ukl.yahoo.com ([217.12.10.191]:30094 "HELO web25806.mail.ukl.yahoo.com") by vger.kernel.org with SMTP id S965109AbWGFQlI (ORCPT ); Thu, 6 Jul 2006 12:41:08 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=Message-ID:Received:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=S+vSasONZaA41tpCkskCcz/KNdnV4VAWZLNO9DM/5PwS3GTmj0HZX3u1caAP/sOYSzwJ/FlLyC4lyub9RF3Dz/TeU7TKoZfoObGkrf0OLDl9yZGsf9tUieEg43peiEfZIa0zTxyVpzEscMm4wYqTc8tjg0k2tA8DmPYTYnh765I= ; Message-ID: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com> Date: Thu, 6 Jul 2006 16:41:07 +0000 (GMT) From: moreau francis Reply-To: moreau francis Subject: __pa() versus virt_to_phys() To: linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030292AbWGFRFI (ORCPT ); Thu, 6 Jul 2006 13:05:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965197AbWGFRFI (ORCPT ); Thu, 6 Jul 2006 13:05:08 -0400 Received: from nf-out-0910.google.com ([64.233.182.184]:26270 "EHLO nf-out-0910.google.com") by vger.kernel.org with ESMTP id S965160AbWGFRFG (ORCPT ); Thu, 6 Jul 2006 13:05:06 -0400 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=C3SEHnhLOKU2ft/2Ys6koGgu1obFXZOn5TGu3Jpw8PZJ2aReM8dwXoeM/ntXTa+n25kuVOMiebgcL5EgVLNLg0plPslkewk8yW2KZIMHxbLeyesxZ4QNZKS+ASwpB3DpWyInx8vv6ol0y1nkUQhnu9iaDA3Qr4uc9kD6RhCPaak= Message-ID: <44AD42D0.9000506@gmail.com> Date: Thu, 06 Jul 2006 19:04:57 +0159 From: Jiri Slaby User-Agent: Thunderbird 1.5.0.4 (X11/20060613) MIME-Version: 1.0 To: moreau francis CC: linux-kernel@vger.kernel.org Subject: Re: __pa() versus virt_to_phys() References: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com> In-Reply-To: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org 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 Jiri Slaby From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030374AbWGFR6O (ORCPT ); Thu, 6 Jul 2006 13:58:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030375AbWGFR6O (ORCPT ); Thu, 6 Jul 2006 13:58:14 -0400 Received: from unn-206.superhosting.cz ([82.208.4.206]:5019 "EHLO mail.aiken.cz") by vger.kernel.org with ESMTP id S1030374AbWGFR6O (ORCPT ); Thu, 6 Jul 2006 13:58:14 -0400 Message-ID: <44AD4F34.1080307@kernel-api.org> Date: Thu, 06 Jul 2006 19:58:12 +0200 From: Lukas Jelinek User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; cs-CZ; rv:1.7.12) Gecko/20050915 X-Accept-Language: cs, en-us, en MIME-Version: 1.0 To: moreau francis CC: linux-kernel@vger.kernel.org Subject: Re: __pa() versus virt_to_phys() References: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com> In-Reply-To: <20060706164107.89250.qmail@web25806.mail.ukl.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org > 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