Skip to content
Permalink
Browse files

7805 want faster clock_gettime

Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>
Reviewed by: Ryan Zezeski <rpz@joyent.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Garrett D'Amore <garrett@damore.org>
  • Loading branch information
pfmooney authored and rmustacc committed May 16, 2016
1 parent 2074ce0 commit 2428aad8462660fad2b105777063fea6f4192308
Showing with 1,982 additions and 82 deletions.
  1. +3 −2 usr/src/cmd/ptools/pargs/pargs.c
  2. +6 −5 usr/src/cmd/sgs/libconv/common/corenote.c
  3. +3 −1 usr/src/cmd/sgs/libconv/common/corenote.msg
  4. +16 −1 usr/src/cmd/sgs/rtld/common/external.c
  5. +33 −0 usr/src/lib/commpage/Makefile.shared.com
  6. +29 −0 usr/src/lib/commpage/Makefile.shared.targ
  7. +406 −0 usr/src/lib/commpage/amd64/cp_subr.s
  8. +37 −0 usr/src/lib/commpage/common/cp_defs.h
  9. +184 −0 usr/src/lib/commpage/common/cp_main.c
  10. +35 −0 usr/src/lib/commpage/common/offsets.in
  11. +157 −0 usr/src/lib/commpage/i386/cp_subr.s
  12. +5 −0 usr/src/lib/libc/Makefile.targ
  13. +9 −1 usr/src/lib/libc/amd64/Makefile
  14. +10 −7 usr/src/lib/libc/amd64/sys/{__clock_gettime.s → __clock_gettime_sys.s}
  15. +9 −1 usr/src/lib/libc/i386/Makefile.com
  16. +43 −0 usr/src/lib/libc/i386/sys/__clock_gettime.c
  17. +10 −8 usr/src/lib/libc/i386/sys/{__clock_gettime.s → __clock_gettime_sys.s}
  18. +2 −0 usr/src/lib/libc/inc/thr_uberdata.h
  19. +25 −0 usr/src/lib/libc/port/threads/thr.c
  20. +1 −0 usr/src/uts/common/Makefile.files
  21. +33 −1 usr/src/uts/common/exec/elf/elf.c
  22. +1 −0 usr/src/uts/common/os/zone.c
  23. +6 −1 usr/src/uts/common/sys/auxv.h
  24. +1 −0 usr/src/uts/common/sys/exec.h
  25. +2 −1 usr/src/uts/common/sys/user.h
  26. +2 −1 usr/src/uts/common/vm/seg_kmem.c
  27. +3 −0 usr/src/uts/common/vm/seg_kmem.h
  28. +453 −0 usr/src/uts/common/vm/seg_umap.c
  29. +42 −0 usr/src/uts/common/vm/seg_umap.h
  30. +2 −0 usr/src/uts/i86pc/Makefile.files
  31. +88 −0 usr/src/uts/i86pc/ml/comm_page.s
  32. +4 −0 usr/src/uts/i86pc/ml/offsets.in
  33. +13 −8 usr/src/uts/i86pc/os/cpuid.c
  34. +6 −4 usr/src/uts/i86pc/os/mlsetup.c
  35. +27 −1 usr/src/uts/i86pc/os/mp_startup.c
  36. +10 −6 usr/src/uts/i86pc/os/timestamp.c
  37. +99 −0 usr/src/uts/i86pc/sys/comm_page.h
  38. +5 −0 usr/src/uts/i86pc/sys/machparam.h
  39. +28 −0 usr/src/uts/i86pc/sys/tsc.h
  40. +21 −4 usr/src/uts/i86pc/unix/Makefile
  41. +6 −0 usr/src/uts/i86xpv/os/xpv_timestamp.c
  42. +1 −0 usr/src/uts/intel/Makefile.files
  43. +3 −0 usr/src/uts/intel/elfexec/Makefile
  44. +1 −16 usr/src/uts/intel/ia32/ml/i86_subr.s
  45. +62 −0 usr/src/uts/intel/ia32/os/comm_page_util.c
  46. +33 −0 usr/src/uts/intel/ia32/sys/comm_page_util.h
  47. +2 −1 usr/src/uts/intel/sys/machlock.h
  48. +4 −3 usr/src/uts/intel/sys/segments.h
  49. +1 −9 usr/src/uts/intel/sys/x86_archext.h
@@ -23,7 +23,7 @@
* Use is subject to license terms.
*/
/*
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright 2016 Joyent, Inc.
*/

/*
@@ -818,7 +818,8 @@ static struct aux_id aux_arr[] = {
{ AT_SUN_BRANDNAME, "AT_SUN_BRANDNAME", at_str },
{ AT_SUN_BRAND_AUX1, "AT_SUN_BRAND_AUX1", at_null },
{ AT_SUN_BRAND_AUX2, "AT_SUN_BRAND_AUX2", at_null },
{ AT_SUN_BRAND_AUX3, "AT_SUN_BRAND_AUX3", at_null }
{ AT_SUN_BRAND_AUX3, "AT_SUN_BRAND_AUX3", at_null },
{ AT_SUN_COMMPAGE, "AT_SUN_COMMPAGE", at_null }
};

#define N_AT_ENTS (sizeof (aux_arr) / sizeof (struct aux_id))
@@ -25,7 +25,7 @@
*/
/*
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
* Copyright 2016 Joyent, Inc.
*/

/*
@@ -105,19 +105,20 @@ conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
static const conv_ds_msg_t ds_types_2000_2011 = {
CONV_DS_MSG_INIT(2000, types_2000_2011) };

static const Msg types_2014_2023[] = {
static const Msg types_2014_2024[] = {
MSG_AUXV_AT_SUN_EXECNAME, MSG_AUXV_AT_SUN_MMU,
MSG_AUXV_AT_SUN_LDDATA, MSG_AUXV_AT_SUN_AUXFLAGS,
MSG_AUXV_AT_SUN_EMULATOR, MSG_AUXV_AT_SUN_BRANDNAME,
MSG_AUXV_AT_SUN_BRAND_AUX1, MSG_AUXV_AT_SUN_BRAND_AUX2,
MSG_AUXV_AT_SUN_BRAND_AUX3, MSG_AUXV_AT_SUN_HWCAP2,
MSG_AUXV_AT_SUN_COMMPAGE
};
static const conv_ds_msg_t ds_types_2014_2023 = {
CONV_DS_MSG_INIT(2014, types_2014_2023) };
static const conv_ds_msg_t ds_types_2014_2024 = {
CONV_DS_MSG_INIT(2014, types_2014_2024) };

static const conv_ds_t *ds[] = {
CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
CONV_DS_ADDR(ds_types_2014_2023), NULL };
CONV_DS_ADDR(ds_types_2014_2024), NULL };

return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
inv_buf));
@@ -24,7 +24,7 @@
# Use is subject to license terms.
#
# Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
# Copyright (c) 2013, Joyent, Inc. All rights reserved.
# Copyright 2016 Joyent, Inc.
#

@ MSG_NT_PRSTATUS "[ NT_PRSTATUS ]"
@@ -101,6 +101,8 @@
@ MSG_AUXV_AT_SUN_BRAND_AUX2 "SUN_BRAND_AUX2"
@ MSG_AUXV_AT_SUN_BRAND_AUX3 "SUN_BRAND_AUX3"
@ MSG_AUXV_AT_SUN_HWCAP2 "SUN_HWCAP2"
@ MSG_AUXV_AT_SUN_COMMPAGE "SUN_COMMPAGE"


@ MSG_CC_CONTENT_STACK "STACK"
@ MSG_CC_CONTENT_HEAP "HEAP"
@@ -22,7 +22,7 @@
/*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright 2015 Joyent, Inc.
* Copyright 2016 Joyent, Inc.
*/

/*
@@ -721,6 +721,21 @@ isalnum(int c)
return ((isalpha(c) || isdigit(c)) ? 1 : 0);
}

#if defined(__i386) || defined(__amd64)
/*
* Instead of utilizing the comm page for clock_gettime, rtld uses the raw
* syscall instead. Doing so decreases the surface of symbols needed from libc
* for a modest performance cost.
*/
extern int __clock_gettime_sys(clockid_t, struct timespec *);

int
__clock_gettime(clockid_t clock_id, struct timespec *tp)
{
return (__clock_gettime_sys(clock_id, tp));
}
#endif /* defined(__i386) || defined(__amd64) */

/*
* In a similar vein to the is* functions above, we also have to define our own
* version of strerror, as it is implemented in terms of the locale aware
@@ -0,0 +1,33 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2016 Joyent, Inc.
#

#
# This Makefile is shared between both libc and other consumers
#

COMMPAGE_OBJS = \
cp_subr.o \
cp_main.o

COMMPAGE_OFFSETS_SRC = $(SRC)/lib/commpage/common/offsets.in
COMMPAGE_OFFSETS_H = cp_offsets.h

CLEANFILES += $(COMMPAGE_OFFSETS_H)

pics/cp_main.o := CPPFLAGS += -I$(SRC)/uts/i86pc
pics/cp_subr.o := ASFLAGS += -I$(SRC)/uts/i86pc -I./
$(COMMPAGE_OFFSETS_H) := CPPFLAGS += -I$(SRC)/uts/i86pc

COMMPAGE_CPPFLAGS = -I$(SRC)/lib/commpage/common
@@ -0,0 +1,29 @@
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

#
# Copyright 2016 Joyent, Inc.
#

#
# This Makefile is shared between both libc and other consumers
#

pics/%.o: $(SRC)/lib/commpage/common/%.c
$(COMPILE.c) -o $@ $<
$(POST_PROCESS_O)

pics/%.o: $(SRC)/lib/commpage/$(TARGET_ARCH)/%.s $(COMMPAGE_OFFSETS_H)
$(COMPILE.s) -o $@ $<
$(POST_PROCESS_O)

$(COMMPAGE_OFFSETS_H): $(COMMPAGE_OFFSETS_SRC)
$(OFFSETS_CREATE) <$(COMMPAGE_OFFSETS_SRC) >$@

0 comments on commit 2428aad

Please sign in to comment.
You can’t perform that action at this time.