diff options
author | Khem Raj <raj.khem@gmail.com> | 2022-12-17 11:00:27 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2022-12-17 11:01:26 -0800 |
commit | e0a389a66068e64118c45a4583ae07727f620a0c (patch) | |
tree | dd95029b6c301b106c3c61cef0df426589bcb3a0 | |
parent | 4580e951a19a81ebbd0fd9705311c4b7d70cef73 (diff) | |
download | meta-openembedded-e0a389a66068e64118c45a4583ae07727f620a0c.tar.gz |
stressapptest: Fix build with largefile support and musl
Update status of patches as they are submitted upstream
Signed-off-by: Khem Raj <raj.khem@gmail.com>
6 files changed, 194 insertions, 3 deletions
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch new file mode 100644 index 0000000000..41fb456c6c --- /dev/null +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0001-configure-Add-with-cpu.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From 73049e5a9e3698cc6d51471d70ac5e06bed803cc Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 17 Dec 2022 10:24:48 -0800 | ||
4 | Subject: [PATCH] configure: Add --with-cpu | ||
5 | |||
6 | Some cross build systems e.g. yocto may use architectures different from cross compiler target tuple | ||
7 | arm-yoe-gnueabi but build for armv7a, AC_CANONICAL_HOST will fail in | ||
8 | this case even though target will be armv7a it will detect it as arm and | ||
9 | disable armv7a specific optimization paths. This option provides the | ||
10 | needed knob so it can be set explicitly e.g. --with-cpu=armv7a etc. if needed. | ||
11 | |||
12 | Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] | ||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | configure.ac | 9 ++++++++- | ||
16 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
17 | |||
18 | diff --git a/configure.ac b/configure.ac | ||
19 | index c839c87..403728c 100644 | ||
20 | --- a/configure.ac | ||
21 | +++ b/configure.ac | ||
22 | @@ -11,7 +11,14 @@ else | ||
23 | AC_MSG_NOTICE([Compiling with dynamically linked libraries.]) | ||
24 | fi | ||
25 | |||
26 | -AC_CANONICAL_HOST | ||
27 | +AC_ARG_WITH(cpu, [ --with-cpu define host cpu]) | ||
28 | + | ||
29 | +if test -z "$with_cpu" | ||
30 | +then | ||
31 | + AC_CANONICAL_HOST | ||
32 | +else | ||
33 | + host_cpu=$with_cpu | ||
34 | +fi | ||
35 | # Checking for target cpu and setting custom configuration | ||
36 | # for the different platforms | ||
37 | AS_CASE(["$host_cpu"], | ||
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch new file mode 100644 index 0000000000..48ff3ef93b --- /dev/null +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0002-Replace-lfs64-functions-and-defines.patch | |||
@@ -0,0 +1,103 @@ | |||
1 | From 9ab360fd018d267fe174713d7e14454408b26043 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 17 Dec 2022 10:33:01 -0800 | ||
4 | Subject: [PATCH] Replace lfs64 functions and defines | ||
5 | |||
6 | AC_SYS_LARGEFILE is already in use in configure.ac which detects | ||
7 | enabling lfs64 functions as needed, it will define _FILE_OFFSET_BITS=64 | ||
8 | which should make lseek same as lseek64 since off_t is 64bit on most of | ||
9 | current 32bit linux platforms | ||
10 | |||
11 | Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] | ||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | src/os.cc | 18 ++++++------------ | ||
15 | src/worker.cc | 6 +++--- | ||
16 | 2 files changed, 9 insertions(+), 15 deletions(-) | ||
17 | |||
18 | diff --git a/src/os.cc b/src/os.cc | ||
19 | index 1928e0a..faa6068 100644 | ||
20 | --- a/src/os.cc | ||
21 | +++ b/src/os.cc | ||
22 | @@ -142,7 +142,7 @@ int OsLayer::AddressMode() { | ||
23 | uint64 OsLayer::VirtualToPhysical(void *vaddr) { | ||
24 | uint64 frame, paddr, pfnmask, pagemask; | ||
25 | int pagesize = sysconf(_SC_PAGESIZE); | ||
26 | - off64_t off = ((uintptr_t)vaddr) / pagesize * 8; | ||
27 | + off_t off = ((uintptr_t)vaddr) / pagesize * 8; | ||
28 | int fd = open(kPagemapPath, O_RDONLY); | ||
29 | |||
30 | /* | ||
31 | @@ -154,7 +154,7 @@ uint64 OsLayer::VirtualToPhysical(void *vaddr) { | ||
32 | if (fd < 0) | ||
33 | return 0; | ||
34 | |||
35 | - if (lseek64(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { | ||
36 | + if (lseek(fd, off, SEEK_SET) != off || read(fd, &frame, 8) != 8) { | ||
37 | int err = errno; | ||
38 | string errtxt = ErrorString(err); | ||
39 | logprintf(0, "Process Error: failed to access %s with errno %d (%s)\n", | ||
40 | @@ -607,9 +607,9 @@ bool OsLayer::AllocateTestMem(int64 length, uint64 paddr_base) { | ||
41 | dynamic_mapped_shmem_ = true; | ||
42 | } else { | ||
43 | // Do a full mapping here otherwise. | ||
44 | - shmaddr = mmap64(NULL, length, PROT_READ | PROT_WRITE, | ||
45 | - MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, | ||
46 | - shm_object, 0); | ||
47 | + shmaddr = mmap(NULL, length, PROT_READ | PROT_WRITE, | ||
48 | + MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, | ||
49 | + shm_object, 0); | ||
50 | if (shmaddr == reinterpret_cast<void*>(-1)) { | ||
51 | int err = errno; | ||
52 | string errtxt = ErrorString(err); | ||
53 | @@ -704,18 +704,12 @@ void *OsLayer::PrepareTestMem(uint64 offset, uint64 length) { | ||
54 | if (dynamic_mapped_shmem_) { | ||
55 | // TODO(nsanders): Check if we can support MAP_NONBLOCK, | ||
56 | // and evaluate performance hit from not using it. | ||
57 | -#ifdef HAVE_MMAP64 | ||
58 | - void * mapping = mmap64(NULL, length, PROT_READ | PROT_WRITE, | ||
59 | - MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, | ||
60 | - shmid_, offset); | ||
61 | -#else | ||
62 | void * mapping = mmap(NULL, length, PROT_READ | PROT_WRITE, | ||
63 | MAP_SHARED | MAP_NORESERVE | MAP_LOCKED | MAP_POPULATE, | ||
64 | shmid_, offset); | ||
65 | -#endif | ||
66 | if (mapping == MAP_FAILED) { | ||
67 | string errtxt = ErrorString(errno); | ||
68 | - logprintf(0, "Process Error: PrepareTestMem mmap64(%llx, %llx) failed. " | ||
69 | + logprintf(0, "Process Error: PrepareTestMem mmap(%llx, %llx) failed. " | ||
70 | "error: %s.\n", | ||
71 | offset, length, errtxt.c_str()); | ||
72 | sat_assert(0); | ||
73 | diff --git a/src/worker.cc b/src/worker.cc | ||
74 | index 745a816..41e93a0 100644 | ||
75 | --- a/src/worker.cc | ||
76 | +++ b/src/worker.cc | ||
77 | @@ -1705,7 +1705,7 @@ bool FileThread::WritePages(int fd) { | ||
78 | int strict = sat_->strict(); | ||
79 | |||
80 | // Start fresh at beginning of file for each batch of pages. | ||
81 | - lseek64(fd, 0, SEEK_SET); | ||
82 | + lseek(fd, 0, SEEK_SET); | ||
83 | for (int i = 0; i < sat_->disk_pages(); i++) { | ||
84 | struct page_entry src; | ||
85 | if (!GetValidPage(&src)) | ||
86 | @@ -1943,7 +1943,7 @@ bool FileThread::ReadPages(int fd) { | ||
87 | bool result = true; | ||
88 | |||
89 | // Read our data back out of the file, into it's new location. | ||
90 | - lseek64(fd, 0, SEEK_SET); | ||
91 | + lseek(fd, 0, SEEK_SET); | ||
92 | for (int i = 0; i < sat_->disk_pages(); i++) { | ||
93 | struct page_entry dst; | ||
94 | if (!GetEmptyPage(&dst)) | ||
95 | @@ -3153,7 +3153,7 @@ bool DiskThread::ValidateBlockOnDisk(int fd, BlockData *block) { | ||
96 | |||
97 | // Read block from disk and time the read. If it takes longer than the | ||
98 | // threshold, complain. | ||
99 | - if (lseek64(fd, address * kSectorSize, SEEK_SET) == -1) { | ||
100 | + if (lseek(fd, address * kSectorSize, SEEK_SET) == -1) { | ||
101 | logprintf(0, "Process Error: Unable to seek to sector %lld in " | ||
102 | "DiskThread::ValidateSectorsOnDisk on disk %s " | ||
103 | "(thread %d).\n", address, device_name_.c_str(), thread_num_); | ||
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch new file mode 100644 index 0000000000..b21a534d94 --- /dev/null +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest/0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From d64a282b57352dde5f5b007947c005e504dc9a6b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 17 Dec 2022 10:46:31 -0800 | ||
4 | Subject: [PATCH] configure: Check for pthread_rwlockattr_setkind_np before use | ||
5 | |||
6 | musl does not implement this therefore detect this non-posix API before | ||
7 | using it | ||
8 | |||
9 | Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] | ||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | configure.ac | 1 + | ||
13 | src/worker.cc | 2 ++ | ||
14 | 2 files changed, 3 insertions(+) | ||
15 | |||
16 | diff --git a/configure.ac b/configure.ac | ||
17 | index 403728c..47968cb 100644 | ||
18 | --- a/configure.ac | ||
19 | +++ b/configure.ac | ||
20 | @@ -157,6 +157,7 @@ AC_FUNC_STRERROR_R | ||
21 | AC_FUNC_VPRINTF | ||
22 | AC_CHECK_FUNCS([ftruncate gettimeofday memset munmap select socket strtol strtoull]) | ||
23 | AC_CHECK_FUNCS([mmap64 posix_memalign rand_r sched_getaffinity]) | ||
24 | +AC_CHECK_FUNCS([pthread_rwlockattr_setkind_np]) | ||
25 | |||
26 | AC_CONFIG_FILES([Makefile src/Makefile]) | ||
27 | AC_OUTPUT | ||
28 | diff --git a/src/worker.cc b/src/worker.cc | ||
29 | index 41e93a0..c4abc87 100644 | ||
30 | --- a/src/worker.cc | ||
31 | +++ b/src/worker.cc | ||
32 | @@ -133,9 +133,11 @@ void WorkerStatus::Initialize() { | ||
33 | |||
34 | pthread_rwlockattr_t attrs; | ||
35 | sat_assert(0 == pthread_rwlockattr_init(&attrs)); | ||
36 | +#ifdef HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP | ||
37 | // Avoid writer lock starvation. | ||
38 | sat_assert(0 == pthread_rwlockattr_setkind_np( | ||
39 | &attrs, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)); | ||
40 | +#endif | ||
41 | sat_assert(0 == pthread_rwlock_init(&status_rwlock_, &attrs)); | ||
42 | |||
43 | #ifdef HAVE_PTHREAD_BARRIERS | ||
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch b/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch index f5e7da359d..8754e40697 100644 --- a/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest/libcplusplus-compat.patch | |||
@@ -11,7 +11,7 @@ Fixes | |||
11 | ./sattypes.h:33:17: error: expected namespace name | 11 | ./sattypes.h:33:17: error: expected namespace name |
12 | using namespace __gnu_cxx; //NOLINT | 12 | using namespace __gnu_cxx; //NOLINT |
13 | 13 | ||
14 | Upstream-Status: Pending | 14 | Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] |
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
16 | 16 | ||
17 | --- stressapptest-1.0.9.orig/src/sattypes.h | 17 | --- stressapptest-1.0.9.orig/src/sattypes.h |
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch b/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch index 8c251aeb97..19261657ac 100644 --- a/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest/read_sysfs_for_cachesize.patch | |||
@@ -2,7 +2,7 @@ sysconf params like _SC_LEVEL1_DCACHE_LINESIZE are not universally | |||
2 | implemented, therefore check for them being available, if not there | 2 | implemented, therefore check for them being available, if not there |
3 | then read the sysfs directly to get the value | 3 | then read the sysfs directly to get the value |
4 | 4 | ||
5 | Upstream-Status: Pending | 5 | Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100] |
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
7 | --- a/src/sat.cc | 7 | --- a/src/sat.cc |
8 | +++ b/src/sat.cc | 8 | +++ b/src/sat.cc |
diff --git a/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb b/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb index c8b9ca7cb9..02144c558a 100644 --- a/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb +++ b/meta-oe/recipes-benchmark/stressapptest/stressapptest_1.0.9.bb | |||
@@ -13,10 +13,18 @@ SRCREV = "9146a8bfe3e3daefa95f7a61b75183e5fc64af2c" | |||
13 | 13 | ||
14 | PV .= "+1.0.10git${SRCPV}" | 14 | PV .= "+1.0.10git${SRCPV}" |
15 | 15 | ||
16 | EXTRA_AUTOCONF:append:armv7a = " --with-cpu=armv7a" | ||
17 | EXTRA_AUTOCONF:append:armv7ve = " --with-cpu=armv7a" | ||
18 | |||
19 | GI_DATA_ENABLED:libc-musl:armv7a = "False" | ||
20 | GI_DATA_ENABLED:libc-musl:armv7ve = "False" | ||
16 | SRC_URI = "git://github.com/stressapptest/stressapptest;branch=master;protocol=https \ | 21 | SRC_URI = "git://github.com/stressapptest/stressapptest;branch=master;protocol=https \ |
17 | file://libcplusplus-compat.patch \ | 22 | file://libcplusplus-compat.patch \ |
18 | file://read_sysfs_for_cachesize.patch \ | 23 | file://read_sysfs_for_cachesize.patch \ |
19 | " | 24 | file://0001-configure-Add-with-cpu.patch \ |
25 | file://0002-Replace-lfs64-functions-and-defines.patch \ | ||
26 | file://0003-configure-Check-for-pthread_rwlockattr_setkind_np-be.patch \ | ||
27 | " | ||
20 | 28 | ||
21 | S = "${WORKDIR}/git" | 29 | S = "${WORKDIR}/git" |
22 | 30 | ||