From owner-freebsd-smp Mon Oct 23 10: 0:15 2000 Delivered-To: freebsd-smp@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id B9CF137B4C5 for ; Mon, 23 Oct 2000 10:00:12 -0700 (PDT) Received: from zeppo.feral.com (IDENT:mjacob@zeppo [192.67.166.71]) by feral.com (8.9.3/8.9.3) with ESMTP id JAA04745; Mon, 23 Oct 2000 09:59:52 -0700 Date: Mon, 23 Oct 2000 09:57:01 -0700 (PDT) From: Matthew Jacob Reply-To: mjacob@feral.com To: Poul-Henning Kamp Cc: freebsd-smp@freebsd.org Subject: Re: cvs commit: src/sys/sys mutex.h In-Reply-To: <13423.972326495@critter> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > Well, my take on this is that the main problem is that curproc is two > entirely different things for SMP vs UP. That clearly makes all KLD's > toast unless compiled for the right thing. That needs fixed. > > In general "#ifdef SMP" should be minimized and in particular no > KLD's should need to know about it. > > I think a function to get the current thread/proc should not require > to be included, most places just need to pass a reference, > they don't need to even know how the entrails of a proccess is > arranged, so obviously they should not need #included. From solaris: extern kthread_id_t threadp(void); /* inline, returns thread pointer */ #define curthread (threadp()) /* current thread pointer */ #define curproc (ttoproc(curthread)) /* current process */ Strictly speaking, not an inline- but instead a per-platform locore.s function- on sun4u it's: retl mov THREAD_REG, %o0 On i86 it's: movl %gs:CPU_THREAD, %eax ret This approach solves the KLD issue. But we have to get everyone to agree that even UP kernels have to pay the cost of even trivial function reference instead of linktime binding. Anyone else have some comments? -matt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message