From owner-p4-projects@FreeBSD.ORG Sat May 27 05:23:41 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 B8BE716A787; Sat, 27 May 2006 05:23:40 +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 BF90216A77E for ; Sat, 27 May 2006 05:23:38 +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 8A8F743D46 for ; Sat, 27 May 2006 05:23:38 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4R5MZ6R088664 for ; Sat, 27 May 2006 05:22:35 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4R5MZfj088661 for perforce@freebsd.org; Sat, 27 May 2006 05:22:35 GMT (envelope-from jb@freebsd.org) Date: Sat, 27 May 2006 05:22:35 GMT Message-Id: <200605270522.k4R5MZfj088661@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 97921 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: Sat, 27 May 2006 05:23:43 -0000 http://perforce.freebsd.org/chv.cgi?CH=97921 Change 97921 by jb@jb_freebsd2 on 2006/05/27 05:21:38 Start treating 'CPU' as though it means 'cpu id' rather than a pointer to the per-cpu structure. My previous hack was leading to an occasional NULL pointer reference. It's time to start cleaning up hacks like this so that the FreeBSD DTrace port will pass a code review. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#14 edit Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_hacks.h#14 (text+ko) ==== @@ -1,13 +1,5 @@ -/* - * DTrace code routinely references CPU->cpu_id to get the cpu index - * to cpu_core[]. This would be better coded as a macro CPU_ID() - * which on FreeBSD would be defined as curthread->td_oncpu and on - * Solaris would be defined as curthread->t_cpu->cpu_id. - */ -#define CPU curthread -#define cpu_id td_oncpu - -#define CPU_ON_INTR(_t) (pcpu_find((_t)->td_oncpu)->pc_intr_actv) +#define CPU curcpu +#define CPU_ON_INTR(_a) (pcpu_find(_a)->pc_intr_actv) #define t_dtrace_start td_dtrace_start #define t_dtrace_vtime td_dtrace_vtime