Re: [RFC][PATCH] tracing/x86: Save CR2 before tracing irqsoff on error_entry

From: Steven Rostedt
Date: Thu Mar 21 2019 - 09:32:47 EST


On Thu, 21 Mar 2019 11:45:17 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> - .if \paranoid
> + .if \read_cr2
> + mov %cr2, %rdx /* XXX paravirt crap */
> + .endif
> +

I'm guessing this breaks paravirt, as that's one reason I didn't add
the read_rc in assembly.

I tested your code and it also fixes the issue, but needed to add this
to make it compile:

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 7d6f3f3fad78..1530909fbf70 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -81,7 +81,7 @@ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s);
void __init trap_init(void);
#endif
dotraplinkage void do_general_protection(struct pt_regs *regs, long error_code);
-dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code);
+dotraplinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, unsigned long address);
dotraplinkage void do_spurious_interrupt_bug(struct pt_regs *regs, long error_code);
dotraplinkage void do_coprocessor_error(struct pt_regs *regs, long error_code);
dotraplinkage void do_alignment_check(struct pt_regs *regs, long error_code);


-- Steve