From: Keir Fraser Subject: Re: Odd mapping behavior with map_pages_to_xen Date: Thu, 16 Mar 2006 14:53:46 +0000 Message-ID: <4f5403f2a706a97a8b0ef6329d417c81@cl.cam.ac.uk> References: <4419751D.1070404@cs.aau.dk> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4419751D.1070404@cs.aau.dk> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Arne Mejlholm Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 16 Mar 2006, at 14:24, Arne Mejlholm wrote: > Perhaps it should be noted that step 2 is carried out from within the > idle_loop. Although it seems safe to > exploit this idle state, could there be some assumptions that does not > hold? Could it be that for reasons not > evident to me, mapping pages into Xen during this idle time, is a bad > idea and not safe? > > About mapping pages into Xen, if I understand it correctly, Xen's 64MB > address space is mapped into every > page table for every process in every domain, so the virtual address > allocated in step 1 should be accessible > in any context. Is this not the case? Unfortunately you'll only be modifying the idle page table mappings. So if you are running on someone else's tables then you won't see the new mapping. This can easily happen even in the idle loop, because we lazily switch pagetables. In fact, it would work if the xen heap were mapped with 4kB pages, but by default we map with 4MB superpages. So when you change a single 4kB mapping the superpage mapping needs replacing with a mapping of a new pagetable in the idle pgdir, and that update isn;t reflected in the current running pagetables. If you build Xen with 'debug=y' option then I expect you'll find your code works fine. :-) -- Keir