trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [trafficserver] 01/03: TS-4821: Make hwloc a required dependency
Date Tue, 27 Sep 2016 19:37:55 GMT
This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch make_hwloc_required
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit ec0d7b6a196385a4669469d1fa18059179b01e0a
Author: Phil Sorber <sorber@apache.org>
AuthorDate: Wed Sep 7 11:15:59 2016 -0600

    TS-4821: Make hwloc a required dependency
---
 cmd/traffic_layout/traffic_layout.cc     |  1 -
 configure.ac                             | 66 +++++++++++---------------------
 iocore/aio/AIO.cc                        |  2 -
 iocore/eventsystem/UnixEventProcessor.cc | 10 -----
 lib/ts/ink_config.h.in                   |  1 -
 lib/ts/ink_defs.cc                       | 16 --------
 lib/ts/ink_defs.h                        |  4 --
 7 files changed, 22 insertions(+), 78 deletions(-)

diff --git a/cmd/traffic_layout/traffic_layout.cc b/cmd/traffic_layout/traffic_layout.cc
index ce5ed22..87e01fe 100644
--- a/cmd/traffic_layout/traffic_layout.cc
+++ b/cmd/traffic_layout/traffic_layout.cc
@@ -93,7 +93,6 @@ produce_features(bool json)
   print_feature("TS_USE_TPROXY", TS_USE_TPROXY, json);
   print_feature("TS_HAS_SO_MARK", TS_HAS_SO_MARK, json);
   print_feature("TS_HAS_IP_TOS", TS_HAS_IP_TOS, json);
-  print_feature("TS_USE_HWLOC", TS_USE_HWLOC, json);
   print_feature("TS_USE_TLS_NPN", TS_USE_TLS_NPN, json);
   print_feature("TS_USE_TLS_ALPN", TS_USE_TLS_ALPN, json);
   print_feature("TS_USE_TLS_SNI", TS_USE_TLS_SNI, json);
diff --git a/configure.ac b/configure.ac
index 0ad92be..701c3f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -289,17 +289,6 @@ AC_ARG_ENABLE([posix-cap],
 AC_MSG_RESULT([$enable_posix_cap])
 
 #
-# use hwloc library when possible (can be disabled)
-#
-AC_MSG_CHECKING([whether to use hwloc library])
-AC_ARG_ENABLE([hwloc],
-  [AS_HELP_STRING([--disable-hwloc],[Don't use the hwloc library])],
-  [],
-  [enable_hwloc="yes"]
-)
-AC_MSG_RESULT([$enable_hwloc])
-
-#
 # Enble ccache explicitly (it's disabled by default, because of build problems in some cases)
 #
 AC_MSG_CHECKING([whether to enable ccache])
@@ -1322,43 +1311,32 @@ AC_MSG_RESULT([$enable_linux_native_aio])
 TS_ARG_ENABLE_VAR([use], [linux_native_aio])
 
 # Check for hwloc library.
-# If we don't find it, disable checking for header.
-use_hwloc=0
-AS_IF([test "x$enable_hwloc" = "xyes"], [
-  # Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places.
-  PKG_CHECK_MODULES([HWLOC], [hwloc], [
-    SAVE_LIBS="$LIBS"
-    LIBS="-lhwloc"
-    AC_LANG_PUSH([C++])
-    AC_MSG_CHECKING([for hwloc C++ linking])
-    AC_LINK_IFELSE([
-      AC_LANG_PROGRAM([#include <hwloc.h>],[hwloc_topology_t t; hwloc_topology_init(&t);
hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[
-      use_hwloc=1
-      AC_SUBST([HWLOC_CFLAGS])
-      AC_SUBST([HWLOC_LIBS])
-      AC_MSG_RESULT([yes])
-      # Old versions of libhwloc don't have HWLOC_OBJ_PU.
-      AC_CHECK_DECL(HWLOC_OBJ_PU,
-        [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [],
-        [#include <hwloc.h>]
-      )
-    ], [
-      AC_MSG_RESULT([no])
-      AC_MSG_WARN([hwloc not linkable, try --disable-hwloc])
-      AC_SUBST([HWLOC_CFLAGS],[""])
-      AC_SUBST([HWLOC_LIBS],[""])
-    ])
-    AC_LANG_POP()
-    LIBS="$SAVE_LIBS"
+# Use pkg-config, because some distros (*cough* Ubuntu) put hwloc in unusual places.
+PKG_CHECK_MODULES([HWLOC], [hwloc], [
+  SAVE_LIBS="$LIBS"
+  LIBS="-lhwloc"
+  AC_LANG_PUSH([C++])
+  AC_MSG_CHECKING([for hwloc C++ linking])
+  AC_LINK_IFELSE([
+    AC_LANG_PROGRAM([#include <hwloc.h>],[hwloc_topology_t t; hwloc_topology_init(&t);
hwloc_get_type_depth(t, HWLOC_OBJ_SOCKET);])],[
+    AC_SUBST([HWLOC_CFLAGS])
+    AC_SUBST([HWLOC_LIBS])
+    AC_MSG_RESULT([yes])
+    # Old versions of libhwloc don't have HWLOC_OBJ_PU.
+    AC_CHECK_DECL(HWLOC_OBJ_PU,
+      [AC_DEFINE(HAVE_HWLOC_OBJ_PU, 1, [Whether HWLOC_OBJ_PU is available])], [],
+      [#include <hwloc.h>]
+    )
   ], [
-    AC_MSG_WARN([hwloc not found, try --disable-hwloc])
-    AC_SUBST([HWLOC_CFLAGS],[""])
-    AC_SUBST([HWLOC_LIBS],[""])
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([hwloc not linkable])
   ])
+  AC_LANG_POP()
+  LIBS="$SAVE_LIBS"
+], [
+  AC_MSG_ERROR([hwloc not found])
 ])
 
-AC_SUBST(use_hwloc)
-
 #
 # Check for Maxmind APIs / includes. TODO: Long term, it might make sense to support
 # GeoIP as a "helper" plugin, which other plugins can then use. Such a plugin could
diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index 2404b8f..e41c456 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -189,10 +189,8 @@ struct AIOThreadInfo : public Continuation {
   {
     (void)event;
     (void)e;
-#if TS_USE_HWLOC
     hwloc_set_membind_nodeset(ink_get_topology(), hwloc_topology_get_topology_nodeset(ink_get_topology()),
HWLOC_MEMBIND_INTERLEAVE,
                               HWLOC_MEMBIND_THREAD);
-#endif
     aio_thread_main(this);
     delete this;
     return EVENT_DONE;
diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc
index 49476e4..b9cd595 100644
--- a/iocore/eventsystem/UnixEventProcessor.cc
+++ b/iocore/eventsystem/UnixEventProcessor.cc
@@ -23,12 +23,10 @@
 
 #include "P_EventSystem.h" /* MAGIC_EDITING_TAG */
 #include <sched.h>
-#if TS_USE_HWLOC
 #if HAVE_ALLOCA_H
 #include <alloca.h>
 #endif
 #include <hwloc.h>
-#endif
 #include "ts/ink_defs.h"
 #include "ts/hugepages.h"
 
@@ -162,7 +160,6 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
   }
   n_threads_for_type[ET_CALL] = n_event_threads;
 
-#if TS_USE_HWLOC
   int affinity = 1;
   REC_ReadConfigInteger(affinity, "proxy.config.exec_thread.affinity");
   hwloc_obj_t obj;
@@ -201,11 +198,8 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
   obj_count = hwloc_get_nbobjs_by_type(ink_get_topology(), obj_type);
   Debug("iocore_thread", "Affinity: %d %ss: %d PU: %d", affinity, obj_name, obj_count, ink_number_of_processors());
 
-#endif
   for (i = 0; i < n_ethreads; i++) {
     ink_thread tid;
-
-#if TS_USE_HWLOC
     if (obj_count > 0) {
       // Get our `obj` instance with index based on the thread number we are on.
       obj = hwloc_get_obj_by_type(ink_get_topology(), obj_type, i % obj_count);
@@ -247,10 +241,6 @@ EventProcessor::start(int n_event_threads, size_t stacksize)
     } else {
       Warning("hwloc returned an unexpected value -- CPU affinity disabled");
     }
-#else
-    // Lets ignore tid if we don't link with HWLOC
-    (void)tid;
-#endif // TS_USE_HWLOC
   }
 
   Debug("iocore_thread", "Created event thread group id %d with %d threads", ET_CALL, n_event_threads);
diff --git a/lib/ts/ink_config.h.in b/lib/ts/ink_config.h.in
index 9e93687..8248eff 100644
--- a/lib/ts/ink_config.h.in
+++ b/lib/ts/ink_config.h.in
@@ -69,7 +69,6 @@
 #define TS_USE_TPROXY @use_tproxy@
 #define TS_HAS_SO_MARK @has_so_mark@
 #define TS_HAS_IP_TOS @has_ip_tos@
-#define TS_USE_HWLOC @use_hwloc@
 #define TS_USE_TLS_NPN @use_tls_npn@
 #define TS_USE_TLS_ALPN @use_tls_alpn@
 #define TS_USE_TLS_SNI @use_tls_sni@
diff --git a/lib/ts/ink_defs.cc b/lib/ts/ink_defs.cc
index 712df08..449d6e0 100644
--- a/lib/ts/ink_defs.cc
+++ b/lib/ts/ink_defs.cc
@@ -42,8 +42,6 @@
 int off = 0;
 int on  = 1;
 
-#if TS_USE_HWLOC
-
 #include <hwloc.h>
 
 // Little helper to initialize the hwloc topology, once.
@@ -66,8 +64,6 @@ ink_get_topology()
   return topology;
 }
 
-#endif
-
 int
 ink_sys_name_release(char *name, int namelen, char *release, int releaselen)
 {
@@ -118,23 +114,11 @@ ink_sys_name_release(char *name, int namelen, char *release, int releaselen)
 int
 ink_number_of_processors()
 {
-#if TS_USE_HWLOC
 #if HAVE_HWLOC_OBJ_PU
   return hwloc_get_nbobjs_by_type(ink_get_topology(), HWLOC_OBJ_PU);
 #else
   return hwloc_get_nbobjs_by_type(ink_get_topology(), HWLOC_OBJ_CORE);
 #endif
-#elif defined(freebsd)
-  int mib[2], n;
-  mib[0]     = CTL_HW;
-  mib[1]     = HW_NCPU;
-  size_t len = sizeof(n);
-  if (sysctl(mib, 2, &n, &len, NULL, 0) == -1)
-    return 1;
-  return n;
-#else
-  return sysconf(_SC_NPROCESSORS_ONLN); // number of processing units (includes Hyper Threading)
-#endif
 }
 
 int
diff --git a/lib/ts/ink_defs.h b/lib/ts/ink_defs.h
index 46cd6b5..5f700f4 100644
--- a/lib/ts/ink_defs.h
+++ b/lib/ts/ink_defs.h
@@ -133,9 +133,7 @@ max(const T a, const T b)
 #define unlikely(x) __builtin_expect(!!(x), 0)
 #endif
 
-#if TS_USE_HWLOC
 #include <hwloc.h>
-#endif
 
 #ifndef ROUNDUP
 #define ROUNDUP(x, y) ((((x) + ((y)-1)) / (y)) * (y))
@@ -159,10 +157,8 @@ int ink_sys_name_release(char *name, int namelen, char *release, int
releaselen)
 int ink_number_of_processors();
 int ink_login_name_max();
 
-#if TS_USE_HWLOC
 // Get the hardware topology
 hwloc_topology_t ink_get_topology();
-#endif
 
 /** Constants.
  */

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message