Module Name: src Committed By: maxv Date: Sun Sep 17 09:04:52 UTC 2017
Modified Files: src/sys/arch/i386/i386: db_interface.c genassym.cf machdep.c src/sys/arch/i386/include: frameasm.h src/sys/arch/x86/x86: cpu.c src/sys/arch/xen/x86: cpu.c Log Message: Remove TRAPLOG from i386. Nowadays there are better instrumentation tools, in both software and hardware. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/arch/i386/i386/db_interface.c cvs rdiff -u -r1.103 -r1.104 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.792 -r1.793 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/include/frameasm.h cvs rdiff -u -r1.134 -r1.135 src/sys/arch/x86/x86/cpu.c cvs rdiff -u -r1.111 -r1.112 src/sys/arch/xen/x86/cpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/i386/db_interface.c diff -u src/sys/arch/i386/i386/db_interface.c:1.74 src/sys/arch/i386/i386/db_interface.c:1.75 --- src/sys/arch/i386/i386/db_interface.c:1.74 Tue Aug 15 09:16:59 2017 +++ src/sys/arch/i386/i386/db_interface.c Sun Sep 17 09:04:51 2017 @@ -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 @@ kdb_trap(int type, int code, db_regs_t * regs->tf_ss = ddb_regs.tf_ss; } -#ifdef TRAPLOG - wrmsr(MSR_DEBUGCTLMSR, 0x1); -#endif - return (1); } Index: src/sys/arch/i386/i386/genassym.cf diff -u src/sys/arch/i386/i386/genassym.cf:1.103 src/sys/arch/i386/i386/genassym.cf:1.104 --- src/sys/arch/i386/i386/genassym.cf:1.103 Sat Aug 12 13:16:14 2017 +++ src/sys/arch/i386/i386/genassym.cf Sun Sep 17 09:04:51 2017 @@ -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 @@ if NISA > 0 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_CC_SKEW offsetof(struct 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_TYPE offsetof(struct intrsou 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 Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.792 src/sys/arch/i386/i386/machdep.c:1.793 --- src/sys/arch/i386/i386/machdep.c:1.792 Sun Aug 27 09:32:12 2017 +++ src/sys/arch/i386/i386/machdep.c Sun Sep 17 09:04:51 2017 @@ -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 @@ cpu_startup(void) 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)); Index: src/sys/arch/i386/include/frameasm.h diff -u src/sys/arch/i386/include/frameasm.h:1.16 src/sys/arch/i386/include/frameasm.h:1.17 --- src/sys/arch/i386/include/frameasm.h:1.16 Wed Jun 14 17:09:00 2017 +++ src/sys/arch/i386/include/frameasm.h Sun Sep 17 09:04:51 2017 @@ -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. Index: src/sys/arch/x86/x86/cpu.c diff -u src/sys/arch/x86/x86/cpu.c:1.134 src/sys/arch/x86/x86/cpu.c:1.135 --- src/sys/arch/x86/x86/cpu.c:1.134 Sun Aug 27 09:32:12 2017 +++ src/sys/arch/x86/x86/cpu.c Sun Sep 17 09:04:51 2017 @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.13 #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 @@ CFATTACH_DECL2_NEW(cpu, sizeof(struct cp * 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 @@ cpu_attach(device_t parent, device_t sel 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"); Index: src/sys/arch/xen/x86/cpu.c diff -u src/sys/arch/xen/x86/cpu.c:1.111 src/sys/arch/xen/x86/cpu.c:1.112 --- src/sys/arch/xen/x86/cpu.c:1.111 Thu Jul 6 20:26:05 2017 +++ src/sys/arch/xen/x86/cpu.c Sun Sep 17 09:04:51 2017 @@ -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 @@ CFATTACH_DECL_NEW(vcpu, sizeof(struct cp * 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 @@ cpu_attach_common(device_t parent, devic 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");