Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Introduce libc_aligned.so for evbppc-powerpc32, which provides



details:   https://anonhg.NetBSD.org/src/rev/1c29240c9493
branches:  trunk
changeset: 366554:1c29240c9493
user:      rin <rin%NetBSD.org@localhost>
date:      Mon May 30 15:06:54 2022 +0000

description:
Introduce libc_aligned.so for evbppc-powerpc32, which provides
strictly-aligned versions of memcmp(3), bcopy(3), memcpy(3), and
memmove(3).

This is used for 403 by ld.so.conf with machdep.no_unaligned variable.

With this library, unaligned memory accesses are significantly reduced
for 403 (from several hundreds to few tens per sec under heavy load);
only ld.elf_so (typically few times per fork) and statically-linked
binaries do such access.

diffstat:

 distrib/sets/lists/base/md.evbppc          |   8 +++++++-
 distrib/sets/lists/comp/md.evbppc          |   4 +++-
 distrib/sets/lists/debug/md.evbppc         |   5 ++++-
 distrib/sets/lists/etc/md.evbppc           |   2 ++
 etc/Makefile                               |   5 +++--
 etc/etc.evbppc/ld.so.conf                  |   1 +
 lib/Makefile                               |   5 ++++-
 lib/libc_aligned/Makefile                  |  28 ++++++++++++++++++++++++++++
 lib/libc_aligned/arch/powerpc/Makefile.inc |  15 +++++++++++++++
 lib/libc_aligned/shlib_version             |   5 +++++
 10 files changed, 72 insertions(+), 6 deletions(-)

diffs (155 lines):

diff -r 7396c18cf3eb -r 1c29240c9493 distrib/sets/lists/base/md.evbppc
--- a/distrib/sets/lists/base/md.evbppc Mon May 30 14:48:08 2022 +0000
+++ b/distrib/sets/lists/base/md.evbppc Mon May 30 15:06:54 2022 +0000
@@ -1,4 +1,10 @@
-# $NetBSD: md.evbppc,v 1.1 2022/01/12 15:35:51 martin Exp $
+# $NetBSD: md.evbppc,v 1.2 2022/05/30 15:06:54 rin Exp $
+./lib/libc_aligned.so          base-sys-shlib  dynamicroot,!machine_arch=powerpc64
+./lib/libc_aligned.so.0                base-sys-shlib  dynamicroot,!machine_arch=powerpc64
+./lib/libc_aligned.so.0.0      base-sys-shlib  dynamicroot,!machine_arch=powerpc64
+./usr/lib/libc_aligned.so      base-sys-shlib  pic,!machine_arch=powerpc64
+./usr/lib/libc_aligned.so.0    base-sys-shlib  pic,!machine_arch=powerpc64
+./usr/lib/libc_aligned.so.0.0  base-sys-shlib  pic,!machine_arch=powerpc64
 ./usr/share/sysinst/catalog/sysinstmsgs.de     base-util-share
 ./usr/share/sysinst/catalog/sysinstmsgs.es     base-util-share
 ./usr/share/sysinst/catalog/sysinstmsgs.fr     base-util-share
diff -r 7396c18cf3eb -r 1c29240c9493 distrib/sets/lists/comp/md.evbppc
--- a/distrib/sets/lists/comp/md.evbppc Mon May 30 14:48:08 2022 +0000
+++ b/distrib/sets/lists/comp/md.evbppc Mon May 30 15:06:54 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.evbppc,v 1.17 2018/07/12 10:46:40 maxv Exp $
+# $NetBSD: md.evbppc,v 1.18 2022/05/30 15:06:54 rin Exp $
 ./usr/include/evbppc                           comp-c-include
 ./usr/include/evbppc/_G_config.h               comp-obsolete           obsolete
 ./usr/include/evbppc/ansi.h                    comp-c-include
@@ -59,3 +59,5 @@
 ./usr/include/evbppc/vmparam.h                 comp-c-include
 ./usr/include/evbppc/wchar_limits.h            comp-c-include
 ./usr/include/ieeefp.h                         comp-c-include
+./usr/lib/libc_aligned.a       comp-c-lib      !machine_arch=powerpc64
+./usr/lib/libc_aligned_p.a     comp-c-lib      !machine_arch=powerpc64
diff -r 7396c18cf3eb -r 1c29240c9493 distrib/sets/lists/debug/md.evbppc
--- a/distrib/sets/lists/debug/md.evbppc        Mon May 30 14:48:08 2022 +0000
+++ b/distrib/sets/lists/debug/md.evbppc        Mon May 30 15:06:54 2022 +0000
@@ -1,4 +1,5 @@
-# $NetBSD: md.evbppc,v 1.1 2021/12/31 16:15:58 christos Exp $
+# $NetBSD: md.evbppc,v 1.2 2022/05/30 15:06:54 rin Exp $
+./usr/lib/libc_aligned_g.a                     comp-c-debuglib         debuglib,!machine_arch=powerpc64
 ./usr/libdata/debug/netbsd-esata-P2020DS.debug comp-sysutil-debug      debug
 ./usr/libdata/debug/netbsd-ld0a-INSTALL_TWRP1025.debug comp-sysutil-debug      debug
 ./usr/libdata/debug/netbsd-ld0a-TWRP1025.debug comp-sysutil-debug      debug
@@ -11,3 +12,5 @@
 ./usr/libdata/debug/nfsnetbsd-P2020RDB.debug   comp-sysutil-debug      debug
 ./usr/libdata/debug/nfsnetbsd-RB800.debug      comp-sysutil-debug      debug
 ./usr/libdata/debug/nfsnetbsd-TWRP1025.debug   comp-sysutil-debug      debug
+./usr/libdata/debug/lib/libc_aligned.so.0.0.debug      comp-sys-debug  debug,pic,!machine_arch=powerpc64
+./usr/libdata/debug/usr/lib/libc_aligned.so.0.0.debug  comp-sys-debug  debug,pic,!machine_arch=powerpc64
diff -r 7396c18cf3eb -r 1c29240c9493 distrib/sets/lists/etc/md.evbppc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/sets/lists/etc/md.evbppc  Mon May 30 15:06:54 2022 +0000
@@ -0,0 +1,2 @@
+# $NetBSD: md.evbppc,v 1.1 2022/05/30 15:06:55 rin Exp $
+./etc/ld.so.conf       etc-sys-etc     !machine_arch=powerpc64
diff -r 7396c18cf3eb -r 1c29240c9493 etc/Makefile
--- a/etc/Makefile      Mon May 30 14:48:08 2022 +0000
+++ b/etc/Makefile      Mon May 30 15:06:54 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.463 2022/05/28 14:31:11 nia Exp $
+#      $NetBSD: Makefile,v 1.464 2022/05/30 15:06:55 rin Exp $
 #      from: @(#)Makefile      8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -127,7 +127,8 @@
 .endif
 
 .if exists(etc.${MACHINE}/ld.so.conf) && \
-    empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*)
+    empty(MACHINE_ARCH:M*arm*hf*) && empty(MACHINE_ARCH:Maarch64*) && \
+    ${MACHINE_ARCH} != "powerpc64"
 BIN1+= etc.${MACHINE}/ld.so.conf
 .endif
 
diff -r 7396c18cf3eb -r 1c29240c9493 etc/etc.evbppc/ld.so.conf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/etc.evbppc/ld.so.conf Mon May 30 15:06:54 2022 +0000
@@ -0,0 +1,1 @@
+libc.so.12     machdep.no_unaligned    1:libc_aligned.so.0,libc.so.12
diff -r 7396c18cf3eb -r 1c29240c9493 lib/Makefile
--- a/lib/Makefile      Mon May 30 14:48:08 2022 +0000
+++ b/lib/Makefile      Mon May 30 15:06:54 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.293 2021/11/22 14:34:35 nia Exp $
+#      $NetBSD: Makefile,v 1.294 2022/05/30 15:06:55 rin Exp $
 #      from: @(#)Makefile      5.25.1.1 (Berkeley) 5/7/91
 
 .include <bsd.own.mk>
@@ -33,6 +33,9 @@
 SUBDIR+=       libkern
 .endif
 
+.if (${MACHINE} == "evbppc" && ${MACHINE_ARCH} == "powerpc")
+SUBDIR+=       libc_aligned
+.endif
 .if (${MACHINE_CPU} == "arm" || ${MACHINE_CPU} == "aarch64")
 LIBC_MACHINE_ARCH?=${MACHINE_ARCH}
 LIBC_MACHINE_CPU?=${MACHINE_CPU}
diff -r 7396c18cf3eb -r 1c29240c9493 lib/libc_aligned/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc_aligned/Makefile Mon May 30 15:06:54 2022 +0000
@@ -0,0 +1,28 @@
+#      $NetBSD: Makefile,v 1.1 2022/05/30 15:06:55 rin Exp $
+#
+
+# libc routines with strictly aligned memory access
+
+USE_SHLIBDIR=  yes
+
+.include <bsd.own.mk>
+
+LIBC_MACHINE_CPU?= ${MACHINE_CPU}
+
+.if exists(arch/${LIBC_MACHINE_CPU})
+.include "arch/${LIBC_MACHINE_CPU}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${LIBC_MACHINE_CPU}
+.elif exists(arch/${MACHINE_ARCH})
+.include "arch/${MACHINE_ARCH}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}
+.elif exists(arch/${MACHINE}
+.include "arch/${MACHINE}/Makefile.inc"
+.PATH: ${.CURDIR}/arch/${MACHINE}
+.endif
+
+.if !empty(SRCS)
+
+LIB?=          c_aligned
+
+.include <bsd.lib.mk>
+.endif
diff -r 7396c18cf3eb -r 1c29240c9493 lib/libc_aligned/arch/powerpc/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc_aligned/arch/powerpc/Makefile.inc        Mon May 30 15:06:54 2022 +0000
@@ -0,0 +1,15 @@
+#      $NetBSD: Makefile.inc,v 1.1 2022/05/30 15:06:55 rin Exp $
+
+# Disable asm versions that use unaligned memory access.
+
+.PATH: ${NETBSDSRCDIR}/common/lib/libc/string
+
+SRCS+= memcmp.c bcopy.c memcpy.c memmove.c
+
+.if 0
+.  for name in bcopy memcmp memcpy memmove
+.    for suffix in o po pico go d
+${name}.${suffix}: ${name}.c
+.    endfor
+.  endfor
+.endif
diff -r 7396c18cf3eb -r 1c29240c9493 lib/libc_aligned/shlib_version
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc_aligned/shlib_version    Mon May 30 15:06:54 2022 +0000
@@ -0,0 +1,5 @@
+#      $NetBSD: shlib_version,v 1.1 2022/05/30 15:06:55 rin Exp $
+#      Remember to update distrib/sets/lists/base/shl.* when changing
+#
+major=0
+minor=0



Home | Main Index | Thread Index | Old Index