From: Andrew Cooper Subject: [PATCH 2/4] xen/crash: Don't use set_fixmap() in the crash path Date: Tue, 2 Jun 2015 15:04:25 +0100 Message-ID: <1433253867-29752-3-git-send-email-andrew.cooper3@citrix.com> References: <1433253867-29752-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1433253867-29752-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org Experimentally, this can result in memory allocation, and in particular a failed assertion that interrupts are enabled when performing a TLB flush. (XEN) Assertion 'local_irq_is_enabled()' failed at smp.c:223 (XEN) [] flush_area_mask+0x7/0x134 (XEN) [] alloc_domheap_pages+0xa9/0x12a (XEN) [] alloc_xenheap_pages+0x64/0xdb (XEN) [] alloc_xen_pagetable+0x1c/0xa0 (XEN) [] virt_to_xen_l1e+0x38/0x1be (XEN) [] map_pages_to_xen+0x80e/0xfd9 (XEN) [] __set_fixmap+0x2c/0x2e (XEN) [] machine_crash_shutdown+0x186/0x2b2 (XEN) [] kexec_crash+0x3f/0x5b (XEN) [] panic+0x100/0x118 (XEN) [] set_guest_machinecheck_trapbounce+0/0x6d (XEN) [] do_page_fault+0x40b/0x541 (XEN) [] handle_exception_saved+0x2e/0x6c Instead, use the directmap mapping which are writable and involve far less complexity than set_fixmap() Signed-off-by: Andrew Cooper CC: Jan Beulich --- xen/arch/x86/crash.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c index eb7be9c..501e18e 100644 --- a/xen/arch/x86/crash.c +++ b/xen/arch/x86/crash.c @@ -140,13 +140,10 @@ static void nmi_shootdown_cpus(void) * Ideally would be: * exception_table[TRAP_nmi] = &do_nmi_crash; * - * but the exception_table is read only. Borrow an unused fixmap entry - * to construct a writable mapping. + * but the exception_table is read only. Access it via its directmap + * mappings. */ - set_fixmap(FIX_TBOOT_MAP_ADDRESS, __pa(&exception_table[TRAP_nmi])); - write_atomic((unsigned long *) - (fix_to_virt(FIX_TBOOT_MAP_ADDRESS) + - ((unsigned long)&exception_table[TRAP_nmi] & ~PAGE_MASK)), + write_atomic((unsigned long*)__va(__pa(&exception_table[TRAP_nmi])), (unsigned long)&do_nmi_crash); /* Ensure the new callback function is set before sending out the NMI. */ -- 1.7.10.4