Date: Thu, 19 Dec 2002 12:29:13 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: John Baldwin <jhb@FreeBSD.ORG> Cc: Terry Lambert <tlambert2@mindspring.com>, Alex <akruijff@dds.nl>, <phk@FreeBSD.ORG>, Johnson David <DavidJohnson@Siemens.com>, <current@FreeBSD.ORG> Subject: Re: 80386 out of GENERIC Message-ID: <20021219121215.N28416-100000@gamplex.bde.org> In-Reply-To: <XFMail.20021218122338.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 Dec 2002, John Baldwin wrote: > On 18-Dec-2002 Terry Lambert wrote: > > The pessimization that was being discussed right before that happened > > was "harvesting entropy for /dev/random". I can provide mailing list > > quotes about that bracketing those dates. > > No, the pessimization is: > > #if defined(I386_CPU) || defined(CPU_DISABLE_CMPXCHG) > > static __inline int > atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) > { > int res = exp; > > __asm __volatile( > " pushfl ; " > " cli ; " > " cmpl %0,%2 ; " > " jne 1f ; " > " movl %1,%2 ; " > "1: " > " sete %%al; " > " movzbl %%al,%0 ; " > " popfl ; " > "# atomic_cmpset_int" > : "+a" (res) /* 0 (result) */ > : "r" (src), /* 1 */ > "m" (*(dst)) /* 2 */ > : "memory"); > > return (res); > } > > #else /* defined(I386_CPU) */ > > static __inline int > atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) > { > int res = exp; > > __asm __volatile ( > " " __XSTRING(MPLOCKED) " " > " cmpxchgl %1,%2 ; " > " setz %%al ; " > " movzbl %%al,%0 ; " > "1: " > "# atomic_cmpset_int" > : "+a" (res) /* 0 (result) */ > : "r" (src), /* 1 */ > "m" (*(dst)) /* 2 */ > : "memory"); > > return (res); > } > > #endif /* defined(I386_CPU) */ > > > Was there a particular pessimization other than /dev/random that you > > were thinking of when you made the commit comment? > > Yes, the one above. It came in as part of SMPng. I think this is an insignificant pessimization (except for vmware). The main issue is that the i386 version doesn't actually work for SMP. It would need to be more comlicated and pessimal to work. BTW, I have micro-optimized the above (to usually avoid the movzbl and to allocate registers better, especially the hard register %al). One reason that I haven't committed the changes is that I haven't got around to testing them for the CPU_I386 case. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021219121215.N28416-100000>