will-it-scale-git: Fix build with new git snapshot

This commit is contained in:
Kamil Rytarowski 2019-11-21 00:03:43 +01:00
parent 2312e53da6
commit 8a72da9fa0
6 changed files with 85 additions and 140 deletions

View File

@ -1,10 +1,13 @@
$NetBSD$
SHA1 (patch-Makefile) = fdf09838fe367c554f108aa92aef76264b790512
SHA1 (patch-main.c) = 892b4fee8745289f1b4befedf527e5f3db8c575d
SHA1 (patch-tests_eventfd1.c) = 290598658b7cbf564b0b34317f0f2c550b243fde
SHA1 (patch-tests_fallocate1.c) = b6820c120ce5b8e1ddf7bbc925a17f567d5a9df5
SHA1 (patch-tests_fallocate2.c) = 0ca2dd55dc1ef267e8a02c9fc5699e72e71eafe3
SHA1 (patch-tests_futex1.c) = a45ffd09e0300e5f6c2b70d95fb3a2454112e588
SHA1 (patch-tests_futex2.c) = ef36e22c01b00ea486bd139a361313c3269a3c2d
SHA1 (patch-tests_futex3.c) = 6df2ef0e44085aa8829d66a9b7d591fc18b2adf7
SHA1 (patch-tests_futex4.c) = cb80519781bd1b8f5539f3080379159f36b2476a
SHA1 (patch-tests_tlb__flush1.c) = a2d9d8679ca90cafdd6d6ad6742f3732d3441817
SHA1 (patch-tests_tlb__flush2.c) = ab23430f9b89131df163649a7a51cb300c866d80
SHA1 (patch-tests_tlb__flush3.c) = 4b8aff09cfec2b9e06e457a432d417e049f74d72

View File

@ -1,139 +0,0 @@
$NetBSD$
--- main.c.orig 2018-03-17 15:30:11.000000000 +0000
+++ main.c
@@ -15,7 +15,6 @@
#include <string.h>
#include <sys/mman.h>
#include <hwloc.h>
-#include <hwloc/glibc-sched.h>
#include <sys/types.h>
#include <signal.h>
#include <poll.h>
@@ -80,6 +79,8 @@ struct args
unsigned long long *arg1;
unsigned long arg2;
int poll_fd;
+ hwloc_topology_t topology;
+ hwloc_cpuset_t cpuset;
};
static void *testcase_trampoline(void *p)
@@ -103,17 +104,29 @@ void new_task(void *(func)(void *), void
pthread_create(&tid, NULL, func, arg);
}
-void new_task_affinity(struct args *args,
- size_t cpuset_size, cpu_set_t *mask)
+static void *thread_pre_trampoline(void *p)
+{
+ struct args *args;
+
+ args = (struct args *)p;
+ if (hwloc_set_thread_cpubind(args->topology, pthread_self(),
+ args->cpuset, 0)) {
+ perror("hwloc_set_thread_cpubind");
+ exit(1);
+ }
+ hwloc_topology_destroy(args->topology);
+ hwloc_bitmap_free(args->cpuset);
+ return testcase_trampoline(args);
+}
+
+void new_task_affinity(struct args *args)
{
pthread_attr_t attr;
pthread_t tid;
pthread_attr_init(&attr);
- pthread_attr_setaffinity_np(&attr, cpuset_size, mask);
-
- pthread_create(&tid, &attr, testcase_trampoline, args);
+ pthread_create(&tid, &attr, thread_pre_trampoline, args);
pthread_attr_destroy(&attr);
}
@@ -166,14 +179,27 @@ void new_task(void *(func)(void *), void
pids[nr_pids++] = pid;
}
-void new_task_affinity(struct args *args,
- size_t cpuset_size, cpu_set_t *mask)
+void new_task_affinity(struct args *args)
{
- cpu_set_t old_mask;
+ hwloc_cpuset_t old_set;
int pid;
- sched_getaffinity(0, sizeof(old_mask), &old_mask);
- sched_setaffinity(0, cpuset_size, mask);
+
+ old_set = hwloc_bitmap_alloc();
+ if (old_set == NULL) {
+ perror("hwloc_bitmap_alloc");
+ exit(1);
+ }
+ if (hwloc_get_cpubind(args->topology, old_set,
+ HWLOC_CPUBIND_PROCESS) < 0) {
+ perror("hwloc_get_cpubind");
+ exit(1);
+ }
+ if (hwloc_set_cpubind(args->topology, args->cpuset,
+ HWLOC_CPUBIND_PROCESS) < 0) {
+ perror("hwloc_set_cpubind");
+ exit(1);
+ }
parent_pid = getpid();
@@ -195,9 +221,17 @@ void new_task_affinity(struct args *args
testcase_trampoline(args);
}
- sched_setaffinity(0, sizeof(old_mask), &old_mask);
+ if (hwloc_set_cpubind(args->topology, old_set,
+ HWLOC_CPUBIND_PROCESS) < 0) {
+ perror("hwloc_set_cpubind");
+ exit(1);
+ }
pids[nr_pids++] = pid;
+ hwloc_topology_destroy(args->topology);
+ hwloc_bitmap_free(args->cpuset);
+ hwloc_bitmap_free(old_set);
+
}
@@ -273,7 +307,6 @@ int main(int argc, char *argv[])
smt_affinity ? HWLOC_OBJ_PU : HWLOC_OBJ_CORE);
for (i = 0; i < opt_tasks; i++) {
hwloc_obj_t obj;
- cpu_set_t mask;
struct args *args;
args = malloc(sizeof(struct args));
@@ -285,13 +318,18 @@ int main(int argc, char *argv[])
args->arg1 = results[i];
args->arg2 = i;
args->poll_fd = fd[0];
-
obj = hwloc_get_obj_by_type(topology,
smt_affinity ? HWLOC_OBJ_PU : HWLOC_OBJ_CORE,
i % n);
- hwloc_cpuset_to_glibc_sched_affinity(topology,
- obj->cpuset, &mask, sizeof(mask));
- new_task_affinity(args, sizeof(mask), &mask);
+ if ((args->cpuset = hwloc_bitmap_dup(obj->cpuset)) == NULL) {
+ perror("hwloc_bitmap_dup");
+ exit(1);
+ }
+ if (hwloc_topology_dup(&args->topology, topology)) {
+ perror("hwloc_topology_dup");
+ exit(1);
+ }
+ new_task_affinity(args);
}
if (write(fd[1], &i, 1) != 1) {

View File

@ -0,0 +1,30 @@
$NetBSD$
--- tests/fallocate2.c.orig 2019-11-20 22:52:24.000000000 +0000
+++ tests/fallocate2.c
@@ -1,3 +1,10 @@
+char *testcase_description = "Separate file fallocate";
+
+#if defined(__NetBSD__)
+void testcase(unsigned long long *iterations, unsigned long nr)
+{
+}
+#else
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <errno.h>
#include <fcntl.h>
@@ -9,8 +16,6 @@
#define FILESIZE (1 * 1024 * 1024)
#define BUFLEN (FILESIZE / 128)
-char *testcase_description = "Separate file fallocate";
-
void testcase(unsigned long long *iterations, unsigned long nr)
{
char tmpfile[] = "/tmp/willitscale.XXXXXX";
@@ -32,4 +37,4 @@ void testcase(unsigned long long *iterat
(*iterations)++;
}
}
-
+#endif

View File

@ -0,0 +1,17 @@
$NetBSD$
--- tests/tlb_flush1.c.orig 2019-11-20 22:52:24.000000000 +0000
+++ tests/tlb_flush1.c
@@ -10,7 +10,12 @@
#include <sys/syscall.h>
#include <stdio.h>
+#if defined(__NetBSD__)
+#include <lwp.h>
+#define gettid() (long int)_lwp_self()
+#else
#define gettid() syscall(SYS_gettid)
+#endif
#define FILESIZE (128 * 1024 * 1024)
char *testcase_description = "TLB flush of separated file private mapping";

View File

@ -0,0 +1,17 @@
$NetBSD$
--- tests/tlb_flush2.c.orig 2019-11-20 22:52:24.000000000 +0000
+++ tests/tlb_flush2.c
@@ -10,7 +10,12 @@
#include <sys/syscall.h>
#include <stdio.h>
+#if defined(__NetBSD__)
+#include <lwp.h>
+#define gettid() (long int)_lwp_self()
+#else
#define gettid() syscall(SYS_gettid)
+#endif
#define MEMORYSIZE (1 * 1024 * 1024)
char *testcase_description = "TLB flush of anonymous memory private mapping";

View File

@ -0,0 +1,17 @@
$NetBSD$
--- tests/tlb_flush3.c.orig 2019-11-20 22:52:24.000000000 +0000
+++ tests/tlb_flush3.c
@@ -10,7 +10,12 @@
#include <sys/syscall.h>
#include <stdio.h>
+#if defined(__NetBSD__)
+#include <lwp.h>
+#define gettid() (long int)_lwp_self()
+#else
#define gettid() syscall(SYS_gettid)
+#endif
#define FILESIZE (128 * 1024 * 1024)
char *testcase_description = "TLB flush of separated file shared mapping";