Subject: Re: /dev/random cleanup [sommerfeld@netbsd.org: CVS commit: syssrc]
To: Simon Burge <simonb@netbsd.org>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: source-changes
Date: 06/05/2000 21:19:02
> One questions - would be be better to store the results of the test
> 
> +#ifdef __HAVE_CPU_TIMESTAMP
> +       if (cpu_hastimestamp())
> +               return cpu_timestamp();
> +#endif
> 
> in a static variable?  I notice that the test is both inline and
> inexpensive on the i386 example, but this may not be on other platforms.
> Hmm, or maybe make cpu_hastimestamp() a stub call on platforms where
> this test would be expensive and leave this fragment as is...

On i386 at least (at least off on the SMP branch), I can see this
codepath potentially getting invoked before the cpu_feature global it
tests is set correctly (e.g., from the console driver via ddb), which
would result in a spurious cached negative result.  Letting the MD
code decide whether caching is needed should do the trick (indeed, the
i386 MD code is already caching the result.. it's not doing the
relevant cpuid call each time..).

					- Bill