From owner-svn-src-all@freebsd.org Sat Sep 17 14:00:53 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A7749BDE008; Sat, 17 Sep 2016 14:00:53 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6822A921; Sat, 17 Sep 2016 14:00:53 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8HE0qDl097245; Sat, 17 Sep 2016 14:00:52 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8HE0qIU097241; Sat, 17 Sep 2016 14:00:52 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201609171400.u8HE0qIU097241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Sat, 17 Sep 2016 14:00:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r305899 - in head/sys/i386: i386 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 Sep 2016 14:00:53 -0000 Author: bde Date: Sat Sep 17 14:00:52 2016 New Revision: 305899 URL: https://svnweb.freebsd.org/changeset/base/305899 Log: Remove all kernel uses of pcb_psl, but keep in in the struct to preserve the ABI and API for applications. It was removed in the port to amd64, but was remained as garbage giving a micro-pessimization and spurious single-step traps on i386. pcb_psl was intended to be used just to do a context switch of PSL_I, but this context switch was null in most or all versions, and mis-switching of PSL_T was done instead. Some history: - in 386BSD-0.0, cpu_switch() ran at splhigh() and splhigh() did too much interrupt disabling, so interrupts were hard-disabled across cpu_switch() and too many other places - in 386BSD-0.0-patchkit through FreeBSD-4 and FreeBSD-5 before SMPng, splhigh() did soft interrupt masking, and cpu_switch() was excessively cautious and did a cli at the start and a sti at the end to hard-disable interrupts across the switch - SMPng replaced the spl's and cli's by spinlocks (just sched_lock?), so interrupts were hard-disabled across cpu_switch() and too many other places again - initial attempts to fix this intended to restore some soft interrupt disabling, but to support variations in this cpu_switch() used pushfl/popfl into pcb_psl to avoid hard-coding the assumption that the initial and final states have PSL_I enabled. But the version with soft interrupt disabling wasn't used for long, or was never committed, (except I always used my different version of it for UP) so the pushfl/popl and pcb_psl to hold them have been doing less than nothing for about 14 years. Modified: head/sys/i386/i386/genassym.c head/sys/i386/i386/swtch.s head/sys/i386/i386/vm_machdep.c head/sys/i386/include/pcb.h Modified: head/sys/i386/i386/genassym.c ============================================================================== --- head/sys/i386/i386/genassym.c Sat Sep 17 13:48:01 2016 (r305898) +++ head/sys/i386/i386/genassym.c Sat Sep 17 14:00:52 2016 (r305899) @@ -143,7 +143,6 @@ ASSYM(PCB_DR2, offsetof(struct pcb, pcb_ ASSYM(PCB_DR3, offsetof(struct pcb, pcb_dr3)); ASSYM(PCB_DR6, offsetof(struct pcb, pcb_dr6)); ASSYM(PCB_DR7, offsetof(struct pcb, pcb_dr7)); -ASSYM(PCB_PSL, offsetof(struct pcb, pcb_psl)); ASSYM(PCB_DBREGS, PCB_DBREGS); ASSYM(PCB_EXT, offsetof(struct pcb, pcb_ext)); Modified: head/sys/i386/i386/swtch.s ============================================================================== --- head/sys/i386/i386/swtch.s Sat Sep 17 13:48:01 2016 (r305898) +++ head/sys/i386/i386/swtch.s Sat Sep 17 14:00:52 2016 (r305899) @@ -131,8 +131,6 @@ ENTRY(cpu_switch) movl %esi,PCB_ESI(%edx) movl %edi,PCB_EDI(%edx) mov %gs,PCB_GS(%edx) - pushfl /* PSL */ - popl PCB_PSL(%edx) /* Test if debug registers should be saved. */ testl $PCB_DBREGS,PCB_FLAGS(%edx) jz 1f /* no, skip over */ @@ -261,8 +259,6 @@ sw1: movl PCB_EDI(%edx),%edi movl PCB_EIP(%edx),%eax movl %eax,(%esp) - pushl PCB_PSL(%edx) - popfl movl %edx, PCPU(CURPCB) movl TD_TID(%ecx),%eax @@ -365,8 +361,6 @@ ENTRY(savectx) movl %esi,PCB_ESI(%ecx) movl %edi,PCB_EDI(%ecx) mov %gs,PCB_GS(%ecx) - pushfl - popl PCB_PSL(%ecx) movl %cr0,%eax movl %eax,PCB_CR0(%ecx) Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Sat Sep 17 13:48:01 2016 (r305898) +++ head/sys/i386/i386/vm_machdep.c Sat Sep 17 14:00:52 2016 (r305899) @@ -273,7 +273,6 @@ cpu_fork(td1, p2, td2, flags) pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */ pcb2->pcb_eip = (int)fork_trampoline; - pcb2->pcb_psl = PSL_KERNEL; /* ints disabled */ /*- * pcb2->pcb_dr*: cloned above. * pcb2->pcb_savefpu: cloned above. @@ -504,7 +503,6 @@ cpu_copy_thread(struct thread *td, struc pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ pcb2->pcb_ebx = (int)td; /* trampoline arg */ pcb2->pcb_eip = (int)fork_trampoline; - pcb2->pcb_psl &= ~(PSL_I); /* interrupts must be disabled */ pcb2->pcb_gs = rgs(); /* * If we didn't copy the pcb, we'd need to do the following registers: Modified: head/sys/i386/include/pcb.h ============================================================================== --- head/sys/i386/include/pcb.h Sat Sep 17 13:48:01 2016 (r305898) +++ head/sys/i386/include/pcb.h Sat Sep 17 14:00:52 2016 (r305899) @@ -89,7 +89,7 @@ struct pcb { caddr_t pcb_onfault; /* copyin/out fault recovery */ struct pcb_ext *pcb_ext; /* optional pcb extension */ - int pcb_psl; /* process status long */ + int pcb_waspsl; /* unused padding for ABI and API compat */ u_long pcb_vm86[2]; /* vm86bios scratch space */ union savefpu *pcb_save;