From: "Jan Beulich" Subject: Re: x86-64 machine_to_phys vs NX bit Date: Fri, 25 Aug 2006 15:11:27 +0200 Message-ID: <44EF131F.76E4.0078.0@novell.com> References: <44EDFD15.4030900@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , Rik van Riel Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> Keir Fraser 25.08.06 09:32 >>> >On 24/8/06 8:25 pm, "Rik van Riel" wrote: > >> Say, something like the following? >> >> - paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT); >> + paddr_t phys = mfn_to_pfn((machine >> PAGE_SHIFT) & PHYSICAL_MASK); >> >> I'm still thinking I may have missed something in the code >> somewhere, but I've been looking at this for over an hour now >> and can't seem to find it... >> >> Any ideas? > >Your suggested patch looks reasonable but it'd be good to find out why this I'd suggest not changing machine_to_phys(), but its callers (where needed), in order to prevent hiding errors. >hasn't caused us problems. For example, perhaps supported_pte_mask doesn't >include PAGE_NX, so we're never setting the NX bit on 64-bit PTEs? That must __supported_pte_mask is all ones on a system I just checked this on; pte_val() for a page with _PAGE_NX set indeed returns (end_pfn << PAGE_SHIFT) | prot_flags. With that I guess there are just too few pages making use of _PAGE_NX yet, so the problem went unnoticed so far. >be worth checking out, possibly also tracing machine_to_phys to find out >where that bit 63 goes -- I agree that it looks like mfn_to_pfn() shouldn#t >work if bit63 is set in the 'maddr' argument. Jan