From owner-freebsd-threads@FreeBSD.ORG Thu Sep 25 17:21:01 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 51D8816A4B3; Thu, 25 Sep 2003 17:21:01 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 99C9243FE5; Thu, 25 Sep 2003 17:21:00 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id h8Q0KxgG029176; Thu, 25 Sep 2003 20:21:00 -0400 (EDT) Date: Thu, 25 Sep 2003 20:20:59 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: David Xu In-Reply-To: <200309260806.57365.davidxu@FreeBSD.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: threads@FreeBSD.org Subject: Re: THR and KSE platform support (again) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Sep 2003 00:21:01 -0000 [CC list trimmed, sent to threads@] On Fri, 26 Sep 2003, David Xu wrote: > On Friday 26 September 2003 06:57, Daniel Eischen wrote: > > > I have some ideas may not related to this topics: > > > On alpha, we need Memory Barrier for kse_crtical_enter. > > > Because we always have following access pattern: > > > kse_critical_enter(); > > > KSE_SCHED_LOCK(curthread->kse, curthread->kse->k_kseg); > > > if there is no Memory barrier in kse_critical_enter, then > > > read ahead of curthread->kse by CPU is wrong. > > > I have a small patch for kcd_critical_enter for alpha. > > > > I thought atomic_{load,store}_{acq,rel} would give us > > appropriate memory barriers. Or are we not always using > > these functions where we should be? > > > kcb_critical_enter on alpha is not using atomic instructions, > out of order read/write makes kcb_critical_enter not work > on SMP. Yes, I see what you mean. If it is isolated to MD functions like kcb_critical_enter() I would either use the atomic_ functions, or add the memory barrier directly to those functions. Hopefully, we can keep MI parts free of memory barriers. -- Dan Eischen