From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753263AbbIHFuT (ORCPT ); Tue, 8 Sep 2015 01:50:19 -0400 Received: from mgwym03.jp.fujitsu.com ([211.128.242.42]:45655 "EHLO mgwym03.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753057AbbIHFuN (ORCPT ); Tue, 8 Sep 2015 01:50:13 -0400 X-SecurityPolicyCheck: OK by SHieldMailChecker v2.2.3 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20140219-2 From: Takao Indoh To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Arnaldo Carvalho de Melo , Alexander Shishkin , Vivek Goyal , Steven Rostedt CC: , Subject: [PATCH v2 4/4] x86: Stop Intel PT and save its registers when panic occurs Date: Tue, 8 Sep 2015 14:49:24 +0900 Message-ID: <1441691364-5612-5-git-send-email-indou.takao@jp.fujitsu.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1441691364-5612-1-git-send-email-indou.takao@jp.fujitsu.com> References: <1441691364-5612-1-git-send-email-indou.takao@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When panic occurs, Intel PT logging is stopped to prevent it from overwrite its log buffer. The registers of Intel PT are saved in the memory on panic, they are needed for debugger to find the last position where Intel PT wrote data. Signed-off-by: Takao Indoh --- arch/x86/kernel/crash.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index e068d66..78deceb 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -35,6 +35,7 @@ #include #include #include +#include /* Alignment required for elf header segment */ #define ELF_CORE_HEADER_ALIGN 4096 @@ -127,6 +128,10 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs) cpu_emergency_vmxoff(); cpu_emergency_svm_disable(); +#ifdef CONFIG_X86_INTEL_PT_LOG + save_intel_pt_registers(); +#endif + disable_local_APIC(); } @@ -172,6 +177,10 @@ void native_machine_crash_shutdown(struct pt_regs *regs) cpu_emergency_vmxoff(); cpu_emergency_svm_disable(); +#ifdef CONFIG_X86_INTEL_PT_LOG + save_intel_pt_registers(); +#endif + #ifdef CONFIG_X86_IO_APIC /* Prevent crash_kexec() from deadlocking on ioapic_lock. */ ioapic_zap_locks(); -- 1.7.1