Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Mon, Feb 18, 2019 at 04:03:05PM +0200, Konstantin Belousov wrote: > On Mon, Feb 18, 2019 at 12:37:45PM +0100, Herbert J. Skuhra wrote: > > On Mon, Feb 18, 2019 at 09:58:14AM +0200, Konstantin Belousov wrote: > > > On Sun, Feb 17, 2019 at 11:22:48PM +0100, Herbert J. Skuhra wrote: > > > > On Sun, 17 Feb 2019 22:19:16 +0100, Konstantin Belousov wrote: > > > > > > > > > > On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > > > > > > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > > > > > > > > > > > Author: kib > > > > > > > Date: Fri Feb 15 11:33:48 2019 > > > > > > > New Revision: 344157 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > > > > > > > > > > > Log: > > > > > > > MFC r343855, r343859: > > > > > > > Use ifunc to select the barrier instruction for RDTSC. > > > > > > > > > > > > > > Modified: > > > > > > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > > > > > > Directory Properties: > > > > > > > stable/12/ (props changed) > > > > > > > > > > > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > > > > > > system is unusable. Basically all programs produce a "Segmentation > > > > > > fault (core dumped)": > > > > > > > > > > > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > > > > > > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > > > > > > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > > pid 877 (su), jid 0, uid 0: exited on signal 11 > > > > > > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > > pid 885 (sudo), jid 0, uid 0: exited on signal 11 > > > > > > > > > > What do you have in your make.conf and src.conf ? > > > > > > > > I am building on a faster machine with a Intel(R) Xeon(R) CPU. > > > > > > > > /etc/src.conf: > > > > > > > > WITHOUT_DEBUG_FILES= > > > > WITHOUT_KERNEL_SYMBOLS= > > > > WITHOUT_PROFILE= > > > > WITH_KERNEL_RETPOLINE= > > > > > > > WITH_RETPOLINE= > > > ^^ > > > Remove this setting and rebuild the world. > > > Is it still broken ? > > > > No, without the line "WITH_RETPOLINE=" the system is OK. > > Which version of clang do you get ? It was recently bumped from 6.0.1 > to 7.0.1, and there was a ifunc use in libc in quite fundamental place > already. Build machine is still on stable/12 r343834 (clang 6.0.1). Problem starts with r344157 (also clang 6.0.1). Now the affected machine runs r344247 (clang 7.0.1). -- Herbert ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Mon, Feb 18, 2019 at 12:37:45PM +0100, Herbert J. Skuhra wrote: > On Mon, Feb 18, 2019 at 09:58:14AM +0200, Konstantin Belousov wrote: > > On Sun, Feb 17, 2019 at 11:22:48PM +0100, Herbert J. Skuhra wrote: > > > On Sun, 17 Feb 2019 22:19:16 +0100, Konstantin Belousov wrote: > > > > > > > > On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > > > > > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > > > > > > > > > Author: kib > > > > > > Date: Fri Feb 15 11:33:48 2019 > > > > > > New Revision: 344157 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > > > > > > > > > Log: > > > > > > MFC r343855, r343859: > > > > > > Use ifunc to select the barrier instruction for RDTSC. > > > > > > > > > > > > Modified: > > > > > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > > > > > Directory Properties: > > > > > > stable/12/ (props changed) > > > > > > > > > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > > > > > system is unusable. Basically all programs produce a "Segmentation > > > > > fault (core dumped)": > > > > > > > > > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > > > > > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > > > > > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > pid 877 (su), jid 0, uid 0: exited on signal 11 > > > > > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > > pid 885 (sudo), jid 0, uid 0: exited on signal 11 > > > > > > > > What do you have in your make.conf and src.conf ? > > > > > > I am building on a faster machine with a Intel(R) Xeon(R) CPU. > > > > > > /etc/src.conf: > > > > > > WITHOUT_DEBUG_FILES= > > > WITHOUT_KERNEL_SYMBOLS= > > > WITHOUT_PROFILE= > > > WITH_KERNEL_RETPOLINE= > > > > > WITH_RETPOLINE= > > ^^ > > Remove this setting and rebuild the world. > > Is it still broken ? > > No, without the line "WITH_RETPOLINE=" the system is OK. Which version of clang do you get ? It was recently bumped from 6.0.1 to 7.0.1, and there was a ifunc use in libc in quite fundamental place already. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Mon, Feb 18, 2019 at 09:58:14AM +0200, Konstantin Belousov wrote: > On Sun, Feb 17, 2019 at 11:22:48PM +0100, Herbert J. Skuhra wrote: > > On Sun, 17 Feb 2019 22:19:16 +0100, Konstantin Belousov wrote: > > > > > > On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > > > > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > > > > > > > Author: kib > > > > > Date: Fri Feb 15 11:33:48 2019 > > > > > New Revision: 344157 > > > > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > > > > > > > Log: > > > > > MFC r343855, r343859: > > > > > Use ifunc to select the barrier instruction for RDTSC. > > > > > > > > > > Modified: > > > > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > > > > Directory Properties: > > > > > stable/12/ (props changed) > > > > > > > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > > > > system is unusable. Basically all programs produce a "Segmentation > > > > fault (core dumped)": > > > > > > > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > > > > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > > > > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > pid 877 (su), jid 0, uid 0: exited on signal 11 > > > > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > > > > pid 885 (sudo), jid 0, uid 0: exited on signal 11 > > > > > > What do you have in your make.conf and src.conf ? > > > > I am building on a faster machine with a Intel(R) Xeon(R) CPU. > > > > /etc/src.conf: > > > > WITHOUT_DEBUG_FILES= > > WITHOUT_KERNEL_SYMBOLS= > > WITHOUT_PROFILE= > > WITH_KERNEL_RETPOLINE= > > > WITH_RETPOLINE= > ^^ > Remove this setting and rebuild the world. > Is it still broken ? No, without the line "WITH_RETPOLINE=" the system is OK. Thanks. -- Herbert ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Sun, Feb 17, 2019 at 11:22:48PM +0100, Herbert J. Skuhra wrote: > On Sun, 17 Feb 2019 22:19:16 +0100, Konstantin Belousov wrote: > > > > On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > > > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > > > > > Author: kib > > > > Date: Fri Feb 15 11:33:48 2019 > > > > New Revision: 344157 > > > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > > > > > Log: > > > > MFC r343855, r343859: > > > > Use ifunc to select the barrier instruction for RDTSC. > > > > > > > > Modified: > > > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > > > Directory Properties: > > > > stable/12/ (props changed) > > > > > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > > > system is unusable. Basically all programs produce a "Segmentation > > > fault (core dumped)": > > > > > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > > > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > > > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > > > pid 877 (su), jid 0, uid 0: exited on signal 11 > > > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > > > pid 885 (sudo), jid 0, uid 0: exited on signal 11 > > > > What do you have in your make.conf and src.conf ? > > I am building on a faster machine with a Intel(R) Xeon(R) CPU. > > /etc/src.conf: > > WITHOUT_DEBUG_FILES= > WITHOUT_KERNEL_SYMBOLS= > WITHOUT_PROFILE= > WITH_KERNEL_RETPOLINE= > WITH_RETPOLINE= ^^ Remove this setting and rebuild the world. Is it still broken ? > INSTALL_NODEBUG= > WITHOUT_TESTS= > WITHOUT_GAMES= > > /etc/make.conf contains only a line for KERNCONF and DEFAULT_VERSIONS. > > > Can you show me CPU identification lines from dmesg for a verbose boot ? > > CPU: Genuine Intel(R) CPU@ 1.60GHz (1600.06-MHz K8-class CPU) > Origin="GenuineIntel" Id=0x20661 Family=0x6 Model=0x26 Stepping=1 > > Features=0xbfe9fbff > > Features2=0x40e3bd > AMD Features=0x20100800 > AMD Features2=0x1 > VT-x: (disabled in BIOS) Basic Features=0x5a0400 > Pin-Based Controls=0x3f > Primary Processor > Controls=0x77f9fffe MSRmap,MONITOR,PAUSE> > Exit Controls=0x5a0400 > Entry Controls=0x5a0400 > TSC: P-state invariant, performance statistics > Data TLB0: 4 KByte pages, fully associative, 16 entries > Data TLB1: 4 KByte pages, 4-way associative, 64 entries > Instruction TLB: 4 KByte pages, 32 entries > Data TLB: 4 KByte and 4 MByte pages, 4-way associative, 8 entries > 2nd-level cache: 512 KByte, 8-way set associative, 64-byte line size > 1st-level instruction cache: 32 KB, 8-way set associative, 64 byte line size > 1st-level data cache: 24 KBytes, 6-way set associative, 64 byte line size > L2 cache: 512 kbytes, 8-way associative, 64 bytes/line > > > I suspect that you can take /lib/libc.so.7 from 12.0 RELEASE and restore > > the system. If it helps, please move your existing libc.so.7 into some > > directory, reproduce the problem with 'LD_LIBRARY_PATH= > bad libc.so.7> /bin/ls' and load the core into gdb. I want to see > > the backtrace for start. > > Yes, restoring /lib/libc.so.7 from previous build (r344152) works. > > #0 0x000800487800 in *ABS*@plt () from > /home/herbert/broken_libc/libc.so.7 > #1 0x00080048781c in *ABS*@plt () from > /home/herbert/broken_libc/libc.so.7 > #2 0x0008003f2e6a in xdr_ypresponse () from > /home/herbert/broken_libc/libc.so.7 > #3 0x000800464849 in access () from /home/herbert/broken_libc/libc.so.7 > #4 0x000800464938 in access () from /home/herbert/broken_libc/libc.so.7 > #5 0x000800429ad1 in clock_gettime () from > /home/herbert/broken_libc/libc.so.7 > #6 0x0008003b574f in madvise () from /home/herbert/broken_libc/libc.so.7 > #7 0x0008003da262 in _pthread_mutex_init_calloc_cb () from > /home/herbert/broken_libc/libc.so.7 > #8 0x0008003dc4ba in _pthread_mutex_init_calloc_cb () from > /home/herbert/broken_libc/libc.so.7 > #9 0x0008003e958c in _malloc_first_thread () from > /home/herbert/broken_libc/libc.so.7 > #10 0x0008003e7ba8 in nallocm () from /home/herbert/broken_libc/libc.so.7 > #11 0x000800214479 in r_debug_state () from /libexec/ld-elf.so.1 > #12 0x00080021305a in __tls_get_addr () from /libexec/ld-elf.so.1 > #13 0x000800211019 in ?? () from /libexec/ld-elf.so.1 > #14 0x in ?? () > > -- > Herbert ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > Author: kib > Date: Fri Feb 15 11:33:48 2019 > New Revision: 344157 > URL: https://svnweb.freebsd.org/changeset/base/344157 > > Log: > MFC r343855, r343859: > Use ifunc to select the barrier instruction for RDTSC. > > Modified: > stable/12/lib/libc/x86/sys/__vdso_gettc.c > Directory Properties: > stable/12/ (props changed) After upgrading my Soekris Net 6501-70 (amd64) to this revision the system is unusable. Basically all programs produce a "Segmentation fault (core dumped)": pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) pid 877 (su), jid 0, uid 0: exited on signal 11 pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) pid 885 (sudo), jid 0, uid 0: exited on signal 11 -- Herbert ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > Author: kib > > Date: Fri Feb 15 11:33:48 2019 > > New Revision: 344157 > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > Log: > > MFC r343855, r343859: > > Use ifunc to select the barrier instruction for RDTSC. > > > > Modified: > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > Directory Properties: > > stable/12/ (props changed) > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > system is unusable. Basically all programs produce a "Segmentation > fault (core dumped)": > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > pid 877 (su), jid 0, uid 0: exited on signal 11 > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > pid 885 (sudo), jid 0, uid 0: exited on signal 11 What do you have in your make.conf and src.conf ? Can you show me CPU identification lines from dmesg for a verbose boot ? I suspect that you can take /lib/libc.so.7 from 12.0 RELEASE and restore the system. If it helps, please move your existing libc.so.7 into some directory, reproduce the problem with 'LD_LIBRARY_PATH= /bin/ls' and load the core into gdb. I want to see the backtrace for start. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r344157 - stable/12/lib/libc/x86/sys
On Sun, 17 Feb 2019 22:19:16 +0100, Konstantin Belousov wrote: > > On Sun, Feb 17, 2019 at 10:07:09PM +0100, Herbert J. Skuhra wrote: > > On Fri, 15 Feb 2019 12:33:48 +0100, Konstantin Belousov wrote: > > > > > > Author: kib > > > Date: Fri Feb 15 11:33:48 2019 > > > New Revision: 344157 > > > URL: https://svnweb.freebsd.org/changeset/base/344157 > > > > > > Log: > > > MFC r343855, r343859: > > > Use ifunc to select the barrier instruction for RDTSC. > > > > > > Modified: > > > stable/12/lib/libc/x86/sys/__vdso_gettc.c > > > Directory Properties: > > > stable/12/ (props changed) > > > > After upgrading my Soekris Net 6501-70 (amd64) to this revision the > > system is unusable. Basically all programs produce a "Segmentation > > fault (core dumped)": > > > > pid 856 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > pid 857 (ls), jid 0, uid 1001: exited on signal 11 (core dumped) > > pid 858 (bsdtar), jid 0, uid 0: exited on signal 11 (core dumped) > > pid 859 (sh), jid 0, uid 0: exited on signal 11 (core dumped) > > pid 876 (dmesg), jid 0, uid 1001: exited on signal 11 (core dumped) > > pid 877 (su), jid 0, uid 0: exited on signal 11 > > pid 880 (more), jid 0, uid 1001: exited on signal 11 (core dumped) > > pid 885 (sudo), jid 0, uid 0: exited on signal 11 > > What do you have in your make.conf and src.conf ? I am building on a faster machine with a Intel(R) Xeon(R) CPU. /etc/src.conf: WITHOUT_DEBUG_FILES= WITHOUT_KERNEL_SYMBOLS= WITHOUT_PROFILE= WITH_KERNEL_RETPOLINE= WITH_RETPOLINE= INSTALL_NODEBUG= WITHOUT_TESTS= WITHOUT_GAMES= /etc/make.conf contains only a line for KERNCONF and DEFAULT_VERSIONS. > Can you show me CPU identification lines from dmesg for a verbose boot ? CPU: Genuine Intel(R) CPU@ 1.60GHz (1600.06-MHz K8-class CPU) Origin="GenuineIntel" Id=0x20661 Family=0x6 Model=0x26 Stepping=1 Features=0xbfe9fbff Features2=0x40e3bd AMD Features=0x20100800 AMD Features2=0x1 VT-x: (disabled in BIOS) Basic Features=0x5a0400 Pin-Based Controls=0x3f Primary Processor Controls=0x77f9fffe Exit Controls=0x5a0400 Entry Controls=0x5a0400 TSC: P-state invariant, performance statistics Data TLB0: 4 KByte pages, fully associative, 16 entries Data TLB1: 4 KByte pages, 4-way associative, 64 entries Instruction TLB: 4 KByte pages, 32 entries Data TLB: 4 KByte and 4 MByte pages, 4-way associative, 8 entries 2nd-level cache: 512 KByte, 8-way set associative, 64-byte line size 1st-level instruction cache: 32 KB, 8-way set associative, 64 byte line size 1st-level data cache: 24 KBytes, 6-way set associative, 64 byte line size L2 cache: 512 kbytes, 8-way associative, 64 bytes/line > I suspect that you can take /lib/libc.so.7 from 12.0 RELEASE and restore > the system. If it helps, please move your existing libc.so.7 into some > directory, reproduce the problem with 'LD_LIBRARY_PATH= bad libc.so.7> /bin/ls' and load the core into gdb. I want to see > the backtrace for start. Yes, restoring /lib/libc.so.7 from previous build (r344152) works. #0 0x000800487800 in *ABS*@plt () from /home/herbert/broken_libc/libc.so.7 #1 0x00080048781c in *ABS*@plt () from /home/herbert/broken_libc/libc.so.7 #2 0x0008003f2e6a in xdr_ypresponse () from /home/herbert/broken_libc/libc.so.7 #3 0x000800464849 in access () from /home/herbert/broken_libc/libc.so.7 #4 0x000800464938 in access () from /home/herbert/broken_libc/libc.so.7 #5 0x000800429ad1 in clock_gettime () from /home/herbert/broken_libc/libc.so.7 #6 0x0008003b574f in madvise () from /home/herbert/broken_libc/libc.so.7 #7 0x0008003da262 in _pthread_mutex_init_calloc_cb () from /home/herbert/broken_libc/libc.so.7 #8 0x0008003dc4ba in _pthread_mutex_init_calloc_cb () from /home/herbert/broken_libc/libc.so.7 #9 0x0008003e958c in _malloc_first_thread () from /home/herbert/broken_libc/libc.so.7 #10 0x0008003e7ba8 in nallocm () from /home/herbert/broken_libc/libc.so.7 #11 0x000800214479 in r_debug_state () from /libexec/ld-elf.so.1 #12 0x00080021305a in __tls_get_addr () from /libexec/ld-elf.so.1 #13 0x000800211019 in ?? () from /libexec/ld-elf.so.1 #14 0x in ?? () -- Herbert ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344157 - stable/12/lib/libc/x86/sys
Author: kib Date: Fri Feb 15 11:33:48 2019 New Revision: 344157 URL: https://svnweb.freebsd.org/changeset/base/344157 Log: MFC r343855, r343859: Use ifunc to select the barrier instruction for RDTSC. Modified: stable/12/lib/libc/x86/sys/__vdso_gettc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/x86/sys/__vdso_gettc.c == --- stable/12/lib/libc/x86/sys/__vdso_gettc.c Fri Feb 15 11:28:32 2019 (r344156) +++ stable/12/lib/libc/x86/sys/__vdso_gettc.c Fri Feb 15 11:33:48 2019 (r344157) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2012 Konstantin Belousov - * Copyright (c) 2016, 2017 The FreeBSD Foundation + * Copyright (c) 2016, 2017, 2019 The FreeBSD Foundation * All rights reserved. * * Portions of this software were developed by Konstantin Belousov @@ -50,15 +50,9 @@ __FBSDID("$FreeBSD$"); #ifdef WANT_HYPERV #include #endif +#include #include "libc_private.h" -static enum LMB { - LMB_UNKNOWN, - LMB_NONE, - LMB_MFENCE, - LMB_LFENCE -} lfence_works = LMB_UNKNOWN; - static void cpuidp(u_int leaf, u_int p[4]) { @@ -84,68 +78,36 @@ cpuidp(u_int leaf, u_int p[4]) : "0" (leaf)); } -static enum LMB -select_lmb(void) +static void +rdtsc_mb_lfence(void) { - u_int p[4]; - static const char intel_id[] = "GenuntelineI"; - cpuidp(0, p); - return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? - LMB_LFENCE : LMB_MFENCE); + lfence(); } static void -init_fence(void) +rdtsc_mb_mfence(void) { -#if defined(__i386__) - u_int cpuid_supported, p[4]; - lfence_works = LMB_NONE; - __asm __volatile( - " pushfl\n" - " popl%%eax\n" - " movl%%eax,%%ecx\n" - " xorl$0x20,%%eax\n" - " pushl %%eax\n" - " popfl\n" - " pushfl\n" - " popl%%eax\n" - " xorl%%eax,%%ecx\n" - " je 1f\n" - " movl$1,%0\n" - " jmp 2f\n" - "1: movl$0,%0\n" - "2:\n" - : "=r" (cpuid_supported) : : "eax", "ecx", "cc"); - if (cpuid_supported) { - cpuidp(0x1, p); - if ((p[3] & CPUID_SSE2) != 0) - lfence_works = select_lmb(); - } -#elif defined(__amd64__) - lfence_works = select_lmb(); -#else -#error "Arch" -#endif + mfence(); } static void -rdtsc_mb(void) +rdtsc_mb_none(void) { +} -again: - if (__predict_true(lfence_works == LMB_LFENCE)) { - lfence(); - return; - } else if (lfence_works == LMB_MFENCE) { - mfence(); - return; - } else if (lfence_works == LMB_NONE) { - return; - } - init_fence(); - goto again; +DEFINE_UIFUNC(static, void, rdtsc_mb, (void), static) +{ + u_int p[4]; + /* Not a typo, string matches our cpuidp() registers use. */ + static const char intel_id[] = "GenuntelineI"; + + if ((cpu_feature & CPUID_SSE2) == 0) + return (rdtsc_mb_none); + cpuidp(0, p); + return (memcmp(p + 1, intel_id, sizeof(intel_id) - 1) == 0 ? + rdtsc_mb_lfence : rdtsc_mb_mfence); } static u_int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"