From owner-svn-src-all@FreeBSD.ORG Thu Jun 18 15:57:57 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 702A21065688; Thu, 18 Jun 2009 15:57:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E2748FC1D; Thu, 18 Jun 2009 15:57:57 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5IFvvcJ016076; Thu, 18 Jun 2009 15:57:57 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5IFvvcx016073; Thu, 18 Jun 2009 15:57:57 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906181557.n5IFvvcx016073@svn.freebsd.org> From: John Baldwin Date: Thu, 18 Jun 2009 15:57:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194446 - in vendor-sys/opensolaris/dist/uts/common: dtrace sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Thu, 18 Jun 2009 15:57:57 -0000 Author: jhb Date: Thu Jun 18 15:57:57 2009 New Revision: 194446 URL: http://svn.freebsd.org/changeset/base/194446 Log: Import newer versions of these files from a 20080410 checkout of OpenSolaris. Our local diffs to these files in HEAD already contain all these changes (and in fact seem to be based on these versions of the files). It seems the vendor branch just has older versions somehow. Modified: vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h Modified: vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c ============================================================================== --- vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c Thu Jun 18 15:41:11 2009 (r194445) +++ vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c Thu Jun 18 15:57:57 2009 (r194446) @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -390,7 +390,7 @@ fasttrap_pid_cleanup(void) /* * This is called from cfork() via dtrace_fasttrap_fork(). The child - * process's address space is a (roughly) a copy of the parent process's so + * process's address space is (roughly) a copy of the parent process's so * we have to remove all the instrumentation we had previously enabled in the * parent. */ @@ -437,6 +437,15 @@ fasttrap_fork(proc_t *p, proc_t *cp) tp->ftt_proc->ftpc_acount != 0) { int ret = fasttrap_tracepoint_remove(cp, tp); ASSERT(ret == 0); + + /* + * The count of active providers can only be + * decremented (i.e. to zero) during exec, + * exit, and removal of a meta provider so it + * should be impossible to drop the count + * mid-fork. + */ + ASSERT(tp->ftt_proc->ftpc_acount != 0); } } mutex_exit(&bucket->ftb_mtx); @@ -517,6 +526,12 @@ fasttrap_tracepoint_enable(proc_t *p, fa again: mutex_enter(&bucket->ftb_mtx); for (tp = bucket->ftb_data; tp != NULL; tp = tp->ftt_next) { + /* + * Note that it's safe to access the active count on the + * associated proc structure because we know that at least one + * provider (this one) will still be around throughout this + * operation. + */ if (tp->ftt_pid != pid || tp->ftt_pc != pc || tp->ftt_proc->ftpc_acount == 0) continue; @@ -1157,6 +1172,7 @@ fasttrap_proc_lookup(pid_t pid) mutex_exit(&bucket->ftb_mtx); fprc->ftpc_rcount++; atomic_add_64(&fprc->ftpc_acount, 1); + ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount); mutex_exit(&fprc->ftpc_mtx); return (fprc); @@ -1186,6 +1202,7 @@ fasttrap_proc_lookup(pid_t pid) mutex_exit(&bucket->ftb_mtx); fprc->ftpc_rcount++; atomic_add_64(&fprc->ftpc_acount, 1); + ASSERT(fprc->ftpc_acount <= fprc->ftpc_rcount); mutex_exit(&fprc->ftpc_mtx); kmem_free(new_fprc, sizeof (fasttrap_proc_t)); @@ -1212,6 +1229,7 @@ fasttrap_proc_release(fasttrap_proc_t *p mutex_enter(&proc->ftpc_mtx); ASSERT(proc->ftpc_rcount != 0); + ASSERT(proc->ftpc_acount <= proc->ftpc_rcount); if (--proc->ftpc_rcount != 0) { mutex_exit(&proc->ftpc_mtx); @@ -1390,6 +1408,16 @@ fasttrap_provider_free(fasttrap_provider ASSERT(provider->ftp_ccount == 0); ASSERT(provider->ftp_mcount == 0); + /* + * If this provider hasn't been retired, we need to explicitly drop the + * count of active providers on the associated process structure. + */ + if (!provider->ftp_retired) { + atomic_add_64(&provider->ftp_proc->ftpc_acount, -1); + ASSERT(provider->ftp_proc->ftpc_acount < + provider->ftp_proc->ftpc_rcount); + } + fasttrap_proc_release(provider->ftp_proc); kmem_free(provider, sizeof (fasttrap_provider_t)); @@ -1461,6 +1489,8 @@ fasttrap_provider_retire(pid_t pid, cons * table. */ atomic_add_64(&fp->ftp_proc->ftpc_acount, -1); + ASSERT(fp->ftp_proc->ftpc_acount < fp->ftp_proc->ftpc_rcount); + fp->ftp_retired = 1; fp->ftp_marked = 1; provid = fp->ftp_provid; @@ -2014,6 +2044,13 @@ err: tp->ftt_proc->ftpc_acount != 0) break; + /* + * The count of active providers can only be + * decremented (i.e. to zero) during exec, exit, and + * removal of a meta provider so it should be + * impossible to drop the count during this operation(). + */ + ASSERT(tp->ftt_proc->ftpc_acount != 0); tp = tp->ftt_next; } Modified: vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h ============================================================================== --- vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h Thu Jun 18 15:41:11 2009 (r194445) +++ vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h Thu Jun 18 15:57:57 2009 (r194446) @@ -668,7 +668,7 @@ void cpu_destroy_bound_threads(cpu_t *cp extern int cpu_bind_thread(kthread_t *tp, processorid_t bind, processorid_t *obind, int *error); -extern int cpu_unbind(processorid_t cpu_id); +extern int cpu_unbind(processorid_t cpu_id, boolean_t force); extern void thread_affinity_set(kthread_t *t, int cpu_id); extern void thread_affinity_clear(kthread_t *t); extern void affinity_set(int cpu_id);