From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754435AbbKWQ04 (ORCPT ); Mon, 23 Nov 2015 11:26:56 -0500 Received: from terminus.zytor.com ([198.137.202.10]:44635 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753887AbbKWQ0x (ORCPT ); Mon, 23 Nov 2015 11:26:53 -0500 Date: Mon, 23 Nov 2015 08:25:52 -0800 From: tip-bot for Takao Indoh Message-ID: Cc: jolsa@redhat.com, tglx@linutronix.de, acme@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, torvalds@linux-foundation.org, vincent.weaver@maine.edu, vgoyal@redhat.com, peterz@infradead.org, mingo@kernel.org, indou.takao@jp.fujitsu.com, acme@kernel.org, eranian@google.com, efault@gmx.de Reply-To: peterz@infradead.org, vgoyal@redhat.com, mingo@kernel.org, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, vincent.weaver@maine.edu, tglx@linutronix.de, acme@redhat.com, hpa@zytor.com, jolsa@redhat.com, efault@gmx.de, indou.takao@jp.fujitsu.com, eranian@google.com, acme@kernel.org In-Reply-To: <1446614553-6072-3-git-send-email-indou.takao@jp.fujitsu.com> References: <1446614553-6072-3-git-send-email-indou.takao@jp.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf, x86: Stop Intel PT before kdump starts Git-Commit-ID: da06a43d3f3f3df87416f654fe15d29fecb5e321 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: da06a43d3f3f3df87416f654fe15d29fecb5e321 Gitweb: http://git.kernel.org/tip/da06a43d3f3f3df87416f654fe15d29fecb5e321 Author: Takao Indoh AuthorDate: Wed, 4 Nov 2015 14:22:33 +0900 Committer: Ingo Molnar CommitDate: Mon, 23 Nov 2015 09:58:26 +0100 perf, x86: Stop Intel PT before kdump starts This patch stops Intel PT logging and saves its registers in memory before kdump is started. This feature is needed to prevent Intel PT from overwriting its log buffer after panic, and saved registers are needed to find the last position where Intel PT wrote data. After the crash dump is captured by kdump, users can retrieve the log buffer from the vmcore and use it to investigate bad kernel behavior. Signed-off-by: Takao Indoh Signed-off-by: Peter Zijlstra (Intel) Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Arnaldo Carvalho de Melo Cc: H.Peter Anvin Cc: Jiri Olsa Cc: Linus Torvalds Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: Vivek Goyal Link: http://lkml.kernel.org/r/1446614553-6072-3-git-send-email-indou.takao@jp.fujitsu.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/crash.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index 2c1910f..58f3431 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 @@ -125,6 +126,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(); } @@ -169,6 +175,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();