From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757889AbbAIPKw (ORCPT ); Fri, 9 Jan 2015 10:10:52 -0500 Received: from smtp.citrix.com ([66.165.176.89]:17505 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753053AbbAIPKv (ORCPT ); Fri, 9 Jan 2015 10:10:51 -0500 X-IronPort-AV: E=Sophos;i="5.07,731,1413244800"; d="scan'208";a="213382684" Message-ID: <54AFEF78.8050603@citrix.com> Date: Fri, 9 Jan 2015 15:10:48 +0000 From: David Vrabel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.2.0 MIME-Version: 1.0 To: Jan Beulich , David Vrabel , Juergen Gross CC: xen-devel , , Subject: Re: [Xen-devel] [PATCH 3/3] xen: use correct type for physical addresses References: <1420736490-15351-1-git-send-email-jgross@suse.com> <1420736490-15351-4-git-send-email-jgross@suse.com> <54AFB410020000780005306E@mail.emea.novell.com> <54AFCED7.7040407@citrix.com> <54AFDE2B0200007800053248@mail.emea.novell.com> In-Reply-To: <54AFDE2B0200007800053248@mail.emea.novell.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/01/15 12:56, Jan Beulich wrote: >>>> On 09.01.15 at 13:51, wrote: >> On 09/01/15 09:57, Jan Beulich wrote: >>>>>> On 08.01.15 at 18:01, wrote: >>>> @@ -284,7 +286,7 @@ static void __init xen_update_mem_tables(unsigned long pfn, unsigned long mfn) >>>> } >>>> >>>> /* Update kernel mapping, but not for highmem. */ >>>> - if ((pfn << PAGE_SHIFT) >= __pa(high_memory)) >>>> + if (PFN_PHYS(pfn) >= (u64)(__pa(high_memory))) >>> >>> I don't think you really need the cast on the right side - __pa() >>> should be returning a value of suitable type (and unsigned long >>> would be sufficient for anything up to and including high_memory). >> >> I'd prefer: >> >> if (pfn >= PFN_DOWN(__pa(high_memory)) > > Even better indeed. Just one more point: Strictly speaking > __pa(high_memory) is invalid, as __pa() is defined for low > memory only. Hence perhaps PFN_UP(__pa(high_memory - 1))? Yes. David From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 3/3] xen: use correct type for physical addresses Date: Fri, 9 Jan 2015 15:10:48 +0000 Message-ID: <54AFEF78.8050603@citrix.com> References: <1420736490-15351-1-git-send-email-jgross@suse.com> <1420736490-15351-4-git-send-email-jgross@suse.com> <54AFB410020000780005306E@mail.emea.novell.com> <54AFCED7.7040407@citrix.com> <54AFDE2B0200007800053248@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y9bDB-0003o7-4M for xen-devel@lists.xenproject.org; Fri, 09 Jan 2015 15:10:53 +0000 In-Reply-To: <54AFDE2B0200007800053248@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , David Vrabel , Juergen Gross Cc: xen-devel , boris.ostrovsky@oracle.com, linux-kernel@vger.kernel.org List-Id: xen-devel@lists.xenproject.org On 09/01/15 12:56, Jan Beulich wrote: >>>> On 09.01.15 at 13:51, wrote: >> On 09/01/15 09:57, Jan Beulich wrote: >>>>>> On 08.01.15 at 18:01, wrote: >>>> @@ -284,7 +286,7 @@ static void __init xen_update_mem_tables(unsigned long pfn, unsigned long mfn) >>>> } >>>> >>>> /* Update kernel mapping, but not for highmem. */ >>>> - if ((pfn << PAGE_SHIFT) >= __pa(high_memory)) >>>> + if (PFN_PHYS(pfn) >= (u64)(__pa(high_memory))) >>> >>> I don't think you really need the cast on the right side - __pa() >>> should be returning a value of suitable type (and unsigned long >>> would be sufficient for anything up to and including high_memory). >> >> I'd prefer: >> >> if (pfn >= PFN_DOWN(__pa(high_memory)) > > Even better indeed. Just one more point: Strictly speaking > __pa(high_memory) is invalid, as __pa() is defined for low > memory only. Hence perhaps PFN_UP(__pa(high_memory - 1))? Yes. David