From owner-cvs-all Wed Jan 10 11:35:35 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 6C01F37B402; Wed, 10 Jan 2001 11:35:05 -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 f0AJWcG87644; Wed, 10 Jan 2001 11:32:38 -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 11:35:07 -0800 (PST) From: John Baldwin To: Bruce Evans Subject: Re: cvs commit: src/sys/alpha/alpha interrupt.c machdep.c mp_mac Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org, Jake Burkholder Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 10-Jan-01 Bruce Evans wrote: > On Tue, 9 Jan 2001, Jake Burkholder wrote: > >> jake 2001/01/09 20:43:51 PST >> >> Modified files: >> sys/alpha/alpha interrupt.c machdep.c mp_machdep.c prom.c >> trap.c >> sys/dev/usb ohci.c uhci.c usbdi.c >> sys/dev/vinum vinumhdr.h vinummemory.c >> sys/i386/i386 bios.c db_interface.c machdep.c >> mp_machdep.c mpapic.c pmap.c >> sys_machdep.c trap.c vm86.c vm_machdep.c >> sys/i386/include cpu.h >> sys/i386/isa npx.c >> sys/ia64/ia64 interrupt.c mp_machdep.c >> sys/kern init_main.c kern_clock.c kern_exit.c >> kern_ktr.c kern_malloc.c kern_mutex.c >> kern_resource.c kern_shutdown.c >> kern_subr.c kern_switch.c kern_synch.c >> subr_prf.c vfs_bio.c >> sys/sys buf.h >> Log: >> Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variables >> other then curproc. > > I wish I had objected earlier to your previous changes to prepare for > this mistake. Machine-independent code shouldn't know that some > variables are per-cpu. We had perfectly good access macros named > curproc, etc. (except they weren't ifdefed right for modules). There > is no need for function-like macros, since rvalue-like variables can > always be implemented using macros (or [inline] functions) that return > the value of the variable, and lvalue-like variables can always be > implemented as `*(macro_that_returns_address_of_variable)'. This is > what the old macros did. The `SET' macros can be more efficient in > some cases, since they may be able to access the variable directly, > but we currently don't do this. In fact, even the i386 `GET' macros > have regressed from direct accesses in the %fs segment to indirect > accesses via a pointer loaded from the %fs segment. 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 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. > The corresponding changes for curproc would affect approximately 606 > lines in 163 files. curproc will certainly be the last to be converted. Even BSD/OS has compat macros for this still. However, making the kernel SMP aware is going to cause changes in interfaces. We can't rework the kernel and expect nothing to change. > Bruce -- 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