Date: Wed, 16 Mar 2011 16:57:53 +1100 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Maxim Dounin <mdounin@mdounin.ru> Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Jung-uk Kim <jkim@FreeBSD.org> Subject: Re: svn commit: r219679 - head/sys/i386/include Message-ID: <20110316164727.Y4107@besplex.bde.org> In-Reply-To: <20110316004503.GM99496@mdounin.ru> References: <201103152145.p2FLjAlt060256@svn.freebsd.org> <20110316004503.GM99496@mdounin.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 16 Mar 2011, Maxim Dounin wrote: > On Tue, Mar 15, 2011 at 09:45:10PM +0000, Jung-uk Kim wrote: > >> Author: jkim >> Date: Tue Mar 15 21:45:10 2011 >> New Revision: 219679 >> URL: http://svn.freebsd.org/changeset/base/219679 >> >> Log: >> Partially revert r219672. After r198295, kernel need to seed randomness as >> ... >> Modified: head/sys/i386/include/cpu.h >> ============================================================================== >> --- head/sys/i386/include/cpu.h Tue Mar 15 21:34:10 2011 (r219678) >> +++ head/sys/i386/include/cpu.h Tue Mar 15 21:45:10 2011 (r219679) >> @@ -69,10 +69,14 @@ void swi_vm(void *); >> static __inline uint64_t >> get_cyclecount(void) >> { >> +#if defined(I486_CPU) || defined(KLD_MODULE) >> struct bintime bt; >> >> binuptime(&bt); >> return ((uint64_t)bt.sec << 56 | bt.frac >> 8); >> +#else >> + return (rdtsc()); >> +#endif > > This isn't really different as long as GENERIC kernel used, as > GENERIC defines I486_CPU. Also, the KLD_MODULE case is broken. This restores the ifdefs but not the tsc_present check in the old version. The ifdefs are not sort of necessary, but they seem to have been bogus in the old version. Just checking a runtime variable like tsc_present would have worked provided the variable existed. tsc.c is standard so the variable existed even if I486_CPU or KLD_MODULE was defined. I think TSC support was standard even when get_cyclecount() was first committed and had an I386_CPU ifdef, so the ifdef was always bogus. The ifdef gave a micro-optimization in some cases, but it was a very tiny one (avoid a perfectly predictable branch). Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110316164727.Y4107>