Date: Wed, 25 Jul 2012 20:01:42 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Jim Harris <jim.harris@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon <avg@freebsd.org> Subject: Re: svn commit: r238755 - head/sys/x86/x86 Message-ID: <20120725170142.GM2676@deviant.kiev.zoral.com.ua> In-Reply-To: <CAJP=Hc_9ehs9OVemqYxWqQnasBF1VH8N4V3xLfJHuDeESSU08w@mail.gmail.com> References: <201207242210.q6OMACqV079603@svn.freebsd.org> <500F9E22.4080608@FreeBSD.org> <20120725102130.GH2676@deviant.kiev.zoral.com.ua> <500FE6AE.8070706@FreeBSD.org> <20120725133754.GK2676@deviant.kiev.zoral.com.ua> <CAJP=Hc_9ehs9OVemqYxWqQnasBF1VH8N4V3xLfJHuDeESSU08w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--IwdZRIiUtqUn88AE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 25, 2012 at 08:29:57AM -0700, Jim Harris wrote: > On Wed, Jul 25, 2012 at 6:37 AM, Konstantin Belousov > <kostikbel@gmail.com> wrote: > > -/* rmb is required here because rdtsc is not a serializing instruction= . */ > > +/* > > + * RDTSC is not a serializing instruction, so we need to drain > > + * instruction stream before executing it. It could be fixed by use of > > + * RDTSCP, except the instruction is not available everywhere. > > + * > > + * Insert both MFENCE for AMD CPUs, and LFENCE for others (Intel and > > + * VIA), and assume that SMP test is only performed on CPUs that have > > + * SSE2 anyway. > > + */ > > #define TSC_READ(x) \ > > static void \ > > tsc_read_##x(void *arg) \ > > @@ -337,6 +361,7 @@ tsc_read_##x(void *arg) \ > > u_int cpu =3D PCPU_GET(cpuid); \ > > \ > > rmb(); \ > > + mb(); \ > > tsc[cpu * 3 + x] =3D rdtsc32(); \ >=20 > I've seen bde@'s comments, so perhaps this patch will not move > forward, but I'm wondering if it would make sense here to just call > the new tsc_get_timecount_mfence() function rather than explicitly > call mb() and then rdtsc32(). I think that this in fact shall call cpuid() instead of rmb()/mb(). The genuine Pentiums, PentiumPro and Pentium II/III can be used in SMP configuration but definitely lack LFENCE. Regarding the patch, either it or some close relative to it shall be implemented, since otherwise we are simply incorrect, as you demonstrated. --IwdZRIiUtqUn88AE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlAQJnYACgkQC3+MBN1Mb4i5AgCgiW2xQex3PvC3EY0wKOylby1h GKoAoNx1UV/w7SNmiPajaTMdOerb+VKj =qD7F -----END PGP SIGNATURE----- --IwdZRIiUtqUn88AE--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120725170142.GM2676>