From owner-svn-src-head@FreeBSD.ORG Tue Jan 26 20:26:53 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E7F91065679; Tue, 26 Jan 2010 20:26:53 +0000 (UTC) (envelope-from xcllnt@mac.com) Received: from asmtpout026.mac.com (asmtpout026.mac.com [17.148.16.101]) by mx1.freebsd.org (Postfix) with ESMTP id 2D3A78FC17; Tue, 26 Jan 2010 20:26:52 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=us-ascii Received: from macbook-pro.jnpr.net (natint3.juniper.net [66.129.224.36]) by asmtp026.mac.com (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTPSA id <0KWV00K0FFG4IK30@asmtp026.mac.com>; Tue, 26 Jan 2010 12:26:30 -0800 (PST) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx engine=5.0.0-0908210000 definitions=main-1001260165 From: Marcel Moolenaar In-reply-to: <20100126.130932.722022410132669562.imp@bsdimp.com> Date: Tue, 26 Jan 2010 12:26:27 -0800 Message-id: <3023270A-755A-4BCF-AC9A-C1F290052279@mac.com> References: <3bbf2fe11001260058i65604619l664bd0e49c1dbbd@mail.gmail.com> <3bbf2fe11001260339u7a694069m6a2bb7e18b2c546a@mail.gmail.com> <20100126.130932.722022410132669562.imp@bsdimp.com> To: "M. Warner Losh" X-Mailer: Apple Mail (2.1077) Cc: src-committers@freebsd.org, jhb@freebsd.org, svn-src-all@freebsd.org, attilio@freebsd.org, marcel@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r202889 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2010 20:26:53 -0000 On Jan 26, 2010, at 12:09 PM, M. Warner Losh wrote: > cpu_switch(struct thread *old, struct thread *new, struct mutext *mtx) > { > /* Save the registers to the pcb */ > old->td_lock = mtx; > #if defined(SMP) && defined(SCHED_ULE) > /* s/long/int/ if sizeof(long) != sizeof(void *) */ > /* as we have no 'void *' version of the atomics */ > while (atomic_load_acq_long(&new->td_lock) == (long)&blocked_lock) > continue; > #endif > /* Switch to new context */ > } Ok. So this is what ia64 has already, except for the atomic_load() in the while loop. Since td_lock is volatile, I don't think we need atomic_load(). To be explicit, ia64 has: old->td_lock = mtx; #if defined(SCHED_ULE) && defined(SMP) /* td_lock is volatile */ while (new->td_lock == &blocked_lock) ; #endif Am I right, or am I missing a critical aspect of using atomic load? > I also think that we should have that code somewhere for reference. Since ia64 has a C implementation of cpu_switch(), we could make that the reference implementation? -- Marcel Moolenaar xcllnt@mac.com