From owner-freebsd-current Sun Feb 24 17: 9:49 2002 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 7F3CE37B429; Sun, 24 Feb 2002 17:09:21 -0800 (PST) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id MAA14917; Mon, 25 Feb 2002 12:09:13 +1100 Date: Mon, 25 Feb 2002 12:09:34 +1100 (EST) From: Bruce Evans X-X-Sender: To: Matthew Dillon Cc: Terry Lambert , Alfred Perlstein , Bosko Milekic , Seigo Tanimura , , John Baldwin Subject: Re: Success! critical_enter()/critical_exit() revamp (was Re: malloc_bucket() idea (was Re: How to fix malloc.)) In-Reply-To: <200202241109.g1OB9cn68688@apollo.backplane.com> Message-ID: <20020225111741.S36145-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, 24 Feb 2002, Matthew Dillon wrote: > Bruce, your sys.dif was *invaluable*! It would have taken me a lot > longer to figure out the interrupt disablement requirement around > the icu_lock, and the statclock and hardclock forwarding issues (which I > got working by the way!). Thanks. > It turns out that putting the pending masks in the per-cpu area was > the right solution! It made statclock and hardclock forwarding easy > (I can see why you didn't even try in your patch set, doing it with > a global mask would be nearly impossible). In fact, it made everything > unbelievably easy. > ... [This paragraph reordered] > up. One of the best things about this patch set is that it is really > flexible. We should be able to really make interrupts fly. In fact, > it should even be possible for one cpu to steal another cpu's pending > interrupt(s) fairly trivially, without having to resort to IPIs. Good idea. Stealing would be even easier if the mask were global :-). > The second issue is that cpu_switch() does not save/restore the > PSL_I (interrupt disablement mask). I added a PSL word to the PCB > structure to take care of the problem. Without this if you have > a thread switch away while holding interrupts hard-disabled, the > next thread will inherit the hard disablement. I saw the sti's > you added in various places but I figured the best solution was > to simply save/restore the state. The original code didn't have cpu_switch() certainly needs to do this if it can be called with the interrupt enable flag[s] in different states. I need the sti's (actually enable_intr()'s because I don't want fast interrupts to be disabled during context switches. This works because enabling interrupts is sure to be safe, since we might be switching to a thread that will enable them. Some sort of lock is needed to prevent interrupts interfering with the switch. I think soft-masking them in critical_enter() is sufficient in your version too. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message