From owner-p4-projects@FreeBSD.ORG Mon Apr 24 03:53:27 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E8B9116A407; Mon, 24 Apr 2006 03:53:26 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C64D616A404 for ; Mon, 24 Apr 2006 03:53:26 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9001C43D53 for ; Mon, 24 Apr 2006 03:53:26 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3O3rQgh010706 for ; Mon, 24 Apr 2006 03:53:26 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3O3rQ9E010703 for perforce@freebsd.org; Mon, 24 Apr 2006 03:53:26 GMT (envelope-from jb@freebsd.org) Date: Mon, 24 Apr 2006 03:53:26 GMT Message-Id: <200604240353.k3O3rQ9E010703@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 95987 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2006 03:53:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=95987 Change 95987 by jb@jb_freebsd2 on 2006/04/24 03:52:59 Just allocate buffer memory for the maximum number of cpus. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3 (text+ko) ==== @@ -69,8 +69,7 @@ dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags, processorid_t cpu) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); -#ifdef DOODAD +#if defined(sun) cpu_t *cp; dtrace_buffer_t *buf; @@ -142,9 +141,51 @@ buf->dtb_xamot = NULL; buf->dtb_size = 0; } while ((cp = cp->cpu_next) != cpu_list); -#endif return (ENOMEM); +#else + dtrace_buffer_t *buf; + int i; + + ASSERT(MUTEX_HELD(&dtrace_lock)); + for (i = 0; i < mp_ncpus; i++) { + buf = &bufs[i]; + + /* + * If there is already a buffer allocated for this CPU, it + * is only possible that this is a DR event. In this case, + * the buffer size must match our specified size. + */ + if (buf->dtb_tomax != NULL) { + ASSERT(buf->dtb_size == size); +printf("buf->dtb_size %ld size %ld\n",(long) buf->dtb_size,(long) size); + continue; + } + + ASSERT(buf->dtb_xamot == NULL); + + /* + * XXX Hack. + * This should be KM_NOSLEEP with error handling if low on + * memory. + */ + buf->dtb_tomax = kmem_zalloc(size, KM_SLEEP); + + buf->dtb_size = size; + buf->dtb_flags = flags; + buf->dtb_offset = 0; + buf->dtb_drops = 0; + + /* + * XXX Hack. + * This should be KM_NOSLEEP with error handling if low on + * memory. + */ + buf->dtb_xamot = kmem_zalloc(size, KM_SLEEP); + } + + return (0); +#endif } /*