From owner-svn-src-all@FreeBSD.ORG Wed Jul 25 17:01:53 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1478B106566B; Wed, 25 Jul 2012 17:01:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id A2B398FC08; Wed, 25 Jul 2012 17:01:52 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q6PH1t8M058665; Wed, 25 Jul 2012 20:01:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q6PH1hOS090179; Wed, 25 Jul 2012 20:01:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q6PH1hDS090178; Wed, 25 Jul 2012 20:01:43 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 25 Jul 2012 20:01:42 +0300 From: Konstantin Belousov To: Jim Harris Message-ID: <20120725170142.GM2676@deviant.kiev.zoral.com.ua> 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> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IwdZRIiUtqUn88AE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon Subject: Re: svn commit: r238755 - head/sys/x86/x86 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Jul 2012 17:01:53 -0000 --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 > 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--