Remove TRAPLOG from i386. Nowadays there are better instrumentation tools, trunk
authormaxv <maxv@NetBSD.org>
Sun, 17 Sep 2017 09:04:51 +0000
branchtrunk
changeset 272086 589b326098bb
parent 272085 59ff02de339a
child 272087 dc6b22898490
Remove TRAPLOG from i386. Nowadays there are better instrumentation tools, in both software and hardware.
sys/arch/i386/i386/db_interface.c
sys/arch/i386/i386/genassym.cf
sys/arch/i386/i386/machdep.c
sys/arch/i386/include/frameasm.h
sys/arch/x86/x86/cpu.c
sys/arch/xen/x86/cpu.c
--- a/sys/arch/i386/i386/db_interface.c	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/i386/i386/db_interface.c	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.74 2017/08/15 09:16:59 maxv Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.75 2017/09/17 09:04:51 maxv Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.74 2017/08/15 09:16:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.75 2017/09/17 09:04:51 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -276,10 +276,6 @@
 		regs->tf_ss     = ddb_regs.tf_ss;
 	}
 
-#ifdef TRAPLOG
-	wrmsr(MSR_DEBUGCTLMSR, 0x1);
-#endif
-
 	return (1);
 }
 
--- a/sys/arch/i386/i386/genassym.cf	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/i386/i386/genassym.cf	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.103 2017/08/12 13:16:14 maxv Exp $
+#	$NetBSD: genassym.cf,v 1.104 2017/09/17 09:04:51 maxv Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -128,9 +128,6 @@
 include <machine/isa_machdep.h>
 endif
 
-include <machine/tlog.h>
-
-
 include <sys/bus.h>
 
 define	PAGE_SIZE		PAGE_SIZE
@@ -268,9 +265,6 @@
 define	CPU_INFO_VENDOR		offsetof(struct cpu_info, ci_vendor[0])
 define	CPU_INFO_SIGNATURE	offsetof(struct cpu_info, ci_signature)
 
-define	CPU_TLOG_OFFSET		offsetof(struct cpu_info, ci_tlog_offset)
-define	CPU_TLOG_BASE		offsetof(struct cpu_info, ci_tlog_base)
-
 define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
 define	CPU_INFO_IPENDING	offsetof(struct cpu_info, ci_ipending)
 define	CPU_INFO_IMASK		offsetof(struct cpu_info, ci_imask)
@@ -321,18 +315,6 @@
 define	IS_MAXLEVEL		offsetof(struct intrsource, is_maxlevel)
 define	IS_LWP			offsetof(struct intrsource, is_lwp)
 
-define	TREC_SP			offsetof(struct trec, tr_sp)
-define	TREC_HPC		offsetof(struct trec, tr_hpc)
-define	TREC_IPC		offsetof(struct trec, tr_ipc)
-define	TREC_TSC		offsetof(struct trec, tr_tsc)
-define	TREC_LBF		offsetof(struct trec, tr_lbf)
-define	TREC_LBT		offsetof(struct trec, tr_lbt)
-define	TREC_IBF		offsetof(struct trec, tr_ibf)
-define	TREC_IBT		offsetof(struct trec, tr_ibt)
-
-define	SIZEOF_TREC		sizeof(struct trec)
-define	SIZEOF_TLOG		sizeof(struct tlog)
-
 define	IPL_NONE		IPL_NONE
 define	IPL_PREEMPT		IPL_PREEMPT
 define	IPL_SCHED		IPL_SCHED
--- a/sys/arch/i386/i386/machdep.c	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/i386/i386/machdep.c	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.792 2017/08/27 09:32:12 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.793 2017/09/17 09:04:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.792 2017/08/27 09:32:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.793 2017/09/17 09:04:51 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -438,13 +438,6 @@
 	multiboot_print_info();
 #endif
 
-#ifdef TRAPLOG
-	/*
-	 * Enable recording of branch from/to in MSR's
-	 */
-	wrmsr(MSR_DEBUGCTLMSR, 0x1);
-#endif
-
 #if NCARDBUS > 0
 	/* Tell RBUS how much RAM we have, so it can use heuristics. */
 	rbus_min_start_hint(ctob((psize_t)physmem));
--- a/sys/arch/i386/include/frameasm.h	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/i386/include/frameasm.h	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.16 2017/06/14 17:09:00 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.17 2017/09/17 09:04:51 maxv Exp $	*/
 
 #ifndef _I386_FRAMEASM_H_
 #define _I386_FRAMEASM_H_
@@ -27,40 +27,6 @@
 			testb	$0xff,EVTCHN_UPCALL_PENDING(reg)
 #endif
 
-#ifndef TRAPLOG
-#define TLOG		/**/
-#else
-/*
- * Fill in trap record
- */
-#define TLOG						\
-9:							\
-	movl	%fs:CPU_TLOG_OFFSET, %eax;		\
-	movl	%fs:CPU_TLOG_BASE, %ebx;		\
-	addl	$SIZEOF_TREC,%eax;			\
-	andl	$SIZEOF_TLOG-1,%eax;			\
-	addl	%eax,%ebx;				\
-	movl	%eax,%fs:CPU_TLOG_OFFSET;		\
-	movl	%esp,TREC_SP(%ebx);			\
-	movl	$9b,TREC_HPC(%ebx);			\
-	movl	TF_EIP(%esp),%eax;			\
-	movl	%eax,TREC_IPC(%ebx);			\
-	rdtsc			;			\
-	movl	%eax,TREC_TSC(%ebx);			\
-	movl	$MSR_LASTBRANCHFROMIP,%ecx;		\
-	rdmsr			;			\
-	movl	%eax,TREC_LBF(%ebx);			\
-	incl	%ecx		;			\
-	rdmsr			;			\
-	movl	%eax,TREC_LBT(%ebx);			\
-	incl	%ecx		;			\
-	rdmsr			;			\
-	movl	%eax,TREC_IBF(%ebx);			\
-	incl	%ecx		;			\
-	rdmsr			;			\
-	movl	%eax,TREC_IBT(%ebx)
-#endif
-
 /*
  * These are used on interrupt or trap entry or exit.
  */
@@ -83,8 +49,7 @@
 	movl	$GSEL(GCPU_SEL, SEL_KPL),%eax	; \
 	movl	%ecx,TF_ECX(%esp)	; \
 	movl	%eax,%fs	; \
-	cld			; \
-	TLOG
+	cld
 
 /*
  * INTRFASTEXIT should be in sync with trap(), resume_iret and friends.
--- a/sys/arch/x86/x86/cpu.c	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/x86/x86/cpu.c	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.134 2017/08/27 09:32:12 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.135 2017/09/17 09:04:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.134 2017/08/27 09:32:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.135 2017/09/17 09:04:51 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -105,10 +105,6 @@
 
 #include <x86/fpu.h>
 
-#ifdef i386
-#include <machine/tlog.h>
-#endif
-
 #if NLAPIC > 0
 #include <machine/apicvar.h>
 #include <machine/i82489reg.h>
@@ -153,18 +149,12 @@
  * CPU, on uniprocessors).  The CPU info list is initialized to
  * point at it.
  */
-#ifdef TRAPLOG
-struct tlog tlog_primary;
-#endif
 struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE) = {
 	.ci_dev = 0,
 	.ci_self = &cpu_info_primary,
 	.ci_idepth = -1,
 	.ci_curlwp = &lwp0,
 	.ci_curldt = -1,
-#ifdef TRAPLOG
-	.ci_tlog_base = &tlog_primary,
-#endif
 };
 
 struct cpu_info *cpu_info_list = &cpu_info_primary;
@@ -327,9 +317,6 @@
 		    KM_SLEEP);
 		ci = (struct cpu_info *)roundup2(ptr, CACHE_LINE_SIZE);
 		ci->ci_curldt = -1;
-#ifdef TRAPLOG
-		ci->ci_tlog_base = kmem_zalloc(sizeof(struct tlog), KM_SLEEP);
-#endif
 	} else {
 		aprint_naive(": %s Processor\n",
 		    caa->cpu_role == CPU_ROLE_SP ? "Single" : "Boot");
--- a/sys/arch/xen/x86/cpu.c	Sun Sep 17 08:10:08 2017 +0000
+++ b/sys/arch/xen/x86/cpu.c	Sun Sep 17 09:04:51 2017 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.111 2017/07/06 20:26:05 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.112 2017/09/17 09:04:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111 2017/07/06 20:26:05 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.112 2017/09/17 09:04:51 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -148,20 +148,12 @@
  * CPU, on uniprocessors).  The CPU info list is initialized to
  * point at it.
  */
-#ifdef TRAPLOG
-#include <machine/tlog.h>
-struct tlog tlog_primary;
-#endif
 struct cpu_info cpu_info_primary __aligned(CACHE_LINE_SIZE) = {
 	.ci_dev = 0,
 	.ci_self = &cpu_info_primary,
 	.ci_idepth = -1,
 	.ci_curlwp = &lwp0,
 	.ci_curldt = -1,
-#ifdef TRAPLOG
-	.ci_tlog = &tlog_primary,
-#endif
-
 };
 struct cpu_info phycpu_info_primary __aligned(CACHE_LINE_SIZE) = {
 	.ci_dev = 0,
@@ -386,9 +378,6 @@
 		    KM_SLEEP);
 		ci = (struct cpu_info *)roundup2(ptr, CACHE_LINE_SIZE);
 		memset(ci, 0, sizeof(*ci));
-#ifdef TRAPLOG
-		ci->ci_tlog_base = kmem_zalloc(sizeof(struct tlog), KM_SLEEP);
-#endif
 	} else {
 		aprint_naive(": %s Processor\n",
 		    caa->cpu_role == CPU_ROLE_SP ? "Single" : "Boot");