[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/shadow: Introduce sh_trace_gl1e_va()
commit 578066d82b2b96e949ff46e6c142a33231b1ae2d Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Wed May 22 13:58:22 2024 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon Jun 24 16:22:59 2024 +0100 x86/shadow: Introduce sh_trace_gl1e_va() trace_shadow_fixup() and trace_not_shadow_fault() both write out identical trace records. Reimplement them in terms of a common sh_trace_gl1e_va(). No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> --- xen/arch/x86/mm/shadow/multi.c | 57 ++++++++++++------------------------------ 1 file changed, 16 insertions(+), 41 deletions(-) diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index 1775952d7e..75250c6f0f 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -1987,51 +1987,26 @@ static void sh_trace_va(uint32_t event, guest_va_t va) sh_trace(event, sizeof(va), &va); } -static inline void trace_shadow_fixup(guest_l1e_t gl1e, - guest_va_t va) +/* Shadow trace event with a gl1e, linear address and flags. */ +static void sh_trace_gl1e_va(uint32_t event, guest_l1e_t gl1e, guest_va_t va) { if ( tb_init_done ) { struct __packed { - /* for PAE, guest_l1e may be 64 while guest_va may be 32; - so put it first for alignment sake. */ - guest_l1e_t gl1e; - guest_va_t va; - u32 flags; - } d; - u32 event; - - event = TRC_SHADOW_FIXUP | ((GUEST_PAGING_LEVELS-2)<<8); - - d.gl1e = gl1e; - d.va = va; - d.flags = this_cpu(trace_shadow_path_flags); - - trace(event, sizeof(d), &d); - } -} - -static inline void trace_not_shadow_fault(guest_l1e_t gl1e, - guest_va_t va) -{ - if ( tb_init_done ) - { - struct __packed { - /* for PAE, guest_l1e may be 64 while guest_va may be 32; - so put it first for alignment sake. */ + /* + * For GUEST_PAGING_LEVELS=3 (PAE paging), guest_l1e is 64 while + * guest_va is 32. Put it first to avoid padding. + */ guest_l1e_t gl1e; guest_va_t va; - u32 flags; - } d; - u32 event; - - event = TRC_SHADOW_NOT_SHADOW | ((GUEST_PAGING_LEVELS-2)<<8); - - d.gl1e = gl1e; - d.va = va; - d.flags = this_cpu(trace_shadow_path_flags); - - trace(event, sizeof(d), &d); + uint32_t flags; + } d = { + .gl1e = gl1e, + .va = va, + .flags = this_cpu(trace_shadow_path_flags), + }; + + sh_trace(event, sizeof(d), &d); } } @@ -2603,7 +2578,7 @@ static int cf_check sh_page_fault( d->arch.paging.log_dirty.fault_count++; sh_reset_early_unshadow(v); - trace_shadow_fixup(gw.l1e, va); + sh_trace_gl1e_va(TRC_SHADOW_FIXUP, gw.l1e, va); done: __maybe_unused; sh_audit_gw(v, &gw); SHADOW_PRINTK("fixed\n"); @@ -2857,7 +2832,7 @@ static int cf_check sh_page_fault( put_gfn(d, gfn_x(gfn)); propagate: - trace_not_shadow_fault(gw.l1e, va); + sh_trace_gl1e_va(TRC_SHADOW_NOT_SHADOW, gw.l1e, va); return 0; } -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |