From owner-svn-src-head@freebsd.org Tue Apr 17 16:36:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 832E1F88C31; Tue, 17 Apr 2018 16:36:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 310FE7938A; Tue, 17 Apr 2018 16:36:54 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DCC170BB; Tue, 17 Apr 2018 16:36:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3HGar97035762; Tue, 17 Apr 2018 16:36:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3HGarpw035761; Tue, 17 Apr 2018 16:36:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804171636.w3HGarpw035761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 17 Apr 2018 16:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332650 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 332650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 16:36:54 -0000 Author: brooks Date: Tue Apr 17 16:36:53 2018 New Revision: 332650 URL: https://svnweb.freebsd.org/changeset/base/332650 Log: Stop using fuswintr() and suswintr() in the profiler. Always take the AST path rather than calling MD functions which are often implemented as always failing. The is the case on amd64, arm, i386, and powerpc. This optimization (inherited from 4.4 Lite) is a pessimization on those architectures and is the sole use of these functions. They will be removed in a seperate commit. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15101 Modified: head/sys/kern/subr_prof.c Modified: head/sys/kern/subr_prof.c ============================================================================== --- head/sys/kern/subr_prof.c Tue Apr 17 16:21:23 2018 (r332649) +++ head/sys/kern/subr_prof.c Tue Apr 17 16:36:53 2018 (r332650) @@ -447,10 +447,9 @@ sys_profil(struct thread *td, struct profil_args *uap) /* * Collect user-level profiling statistics; called on a profiling tick, * when a process is running in user-mode. This routine may be called - * from an interrupt context. We try to update the user profiling buffers - * cheaply with fuswintr() and suswintr(). If that fails, we revert to - * an AST that will vector us to trap() with a context in which copyin - * and copyout will work. Trap will then call addupc_task(). + * from an interrupt context. We perform the update with an AST + * that will vector us to trap() with a context in which copyin and + * copyout will work. Trap will then call addupc_task(). * * Note that we may (rarely) not get around to the AST soon enough, and * lose profile ticks when the next tick overwrites this one, but in this @@ -461,35 +460,28 @@ void addupc_intr(struct thread *td, uintfptr_t pc, u_int ticks) { struct uprof *prof; - caddr_t addr; - u_int i; - int v; if (ticks == 0) return; prof = &td->td_proc->p_stats->p_prof; PROC_PROFLOCK(td->td_proc); - if (pc < prof->pr_off || - (i = PC_TO_INDEX(pc, prof)) >= prof->pr_size) { + if (pc < prof->pr_off || PC_TO_INDEX(pc, prof) >= prof->pr_size) { PROC_PROFUNLOCK(td->td_proc); return; /* out of range; ignore */ } - addr = prof->pr_base + i; PROC_PROFUNLOCK(td->td_proc); - if ((v = fuswintr(addr)) == -1 || suswintr(addr, v + ticks) == -1) { - td->td_profil_addr = pc; - td->td_profil_ticks = ticks; - td->td_pflags |= TDP_OWEUPC; - thread_lock(td); - td->td_flags |= TDF_ASTPENDING; - thread_unlock(td); - } + td->td_profil_addr = pc; + td->td_profil_ticks = ticks; + td->td_pflags |= TDP_OWEUPC; + thread_lock(td); + td->td_flags |= TDF_ASTPENDING; + thread_unlock(td); } /* - * Much like before, but we can afford to take faults here. If the - * update fails, we simply turn off profiling. + * Actually update the profiling statistics. If the update fails, we + * simply turn off profiling. */ void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks)