From owner-cvs-all Wed Jan 10 15:54:50 2001 Delivered-To: cvs-all@freebsd.org Received: from meow.osd.bsdi.com (meow.osd.bsdi.com [204.216.28.88]) by hub.freebsd.org (Postfix) with ESMTP id 53F5937B6A2; Wed, 10 Jan 2001 15:54:26 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by meow.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id f0ANrj194377; Wed, 10 Jan 2001 15:53:46 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Wed, 10 Jan 2001 15:53:58 -0800 (PST) From: John Baldwin To: =?ISO-8859-1?Q?G=E9rard_Roudier?= Subject: Re: cvs commit: src/sys/alpha/alpha interrupt.c machdep.c mp_mac Cc: Jake Burkholder , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Bruce Evans Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 10-Jan-01 Gérard Roudier wrote: > > On Wed, 10 Jan 2001, John Baldwin wrote: >> There is nothign wrong with MI code knowing that it is running on a >> SMP-aware >> kernel. SMP is something that shouldn't be grafted into the side of the >> kernel, it is something it should be fully aware of. The locking >> requirements > > Per-cpu variables donnot bite us this more in SMP than in UP, as opposed > to shared variables. Godzilling stuff that accesses to these variables > looks like paranoia to me. If it is intended to apply the same approach to > shared variables, the SMP-over-aware kernel code would well resemble > rather Cobol than C code. ;-) No, shared variables are just variables. Here is the problem. There is no 'curproc' variable. There is a gd_curproc member of a struct globaldata, and each CPU has a struct globaldata tied to it. We can obtain it via PCPU_GET(curproc), or set it via PCPU_SET(curproc, myproc). Having a 'curproc' "magic" variable that doesn't exist that we assume we can read and write to like any other variable is a lot more hokie than admitting that we are accessing a special variable in a special way. >> are different for per-cpu variables than for global ones for example. (Most >> per-cpu variables don't need locking since they aren't contended, as opposed >> to >> shared variables.) The macros can be made more efficient for the common >> case >> (in fact, Jake already has it done) but that is an optimization that can be >> done later. For now let's focus on getting this working right and worry >> about >> optimization later. > > You seem to have been notified that you started with an immediate > pessimization. Only on the 386 UP case are these macros a pessimization. In fact, if you look at the old code, all these macros already existed, they just weren't used. (Instead we #define'd things liek curproc to GLOBAL_LVALUE_NV(curproc) and other weirdness). Also, Jake has another version of these macros that is more optimized that doesn't have the extra indirection. However, there is a growing problem here that I want to state so that everyone doesn't jump up and down every time we add a clock cycle somewhere: Let's get it _right_ first, and optimize later. Please, with the current state of -current (as many of you should be well aware, you certainly complain about it enough) getting things working correctly is _much_ more important than making our machines panic 1us faster than they do now. Ok? Come on, we knew we were going to be making lots of changes with this stuff, let's get it right first. The bigger gains in performance are going to be in the increased parallelism and in reworking algorithms to be more efficient. Micro-optimizations can be done _last_. I would much rather 5.0 be stable and a bit slower than something that is rip-roaring fast but can't make it through a make world w/o panic'ing. Some of the upcoming changes are going to really turn the kernel on its head. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message