From owner-svn-src-all@freebsd.org Sun Aug 13 13:38:16 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F4165DE21EA; Sun, 13 Aug 2017 13:38:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8799C6EB35; Sun, 13 Aug 2017 13:38:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v7DDbaFg067559 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 13 Aug 2017 16:37:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v7DDbaFg067559 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v7DDbagC067558; Sun, 13 Aug 2017 16:37:36 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 13 Aug 2017 16:37:36 +0300 From: Konstantin Belousov To: Andre Albsmeier Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: Re: svn commit: r322345 - stable/11/lib/libc/x86/sys Message-ID: <20170813133736.GO1700@kib.kiev.ua> References: <201708100900.v7A90FjI094474@repo.freebsd.org> <20170813131311.GA24473@voyager> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170813131311.GA24473@voyager> User-Agent: Mutt/1.8.3 (2017-05-23) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 13 Aug 2017 13:38:16 -0000 On Sun, Aug 13, 2017 at 03:13:11PM +0200, Andre Albsmeier wrote: > On Thu, 10-Aug-2017 at 09:00:15 +0000, Konstantin Belousov wrote: > > Author: kib > > Date: Thu Aug 10 09:00:15 2017 > > New Revision: 322345 > > URL: https://svnweb.freebsd.org/changeset/base/322345 > > > > Log: > > MFC r321608: > > Use MFENCE to serialize RDTSC on non-Intel CPUs. > > This broke libc on my > > FreeBSD clang version 4.0.0 (tags/RELEASE_400/final 297347) (based on LLVM 4.0.0) > VT(vga): text 80x25 > CPU: AMD-K6tm w/ multimedia extensions (199.44-MHz 586-class CPU) > Origin="AuthenticAMD" Id=0x562 Family=0x5 Model=0x6 Stepping=2 > Features=0x8001bf > AMD Features=0x400<> > > On system start, it actually makes various programmes hang until > Ctrl-C is pressed. Reboot is not possible (endlessly hanging with > 'zillions of defunct processes). > > Going back to r322042 fixes it... Indeed code is broken on i386 machines which have CPUID but no SSE. Try this. diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c index 4ada5e7eac1..ef2ca69edf7 100644 --- a/lib/libc/x86/sys/__vdso_gettc.c +++ b/lib/libc/x86/sys/__vdso_gettc.c @@ -101,6 +101,7 @@ init_fence(void) #if defined(__i386__) u_int cpuid_supported, p[4]; + lfence_works = LMB_NONE; __asm __volatile( " pushfl\n" " popl %%eax\n" @@ -121,8 +122,7 @@ init_fence(void) cpuidp(0x1, p); if ((p[3] & CPUID_SSE2) != 0) lfence_works = select_lmb(); - } else - lfence_works = LMB_NONE; + } #elif defined(__amd64__) lfence_works = select_lmb(); #else