Hi, Can someone please explain the function set_pte_at to me? In particular, I''m trying to understand the page fault handling in a PV 64-bit Linux. Here''s the sequence that I trace: 1) The Linux page fault handler at linux-2.6.18-xen.hg/mm/ memory.c:do_no_page runs. 2) After getting the page in memory, it calls set_pte_at. 3) set_pte_at has the following definition: #define set_pte_at(_mm,addr,ptep,pteval) do { if (((_mm) != current->mm && (_mm) != &init_mm) || \ HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \ set_pte((ptep), (pteval)); \ In the case of a page fault, I think _mm will be equal to init_mm. As a result, the first if condition fails, and we end up calling HYPERVISOR_update_va_mapping. If that succeeds, then we''re done. Otherwise, we call set_pte which just sets the PTE directly. Since in PV Linux, page tables don''t have writeable mappings, this write causes an instruction fault and Xen''s ptwr_emulated_update tries to perform the page table update. So here are my questions: 1) What is the purpose of the first if condition ((_mm) != current->mm && (_mm) != &init_mm)? If the fault happens in a kernel virtual memory context, why do we always want to call set_pte? Why don''t we just call HYPERVISOR_update_va_mapping? Does ptwr_emulated_update handle a larger subset of the page table updates logic than HYPERVISOR_update_va_mapping? 2) On a related note, if we do call HYPERVISOR_update_va_mapping and it fails, why do we retry the page table update through ptwr_emulated_update? Thanks! Mike _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel