[5/6] Refactor hp-timing rtld usage

Message ID 20190208183910.30799-5-adhemerval.zanella@linaro.org
State New
Headers show
Series
  • [1/6] nptl: Remove pthread_clock_gettime pthread_clock_settime
Related show

Commit Message

Adhemerval Zanella Feb. 8, 2019, 6:39 p.m.
This patch refactor how hp-timing is used on loader code for statistics
report.  The HP_TIMING_AVAIL and HP_SMALL_TIMING_AVAIL are removed and
HP_TIMING_INLINE is used instead to check for hp-timing avaliability.
For alpha, which only defines HP_SMALL_TIMING_AVAIL, the HP_TIMING_INLINE
is set iff for IS_IN(rtld).

Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu. I also
checked the builds for all afected ABIs.

	* benchtests/bench-timing.h: Replace HP_TIMING_AVAIL with
	HP_TIMING_INLINE.
	* nptl/descr.h: Likewise.
	* elf/rtld.c (RLTD_TIMING_DECLARE, RTLD_TIMING_NOW, RTLD_TIMING_DIFF,
	RTLD_TIMING_ACCUM_NT, RTLD_TIMING_SET): Define.
	(dl_start_final_info, _dl_start_final, dl_main, print_statistics):
	Abstract hp-timing usage with RTLD_* macros.
	* sysdeps/alpha/hp-timing.h (HP_TIMING_INLINE): Define iff IS_IN(rtld).
	(HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL): Remove.
	* sysdeps/generic/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL,
	HP_TIMING_NONAVAIL): Likewise.
	* sysdeps/ia64/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
	Likewise.
	* sysdeps/powerpc/powerpc32/power4/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/powerpc/powerpc64/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/sparc/sparc32/sparcv9/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/sparc/sparc64/hp-timing.h (HP_TIMING_AVAIL,
	HP_SMALL_TIMING_AVAIL): Likewise.
	* sysdeps/x86/hp-timing.h (HP_TIMING_AVAIL, HP_SMALL_TIMING_AVAIL):
	Likewise.
	* sysdeps/generic/hp-timing-common.h: Update comment with
	HP_TIMING_AVAIL removal.
---
 benchtests/bench-timing.h                    |   2 +-
 elf/rtld.c                                   | 231 +++++++++----------
 nptl/descr.h                                 |   2 +-
 sysdeps/alpha/hp-timing.h                    |  18 +-
 sysdeps/generic/hp-timing-common.h           |   2 -
 sysdeps/generic/hp-timing.h                  |   5 -
 sysdeps/ia64/hp-timing.h                     |   4 -
 sysdeps/powerpc/powerpc32/power4/hp-timing.h |   4 -
 sysdeps/powerpc/powerpc64/hp-timing.h        |   4 -
 sysdeps/sparc/sparc32/sparcv9/hp-timing.h    |   2 -
 sysdeps/sparc/sparc64/hp-timing.h            |   2 -
 sysdeps/x86/hp-timing.h                      |   4 -
 12 files changed, 117 insertions(+), 163 deletions(-)

Patch

diff --git a/benchtests/bench-timing.h b/benchtests/bench-timing.h
index 41b7324527..93fe379f99 100644
--- a/benchtests/bench-timing.h
+++ b/benchtests/bench-timing.h
@@ -21,7 +21,7 @@ 
 #include <hp-timing.h>
 #include <stdint.h>
 
-#if HP_TIMING_AVAIL && !defined USE_CLOCK_GETTIME
+#if HP_TIMING_INLINE && !defined USE_CLOCK_GETTIME
 # define GL(x) _##x
 # define GLRO(x) _##x
 typedef hp_timing_t timing_t;
diff --git a/elf/rtld.c b/elf/rtld.c
index 34c9016da1..d4089de735 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -46,6 +46,21 @@ 
 
 #include <assert.h>
 
+#if HP_TIMING_INLINE
+# define RLTD_TIMING_DECLARE(var, classifier,...) \
+  classifier hp_timing_t var __VA_ARGS__
+# define RTLD_TIMING_NOW(var)                    HP_TIMING_NOW(var)
+# define RTLD_TIMING_DIFF(diff, start, end)      HP_TIMING_DIFF(diff, start, end)
+# define RTLD_TIMING_ACCUM_NT(sum, diff)         HP_TIMING_ACCUM_NT(sum, diff)
+# define RTLD_TIMING_SET(var, value)             (var) = (value)
+#else
+# define RLTD_TIMING_DECLARE(var, classifier...)
+# define RTLD_TIMING_NOW(var)
+# define RTLD_TIMING_DIFF(diff, start, end)
+# define RTLD_TIMING_ACCUM_NT(sum, diff)
+# define RTLD_TIMING_SET(var, value)
+#endif
+
 /* Avoid PLT use for our local calls at startup.  */
 extern __typeof (__mempcpy) __mempcpy attribute_hidden;
 
@@ -303,11 +318,9 @@  static struct libname_list _dl_rtld_libname;
 static struct libname_list _dl_rtld_libname2;
 
 /* Variable for statistics.  */
-#ifndef HP_TIMING_NONAVAIL
-static hp_timing_t relocate_time;
-static hp_timing_t load_time attribute_relro;
-static hp_timing_t start_time attribute_relro;
-#endif
+RLTD_TIMING_DECLARE (relocate_time, static);
+RLTD_TIMING_DECLARE (load_time,     static, attribute_relro);
+RLTD_TIMING_DECLARE (start_time,    static, attribute_relro);
 
 /* Additional definitions needed by TLS initialization.  */
 #ifdef TLS_INIT_HELPER
@@ -335,9 +348,7 @@  static ElfW(Addr) _dl_start_final (void *arg);
 struct dl_start_final_info
 {
   struct link_map l;
-#if !defined HP_TIMING_NONAVAIL && HP_TIMING_INLINE
-  hp_timing_t start_time;
-#endif
+  RLTD_TIMING_DECLARE (start_time,);
 };
 static ElfW(Addr) _dl_start_final (void *arg,
 				   struct dl_start_final_info *info);
@@ -371,16 +382,10 @@  _dl_start_final (void *arg, struct dl_start_final_info *info)
 {
   ElfW(Addr) start_addr;
 
-  if (HP_SMALL_TIMING_AVAIL)
-    {
-      /* If it hasn't happen yet record the startup time.  */
-      if (! HP_TIMING_INLINE)
-	HP_TIMING_NOW (start_time);
-#if !defined DONT_USE_BOOTSTRAP_MAP && !defined HP_TIMING_NONAVAIL
-      else
-	start_time = info->start_time;
+  /* If it hasn't happen yet record the startup time.  */
+#if !defined DONT_USE_BOOTSTRAP_MAP
+  RTLD_TIMING_SET (start_time, info->start_time);
 #endif
-    }
 
   /* Transfer data about ourselves to the permanent link_map structure.  */
 #ifndef DONT_USE_BOOTSTRAP_MAP
@@ -412,23 +417,16 @@  _dl_start_final (void *arg, struct dl_start_final_info *info)
      entry point on the same stack we entered on.  */
   start_addr = _dl_sysdep_start (arg, &dl_main);
 
-#ifndef HP_TIMING_NONAVAIL
-  hp_timing_t rtld_total_time;
-  if (HP_SMALL_TIMING_AVAIL)
-    {
-      hp_timing_t end_time;
+  RLTD_TIMING_DECLARE (rtld_total_time,);
+  RLTD_TIMING_DECLARE (end_time,);
 
-      /* Get the current time.  */
-      HP_TIMING_NOW (end_time);
+  RTLD_TIMING_NOW (end_time);
 
-      /* Compute the difference.  */
-      HP_TIMING_DIFF (rtld_total_time, start_time, end_time);
-    }
-#endif
+  RTLD_TIMING_DIFF (rtld_total_time, start_time, end_time);
 
   if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_STATISTICS))
     {
-#ifndef HP_TIMING_NONAVAIL
+#if HP_TIMING_INLINE
       print_statistics (&rtld_total_time);
 #else
       print_statistics (NULL);
@@ -457,11 +455,10 @@  _dl_start (void *arg)
 #define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP
 #include "dynamic-link.h"
 
-  if (HP_TIMING_INLINE && HP_SMALL_TIMING_AVAIL)
 #ifdef DONT_USE_BOOTSTRAP_MAP
-    HP_TIMING_NOW (start_time);
+  RTLD_TIMING_NOW (start_time);
 #else
-    HP_TIMING_NOW (info.start_time);
+  RTLD_TIMING_NOW (info.start_time);
 #endif
 
   /* Partly clean the `bootstrap_map' structure up.  Don't use
@@ -879,11 +876,9 @@  dl_main (const ElfW(Phdr) *phdr,
   unsigned int i;
   bool prelinked = false;
   bool rtld_is_main = false;
-#ifndef HP_TIMING_NONAVAIL
-  hp_timing_t start;
-  hp_timing_t stop;
-  hp_timing_t diff;
-#endif
+  RLTD_TIMING_DECLARE (start,);
+  RLTD_TIMING_DECLARE (stop,);
+  RLTD_TIMING_DECLARE (diff,);
   void *tcbp = NULL;
 
   GL(dl_init_static_tls) = &_dl_nothread_init_static_tls;
@@ -1059,12 +1054,12 @@  of this helper program; chances are you did not intend to run this program.\n\
 	}
       else
 	{
-	  HP_TIMING_NOW (start);
+	  RTLD_TIMING_NOW (start);
 	  _dl_map_object (NULL, rtld_progname, lt_executable, 0,
 			  __RTLD_OPENEXEC, LM_ID_BASE);
-	  HP_TIMING_NOW (stop);
+	  RTLD_TIMING_NOW (stop);
 
-	  HP_TIMING_DIFF (load_time, start, stop);
+	  RTLD_TIMING_DIFF (load_time, start, stop);
 	}
 
       /* Now the map for the main executable is available.  */
@@ -1628,20 +1623,20 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 
   if (__glibc_unlikely (preloadlist != NULL))
     {
-      HP_TIMING_NOW (start);
+      RTLD_TIMING_NOW (start);
       npreloads += handle_preload_list (preloadlist, main_map, "LD_PRELOAD");
-      HP_TIMING_NOW (stop);
-      HP_TIMING_DIFF (diff, start, stop);
-      HP_TIMING_ACCUM_NT (load_time, diff);
+      RTLD_TIMING_NOW (stop);
+      RTLD_TIMING_DIFF (diff, start, stop);
+      RTLD_TIMING_ACCUM_NT (load_time, diff);
     }
 
   if (__glibc_unlikely (preloadarg != NULL))
     {
-      HP_TIMING_NOW (start);
+      RTLD_TIMING_NOW (start);
       npreloads += handle_preload_list (preloadarg, main_map, "--preload");
-      HP_TIMING_NOW (stop);
-      HP_TIMING_DIFF (diff, start, stop);
-      HP_TIMING_ACCUM_NT (load_time, diff);
+      RTLD_TIMING_NOW (stop);
+      RTLD_TIMING_DIFF (diff, start, stop);
+      RTLD_TIMING_ACCUM_NT (load_time, diff);
     }
 
   /* There usually is no ld.so.preload file, it should only be used
@@ -1701,7 +1696,7 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	      file[file_size - 1] = '\0';
 	    }
 
-	  HP_TIMING_NOW (start);
+	  RTLD_TIMING_NOW (start);
 
 	  if (file != problem)
 	    {
@@ -1719,9 +1714,9 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	      npreloads += do_preload (p, main_map, preload_file);
 	    }
 
-	  HP_TIMING_NOW (stop);
-	  HP_TIMING_DIFF (diff, start, stop);
-	  HP_TIMING_ACCUM_NT (load_time, diff);
+	  RTLD_TIMING_NOW (stop);
+	  RTLD_TIMING_DIFF (diff, start, stop);
+	  RTLD_TIMING_ACCUM_NT (load_time, diff);
 
 	  /* We don't need the file anymore.  */
 	  __munmap (file, file_size);
@@ -1745,11 +1740,11 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
   /* Load all the libraries specified by DT_NEEDED entries.  If LD_PRELOAD
      specified some libraries to load, these are inserted before the actual
      dependencies in the executable's searchlist for symbol resolution.  */
-  HP_TIMING_NOW (start);
+  RTLD_TIMING_NOW (start);
   _dl_map_object_deps (main_map, preloads, npreloads, mode == trace, 0);
-  HP_TIMING_NOW (stop);
-  HP_TIMING_DIFF (diff, start, stop);
-  HP_TIMING_ACCUM_NT (load_time, diff);
+  RTLD_TIMING_NOW (stop);
+  RTLD_TIMING_DIFF (diff, start, stop);
+  RTLD_TIMING_ACCUM_NT (load_time, diff);
 
   /* Mark all objects as being in the global scope.  */
   for (i = main_map->l_searchlist.r_nlist; i > 0; )
@@ -2142,12 +2137,10 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
       if (main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)] != NULL)
 	{
 	  ElfW(Rela) *conflict, *conflictend;
-#ifndef HP_TIMING_NONAVAIL
-	  hp_timing_t start;
-	  hp_timing_t stop;
-#endif
+	  RLTD_TIMING_DECLARE (start, );
+	  RLTD_TIMING_DECLARE (stop, );
 
-	  HP_TIMING_NOW (start);
+	  RTLD_TIMING_NOW (start);
 	  assert (main_map->l_info [VALIDX (DT_GNU_CONFLICTSZ)] != NULL);
 	  conflict = (ElfW(Rela) *)
 	    main_map->l_info [ADDRIDX (DT_GNU_CONFLICT)]->d_un.d_ptr;
@@ -2155,8 +2148,8 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	    ((char *) conflict
 	     + main_map->l_info [VALIDX (DT_GNU_CONFLICTSZ)]->d_un.d_val);
 	  _dl_resolve_conflicts (main_map, conflict, conflictend);
-	  HP_TIMING_NOW (stop);
-	  HP_TIMING_DIFF (relocate_time, start, stop);
+	  RTLD_TIMING_NOW (stop);
+	  RTLD_TIMING_DIFF (relocate_time, start, stop);
 	}
 
 
@@ -2184,15 +2177,13 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	 know that because it is self-contained).  */
 
       int consider_profiling = GLRO(dl_profile) != NULL;
-#ifndef HP_TIMING_NONAVAIL
-      hp_timing_t start;
-      hp_timing_t stop;
-#endif
+      RLTD_TIMING_DECLARE (start, );
+      RLTD_TIMING_DECLARE (stop, );
 
       /* If we are profiling we also must do lazy reloaction.  */
       GLRO(dl_lazy) |= consider_profiling;
 
-      HP_TIMING_NOW (start);
+      RTLD_TIMING_NOW (start);
       unsigned i = main_map->l_searchlist.r_nlist;
       while (i-- > 0)
 	{
@@ -2219,9 +2210,9 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	  if (l->l_tls_blocksize != 0 && tls_init_tp_called)
 	    _dl_add_to_slotinfo (l);
 	}
-      HP_TIMING_NOW (stop);
+      RTLD_TIMING_NOW (stop);
 
-      HP_TIMING_DIFF (relocate_time, start, stop);
+      RTLD_TIMING_DIFF (relocate_time, start, stop);
 
       /* Now enable profiling if needed.  Like the previous call,
 	 this has to go here because the calls it makes should use the
@@ -2264,19 +2255,17 @@  ERROR: ld.so: object '%s' cannot be loaded as audit interface: %s; ignored.\n",
 	 re-relocation, we might call a user-supplied function
 	 (e.g. calloc from _dl_relocate_object) that uses TLS data.  */
 
-#ifndef HP_TIMING_NONAVAIL
-      hp_timing_t start;
-      hp_timing_t stop;
-      hp_timing_t add;
-#endif
+      RLTD_TIMING_DECLARE (start,);
+      RLTD_TIMING_DECLARE (stop,);
+      RLTD_TIMING_DECLARE (add,);
 
-      HP_TIMING_NOW (start);
+      RTLD_TIMING_NOW (start);
       /* Mark the link map as not yet relocated again.  */
       GL(dl_rtld_map).l_relocated = 0;
       _dl_relocate_object (&GL(dl_rtld_map), main_map->l_scope, 0, 0);
-      HP_TIMING_NOW (stop);
-      HP_TIMING_DIFF (add, start, stop);
-      HP_TIMING_ACCUM_NT (relocate_time, add);
+      RTLD_TIMING_NOW (stop);
+      RTLD_TIMING_DIFF (add, start, stop);
+      RTLD_TIMING_ACCUM_NT (relocate_time, add);
     }
 
   /* Do any necessary cleanups for the startup OS interface code.
@@ -2714,38 +2703,35 @@  static void
 __attribute ((noinline))
 print_statistics (hp_timing_t *rtld_total_timep)
 {
-#ifndef HP_TIMING_NONAVAIL
+#if HP_TIMING_INLINE
   char buf[200];
+  char pbuf[30];
   char *cp;
   char *wp;
 
   /* Total time rtld used.  */
-  if (HP_SMALL_TIMING_AVAIL)
+  HP_TIMING_PRINT (buf, sizeof (buf), *rtld_total_timep);
+  _dl_debug_printf ("\nruntime linker statistics:\n"
+		    "  total startup time in dynamic loader: %s\n", buf);
+
+  /* Print relocation statistics.  */
+  HP_TIMING_PRINT (buf, sizeof (buf), relocate_time);
+  cp = _itoa ((1000ULL * relocate_time) / *rtld_total_timep,
+	      pbuf + sizeof (pbuf), 10, 0);
+  wp = pbuf;
+  switch (pbuf + sizeof (pbuf) - cp)
     {
-      HP_TIMING_PRINT (buf, sizeof (buf), *rtld_total_timep);
-      _dl_debug_printf ("\nruntime linker statistics:\n"
-			"  total startup time in dynamic loader: %s\n", buf);
-
-      /* Print relocation statistics.  */
-      char pbuf[30];
-      HP_TIMING_PRINT (buf, sizeof (buf), relocate_time);
-      cp = _itoa ((1000ULL * relocate_time) / *rtld_total_timep,
-		  pbuf + sizeof (pbuf), 10, 0);
-      wp = pbuf;
-      switch (pbuf + sizeof (pbuf) - cp)
-	{
-	case 3:
-	  *wp++ = *cp++;
-	case 2:
-	  *wp++ = *cp++;
-	case 1:
-	  *wp++ = '.';
-	  *wp++ = *cp++;
-	}
-      *wp = '\0';
-      _dl_debug_printf ("\
-	    time needed for relocation: %s (%s%%)\n", buf, pbuf);
+    case 3:
+      *wp++ = *cp++;
+    case 2:
+      *wp++ = *cp++;
+    case 1:
+      *wp++ = '.';
+      *wp++ = *cp++;
     }
+  *wp = '\0';
+  _dl_debug_printf ("\
+	    time needed for relocation: %s (%s%%)\n", buf, pbuf);
 #endif
 
   unsigned long int num_relative_relocations = 0;
@@ -2786,29 +2772,24 @@  print_statistics (hp_timing_t *rtld_total_timep)
 		    GL(dl_num_cache_relocations),
 		    num_relative_relocations);
 
-#ifndef HP_TIMING_NONAVAIL
+#if HP_TIMING_INLINE
   /* Time spend while loading the object and the dependencies.  */
-  if (HP_SMALL_TIMING_AVAIL)
+  HP_TIMING_PRINT (buf, sizeof (buf), load_time);
+  cp = _itoa ((1000ULL * load_time) / *rtld_total_timep,
+	      pbuf + sizeof (pbuf), 10, 0);
+  wp = pbuf;
+  switch (pbuf + sizeof (pbuf) - cp)
     {
-      char pbuf[30];
-      HP_TIMING_PRINT (buf, sizeof (buf), load_time);
-      cp = _itoa ((1000ULL * load_time) / *rtld_total_timep,
-		  pbuf + sizeof (pbuf), 10, 0);
-      wp = pbuf;
-      switch (pbuf + sizeof (pbuf) - cp)
-	{
-	case 3:
-	  *wp++ = *cp++;
-	case 2:
-	  *wp++ = *cp++;
-	case 1:
-	  *wp++ = '.';
-	  *wp++ = *cp++;
-	}
-      *wp = '\0';
-      _dl_debug_printf ("\
-	   time needed to load objects: %s (%s%%)\n",
-				buf, pbuf);
+    case 3:
+      *wp++ = *cp++;
+    case 2:
+      *wp++ = *cp++;
+    case 1:
+      *wp++ = '.';
+      *wp++ = *cp++;
     }
+  *wp = '\0';
+  _dl_debug_printf ("\
+	   time needed to load objects: %s (%s%%)\n", buf, pbuf);
 #endif
 }
diff --git a/nptl/descr.h b/nptl/descr.h
index 6fd2cb1c35..b62c4672c1 100644
--- a/nptl/descr.h
+++ b/nptl/descr.h
@@ -342,7 +342,7 @@  struct pthread
   /* Lock for synchronizing setxid calls.  */
   unsigned int setxid_futex;
 
-#if HP_TIMING_AVAIL
+#if HP_TIMING_INLINE
   hp_timing_t cpuclock_offset_ununsed;
 #endif
 
diff --git a/sysdeps/alpha/hp-timing.h b/sysdeps/alpha/hp-timing.h
index 481132663c..08d8d6627c 100644
--- a/sysdeps/alpha/hp-timing.h
+++ b/sysdeps/alpha/hp-timing.h
@@ -17,16 +17,13 @@ 
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#ifndef _HP_TIMING_H
-#define _HP_TIMING_H	1
+#ifndef _HP_TIMING_ALPHA_H
+#define _HP_TIMING_ALPHA_H	1
 
+#if IS_IN(rtld)
 /* We always have the timestamp register, but it's got only a 4 second
    range.  Use it for ld.so profiling only.  */
-#define HP_TIMING_AVAIL		(0)
-#define HP_SMALL_TIMING_AVAIL	(1)
-
-/* We indeed have inlined functions.  */
-#define HP_TIMING_INLINE	(1)
+# define HP_TIMING_INLINE	(1)
 
 /* We use 32 bit values for the times.  */
 typedef unsigned int hp_timing_t;
@@ -34,13 +31,16 @@  typedef unsigned int hp_timing_t;
 /* The "rpcc" instruction returns a 32-bit counting half and a 32-bit
    "virtual cycle counter displacement".  Subtracting the two gives us
    a virtual cycle count.  */
-#define HP_TIMING_NOW(VAR) \
+# define HP_TIMING_NOW(VAR) \
   do {									      \
     unsigned long int x_;						      \
     asm volatile ("rpcc %0" : "=r"(x_));				      \
     (VAR) = (int) (x_) - (int) (x_ >> 32);				      \
   } while (0)
+# include <hp-timing-common.h>
 
-#include <hp-timing-common.h>
+#else
+# include <sysdeps/generic/hp-timing.h>
+#endif /* IS_IN(rtld)  */
 
 #endif	/* hp-timing.h */
diff --git a/sysdeps/generic/hp-timing-common.h b/sysdeps/generic/hp-timing-common.h
index 0ffb853444..f7a0147a4f 100644
--- a/sysdeps/generic/hp-timing-common.h
+++ b/sysdeps/generic/hp-timing-common.h
@@ -20,8 +20,6 @@ 
 /* In case a platform supports timers in the hardware the following macros
    and types must be defined:
 
-   - HP_TIMING_AVAIL: test for availability.
-
    - HP_TIMING_INLINE: this macro is non-zero if the functionality is not
      implemented using function calls but instead uses some inlined code
      which might simply consist of a few assembler instructions.  We have to
diff --git a/sysdeps/generic/hp-timing.h b/sysdeps/generic/hp-timing.h
index fb2a6036fc..278998d2c2 100644
--- a/sysdeps/generic/hp-timing.h
+++ b/sysdeps/generic/hp-timing.h
@@ -25,8 +25,6 @@ 
    the system call might be too high.  */
 
 /* Provide dummy definitions.  */
-#define HP_TIMING_AVAIL		(0)
-#define HP_SMALL_TIMING_AVAIL	(0)
 #define HP_TIMING_INLINE	(0)
 typedef int hp_timing_t;
 #define HP_TIMING_NOW(var)
@@ -34,7 +32,4 @@  typedef int hp_timing_t;
 #define HP_TIMING_ACCUM_NT(Sum, Diff)
 #define HP_TIMING_PRINT(Buf, Len, Val)
 
-/* Since this implementation is not available we tell the user about it.  */
-#define HP_TIMING_NONAVAIL	1
-
 #endif	/* hp-timing.h */
diff --git a/sysdeps/ia64/hp-timing.h b/sysdeps/ia64/hp-timing.h
index 17ef023a11..2ca248a530 100644
--- a/sysdeps/ia64/hp-timing.h
+++ b/sysdeps/ia64/hp-timing.h
@@ -20,10 +20,6 @@ 
 #ifndef _HP_TIMING_H
 #define _HP_TIMING_H	1
 
-/* We always assume having the timestamp register.  */
-#define HP_TIMING_AVAIL		(1)
-#define HP_SMALL_TIMING_AVAIL	(1)
-
 /* We indeed have inlined functions.  */
 #define HP_TIMING_INLINE	(1)
 
diff --git a/sysdeps/powerpc/powerpc32/power4/hp-timing.h b/sysdeps/powerpc/powerpc32/power4/hp-timing.h
index 0d77aa0992..ed2ca9bc7a 100644
--- a/sysdeps/powerpc/powerpc32/power4/hp-timing.h
+++ b/sysdeps/powerpc/powerpc32/power4/hp-timing.h
@@ -20,10 +20,6 @@ 
 #ifndef _HP_TIMING_H
 #define _HP_TIMING_H	1
 
-/* We always assume having the timestamp register.  */
-#define HP_TIMING_AVAIL		(1)
-#define HP_SMALL_TIMING_AVAIL	(1)
-
 /* We indeed have inlined functions.  */
 #define HP_TIMING_INLINE	(1)
 
diff --git a/sysdeps/powerpc/powerpc64/hp-timing.h b/sysdeps/powerpc/powerpc64/hp-timing.h
index fb9ac1ce2a..01678cd634 100644
--- a/sysdeps/powerpc/powerpc64/hp-timing.h
+++ b/sysdeps/powerpc/powerpc64/hp-timing.h
@@ -20,10 +20,6 @@ 
 #ifndef _HP_TIMING_H
 #define _HP_TIMING_H	1
 
-/* We always assume having the timestamp register.  */
-#define HP_TIMING_AVAIL		(1)
-#define HP_SMALL_TIMING_AVAIL	(1)
-
 /* We indeed have inlined functions.  */
 #define HP_TIMING_INLINE	(1)
 
diff --git a/sysdeps/sparc/sparc32/sparcv9/hp-timing.h b/sysdeps/sparc/sparc32/sparcv9/hp-timing.h
index 6a4ab08679..3270c5b40a 100644
--- a/sysdeps/sparc/sparc32/sparcv9/hp-timing.h
+++ b/sysdeps/sparc/sparc32/sparcv9/hp-timing.h
@@ -20,8 +20,6 @@ 
 #ifndef _HP_TIMING_H
 #define _HP_TIMING_H	1
 
-#define HP_TIMING_AVAIL		(1)
-#define HP_SMALL_TIMING_AVAIL	(1)
 #define HP_TIMING_INLINE	(1)
 
 typedef unsigned long long int hp_timing_t;
diff --git a/sysdeps/sparc/sparc64/hp-timing.h b/sysdeps/sparc/sparc64/hp-timing.h
index db95c02a8d..0f02b2a98f 100644
--- a/sysdeps/sparc/sparc64/hp-timing.h
+++ b/sysdeps/sparc/sparc64/hp-timing.h
@@ -20,8 +20,6 @@ 
 #ifndef _HP_TIMING_H
 #define _HP_TIMING_H	1
 
-#define HP_TIMING_AVAIL		(1)
-#define HP_SMALL_TIMING_AVAIL	(1)
 #define HP_TIMING_INLINE	(1)
 
 typedef unsigned long int hp_timing_t;
diff --git a/sysdeps/x86/hp-timing.h b/sysdeps/x86/hp-timing.h
index 9b6a998bcd..ccb9f9250a 100644
--- a/sysdeps/x86/hp-timing.h
+++ b/sysdeps/x86/hp-timing.h
@@ -22,10 +22,6 @@ 
 #include <isa.h>
 
 #if MINIMUM_ISA == 686 || MINIMUM_ISA == 8664
-/* We always assume having the timestamp register.  */
-# define HP_TIMING_AVAIL	(1)
-# define HP_SMALL_TIMING_AVAIL	(1)
-
 /* We indeed have inlined functions.  */
 # define HP_TIMING_INLINE	(1)