Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbbKDFXI (ORCPT ); Wed, 4 Nov 2015 00:23:08 -0500 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:24386 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752308AbbKDFXG (ORCPT ); Wed, 4 Nov 2015 00:23:06 -0500 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 CC: , Subject: [PATCH v2 2/2] x86: Stop Intel PT before kdump starts Date: Wed, 4 Nov 2015 14:22:33 +0900 Message-ID: <1446614553-6072-3-git-send-email-indou.takao@jp.fujitsu.com> X-Mailer: git-send-email 2.4.5 In-Reply-To: <1446614553-6072-1-git-send-email-indou.takao@jp.fujitsu.com> References: <1446614553-6072-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 Content-Length: 1752 Lines: 57 This patch stops Intel PT logging and saves its registers in the memory before kdump is started. This feature is needed to prevent Intel PT from overwrite its log buffer after panic, and saved registers are needed to find the last position where Intel PT wrote data. After crash dump is captured by kdump, user can retrieve the log buffer from vmcore and use it to investigate kernel behavior. Signed-off-by: Takao Indoh --- arch/x86/kernel/crash.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 74ca2fe..5f383d2 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,11 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs) cpu_emergency_vmxoff(); cpu_emergency_svm_disable(); + /* + * Disable Intel PT to stop its logging + */ + cpu_emergency_stop_pt(); + disable_local_APIC(); } @@ -172,6 +178,11 @@ void native_machine_crash_shutdown(struct pt_regs *regs) cpu_emergency_vmxoff(); cpu_emergency_svm_disable(); + /* + * Disable Intel PT to stop its logging + */ + cpu_emergency_stop_pt(); + #ifdef CONFIG_X86_IO_APIC /* Prevent crash_kexec() from deadlocking on ioapic_lock. */ ioapic_zap_locks(); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/