From: "H. Peter Anvin" Subject: Re: [PATCH] paravirt/xen: add pvop for page_is_ram Date: Tue, 10 Mar 2009 15:21:31 -0700 Message-ID: <49B6E7EB.2040009@zytor.com> References: <1235786365-17744-1-git-send-email-jeremy@goop.org> <1235786365-17744-10-git-send-email-jeremy@goop.org> <49B5BD63.1090909@zytor.com> <49B6D94F.9070902@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <49B6D94F.9070902@goop.org> Sender: linux-kernel-owner@vger.kernel.org To: Jeremy Fitzhardinge Cc: the arch/x86 maintainers , Linux Kernel Mailing List , Xen-devel , Jeremy Fitzhardinge List-Id: xen-devel@lists.xenproject.org Jeremy Fitzhardinge wrote: >> >> Why are these pages mapped as RAM in the memory map? That is the right >> way to handle that, not by adding yet another bloody hook... >> > Granted pages can turn up anywhere dynamically, since they're pages > borrowed from other domains for the purposes of IO. They're not static > regions of non-RAM like the other cases page_is_ram() tests for, > > They can't be mapped via normal pte operations (because they have > additional state associated with them, like the grant handle), so > /dev/mem can't just create an aliased mapping by copying the pte. > > page_is_ram is used to: > > 1. prevent /dev/mem from mapping non-RAM pages > 2. prevent ioremap from mapping any RAM pages > 3. testing for RAMness in PAT > > 3) isn't yet relevant to Xen; ioremap can't map granted pages either, so > 2) isn't terribly relevent, so the main motivation for this patch is > 1). This allows us to reject usermode attempts to map granted pages, > rather than oopsing (as a failed set_pte will raise a page fault). > > So, more cosmetic than essential, but I don't see a better way to > implement this functionality if its to be there at all. > OK, that is a valid usage case and I agree about repurposing the existing interface. However, it is also a definition change in the interface, so it really should be renamed first. Would you be willing to break this patch up into one which renames the interface and then a second which adds the pv hook? -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.