|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/5] DO-NOT-APPLY - Demonstrates an NMI hitting an in-progress patch
---
xen/arch/x86/alternative.c | 15 +++++++++++++++
xen/arch/x86/x86_64/entry.S | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
index 40bfaad..10e423c 100644
--- a/xen/arch/x86/alternative.c
+++ b/xen/arch/x86/alternative.c
@@ -138,6 +138,9 @@ static init_or_livepatch_data struct live_poke_info {
unsigned int cpu;
} live_poke_info;
+extern void nmi_patch_point(void);
+#include <asm/apic.h>
+
/*
* text_poke_live - Update the live .text area, in an interrupt-safe way.
*
@@ -197,6 +200,18 @@ bool init_or_livepatch text_poke_live(const struct
cpu_user_regs *regs)
smp_wmb();
/* Second, copy the remaining instructions into place. */
memcpy(i->addr + 1, i->opcode + 1, i->len - 1);
+
+ if ( _p(i->addr) == _p(nmi_patch_point) )
+ {
+ if ( !regs )
+ {
+ printk("Found NMI patch point\n");
+ apic_icr_write(APIC_DEST_SELF | APIC_DM_NMI, 0);
+ }
+ else
+ printk("Hit debugtrap in NMI\n");
+ }
+
smp_wmb();
/* Third, replace the breakpoint with the real instruction byte. */
i->addr[0] = i->opcode[0];
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 56f52c7..1337562 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -790,6 +790,10 @@ ENTRY(early_page_fault)
ENTRY(nmi)
pushq $0
movl $TRAP_nmi,4(%rsp)
+
+GLOBAL(nmi_patch_point)
+ ALTERNATIVE __stringify(ASM_NOP3), "lfence", X86_FEATURE_ALWAYS
+
handle_ist_exception:
SAVE_ALL CLAC
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |