- really only do the invalid PAE PTE fixup on write to the high part - dump guest execution state when emulation fails - use the passed in register pointer rather than re-calculating guest_cpu_user_regs() Signed-off-by: Jan Beulich <jbeulich@novell.com> Index: 2007-01-08/xen/arch/x86/mm.c ==================================================================--- 2007-01-08.orig/xen/arch/x86/mm.c 2007-01-12 17:25:55.000000000 +0100 +++ 2007-01-08/xen/arch/x86/mm.c 2007-01-16 08:53:59.000000000 +0100 @@ -3237,22 +3237,25 @@ static int ptwr_emulated_update( { if ( (CONFIG_PAGING_LEVELS == 3 || IS_COMPAT(d)) && (bytes == 4) && + (addr & 4) && !do_cmpxchg && (l1e_get_flags(nl1e) & _PAGE_PRESENT) ) { /* - * If this is a half-write to a PAE PTE then we assume that the - * guest has simply got the two writes the wrong way round. We - * zap the PRESENT bit on the assumption the bottom half will be - * written immediately after we return to the guest. + * If this is an upper half write to a PAE PTE then we assume + * that the guest has simply got the two writes the wrong way + * round. We zap the PRESENT bit on the assumption the bottom + * half will be written immediately after we return to the guest. */ MEM_LOG("ptwr_emulate: fixing up invalid PAE PTE %"PRIpte, l1e_get_intpte(nl1e)); + show_execution_state(ptwr_ctxt->ctxt.regs); l1e_remove_flags(nl1e, _PAGE_PRESENT); } else { MEM_LOG("ptwr_emulate: could not get_page_from_l1e()"); + show_execution_state(ptwr_ctxt->ctxt.regs); return X86EMUL_UNHANDLEABLE; } } @@ -3375,7 +3378,8 @@ int ptwr_do_page_fault(struct vcpu *v, u (page_get_owner(page) != d) ) goto bail; - ptwr_ctxt.ctxt.regs = guest_cpu_user_regs(); + ASSERT(regs = guest_cpu_user_regs()); + ptwr_ctxt.ctxt.regs = regs; ptwr_ctxt.ctxt.addr_size = ptwr_ctxt.ctxt.sp_size IS_COMPAT(d) ? 32 : BITS_PER_LONG; ptwr_ctxt.cr2 = addr; _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 16/1/07 12:40 pm, "Jan Beulich" <jbeulich@novell.com> wrote:> - really only do the invalid PAE PTE fixup on write to the high partOkay. We could theoretically get failures the other way round too I should think but clearly the existing code doesn''t handle that properly (since it''ll lose the PAGE_PRESENT forever) so it can''t be something we''ve seen in practise. This clarification and extra check makes sense.> - dump guest execution state when emulation failsWe can''t put anything more than XENLOG_G_WARNING on a path that a guest can exercise at will. One option is to make show_execution_state (and hence all underlying state-dump functions) take the dump log level as a parameter.> - use the passed in register pointer rather than re-calculating > guest_cpu_user_regs()The assertion is broken and anyway really a bit overkill imo. Using regs rather than guest_cpu_user_regs() makes sense. -- Keir> Signed-off-by: Jan Beulich <jbeulich@novell.com>_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>> - dump guest execution state when emulation fails > >We can''t put anything more than XENLOG_G_WARNING on a path that a guest can >exercise at will. One option is to make show_execution_state (and hence all >underlying state-dump functions) take the dump log level as a parameter.Oh, understood. I''m not insisting on this part. It just helped me in debugging.>> - use the passed in register pointer rather than re-calculating >> guest_cpu_user_regs() > >The assertion is broken and anyway really a bit overkill imo. Using regs >rather than guest_cpu_user_regs() makes sense.While I don''t understand why it''s broken (I just added it to check in debug builds that the value now used matches the one previously used), but I''m fully with you to remove it if you agree that using the function parameter is okay. Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel