Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754382AbbKWQ0g (ORCPT ); Mon, 23 Nov 2015 11:26:36 -0500 Received: from terminus.zytor.com ([198.137.202.10]:44616 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754005AbbKWQ0e (ORCPT ); Mon, 23 Nov 2015 11:26:34 -0500 Date: Mon, 23 Nov 2015 08:25:30 -0800 From: tip-bot for Takao Indoh Message-ID: Cc: indou.takao@jp.fujitsu.com, mingo@kernel.org, vincent.weaver@maine.edu, eranian@google.com, vgoyal@redhat.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, efault@gmx.de, peterz@infradead.org, acme@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, alexander.shishkin@linux.intel.com, acme@redhat.com, jolsa@redhat.com Reply-To: indou.takao@jp.fujitsu.com, eranian@google.com, vincent.weaver@maine.edu, mingo@kernel.org, linux-kernel@vger.kernel.org, vgoyal@redhat.com, tglx@linutronix.de, efault@gmx.de, alexander.shishkin@linux.intel.com, torvalds@linux-foundation.org, hpa@zytor.com, peterz@infradead.org, acme@kernel.org, jolsa@redhat.com, acme@redhat.com In-Reply-To: <1446614553-6072-2-git-send-email-indou.takao@jp.fujitsu.com> References: <1446614553-6072-2-git-send-email-indou.takao@jp.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/intel/pt: Add interface to stop Intel PT logging Git-Commit-ID: 24cc12b17679f8e9046746f92fd377f589efc163 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 Content-Length: 3115 Lines: 86 Commit-ID: 24cc12b17679f8e9046746f92fd377f589efc163 Gitweb: http://git.kernel.org/tip/24cc12b17679f8e9046746f92fd377f589efc163 Author: Takao Indoh AuthorDate: Wed, 4 Nov 2015 14:22:32 +0900 Committer: Ingo Molnar CommitDate: Mon, 23 Nov 2015 09:58:26 +0100 perf/x86/intel/pt: Add interface to stop Intel PT logging This patch add a function for external components to stop Intel PT. Basically this function is used when kernel panic occurs. When it is called, the intel_pt driver disables Intel PT and saves its registers using pt_event_stop(), which is also used by pmu.stop handler. This function stops Intel PT on the CPU where it is working, therefore users of it need to call it for each CPU to stop all logging. 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-2-git-send-email-indou.takao@jp.fujitsu.com Signed-off-by: Ingo Molnar --- arch/x86/include/asm/intel_pt.h | 10 ++++++++++ arch/x86/kernel/cpu/perf_event_intel_pt.c | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/x86/include/asm/intel_pt.h b/arch/x86/include/asm/intel_pt.h new file mode 100644 index 0000000..e1a4117 --- /dev/null +++ b/arch/x86/include/asm/intel_pt.h @@ -0,0 +1,10 @@ +#ifndef _ASM_X86_INTEL_PT_H +#define _ASM_X86_INTEL_PT_H + +#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL) +void cpu_emergency_stop_pt(void); +#else +static inline void cpu_emergency_stop_pt(void) {} +#endif + +#endif /* _ASM_X86_INTEL_PT_H */ diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c index 868e119..c0bbd10 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_pt.c +++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "perf_event.h" #include "intel_pt.h" @@ -1122,6 +1123,14 @@ static int pt_event_init(struct perf_event *event) return 0; } +void cpu_emergency_stop_pt(void) +{ + struct pt *pt = this_cpu_ptr(&pt_ctx); + + if (pt->handle.event) + pt_event_stop(pt->handle.event, PERF_EF_UPDATE); +} + static __init int pt_init(void) { int ret, cpu, prior_warn = 0; -- 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/