Hello community, here is the log from the commit of package stress-ng for openSUSE:Factory checked in at 2016-07-20 09:18:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/stress-ng (Old) and /work/SRC/openSUSE:Factory/.stress-ng.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "stress-ng" Changes: -------- --- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes 2016-07-09 09:23:50.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.stress-ng.new/stress-ng.changes 2016-07-20 09:18:04.000000000 +0200 @@ -1,0 +2,54 @@ +Sat Jul 16 12:00:49 UTC 2016 - [email protected] + +- Update to version 0.06.12: + * Makefile: bump version once more + * Update manual page date since we've touched the manual + * stress-seal: don't abort fatally if memfd_create is not + available. + * fast-test-all: cater for non-fatal test exit status + * Add oom-pipe to fast-test-all exclusion list + * Manual: clarify that return code 3 could refer to missing + system call + * stress-fcntl: handle EAGAIN lock requests more robustly + * stress-fcntl: don't check initial GETLK status + * stress-icache: don't fail if advice fails on EINVAL +- Changes for version 0.06.11 + * Makefile; bump version + * fast-test-all: don't run seccomp, it may not pass on some + kernels + * stress-fault: handle segfaults that occur on some BSD kernels + * stress-icache: only madvice if MADV_NOHUGEPAGE is defined + * stress-icache: don't assume that read/write/exec protection is + allowed + * Update cache-mfence helper. It supports ARM now. Zhiyi Sun +- Changes for version 0.06.10: + * Makefile: bump version again + * stress-atomic + build: the autodetect smarts did not work, fix + them +- Changes for 0.06.09: + * Makefile: bump version + * stress-atomic: don't make tmp volatile, fixes clang warnings + * Add smarts to Makefile to detect if atomic GCC functions are + supported +- Changes for 0.06.08: + * Makefile: bump version + * Manual: update date + * stress-ptrace: EINTR is not a failure on waitpid + * stress-tlb-shootdown: remove case where < 2 CPUs abort the test + * Add GCC atomic ops stressor + * stress-copy-file-range: handle ENOSPC as non-fatal + * stress-icache: call __clear_cache() between code modifications. + * Enable icache stressor for arm + * Add renameat2 to syscalls + * Add preadv2/prwritev2 to syscalls + * stress-lockbus: se GCC builtin __atomic_add_fetch to test lock + bus for ARMv6-v8. + * stress-epoll: void return on timer_settime + * Manual: update contributors, add Zhiyi Sun + +------------------------------------------------------------------- +Tue Jul 12 19:05:38 UTC 2016 - [email protected] + +- Use correct rpm group + +------------------------------------------------------------------- Old: ---- stress-ng-0.06.07.tar.gz New: ---- stress-ng-0.06.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ stress-ng.spec ++++++ --- /var/tmp/diff_new_pack.M7GIJ8/_old 2016-07-20 09:18:05.000000000 +0200 +++ /var/tmp/diff_new_pack.M7GIJ8/_new 2016-07-20 09:18:05.000000000 +0200 @@ -18,19 +18,20 @@ Name: stress-ng -Version: 0.06.07 +Version: 0.06.12 Release: 0 Summary: Tool to load and stress a computer License: GPL-2.0 -Group: System/Monitoring +Group: System/Benchmark Url: http://kernel.ubuntu.com/~cking/stress-ng/ Source: http://kernel.ubuntu.com/~cking/tarballs/%{name}/%{name}-%{version}.tar.gz BuildRequires: keyutils-devel BuildRequires: libaio-devel BuildRequires: libattr-devel BuildRequires: libbsd-devel -BuildRequires: zlib-devel +BuildRequires: libcap-devel BuildRequires: libseccomp-devel +BuildRequires: zlib-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ stress-ng-0.06.07.tar.gz -> stress-ng-0.06.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/Makefile new/stress-ng-0.06.12/Makefile --- old/stress-ng-0.06.07/Makefile 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/Makefile 2016-07-15 16:26:33.000000000 +0200 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.06.07 +VERSION=0.06.12 # # Codename "pathological process pounder" # @@ -35,6 +35,7 @@ stress-aio.c \ stress-aio-linux.c \ stress-apparmor.c \ + stress-atomic.c \ stress-bigheap.c \ stress-bind-mount.c \ stress-brk.c \ @@ -226,7 +227,7 @@ HAVE_NOT=HAVE_APPARMOR=0 HAVE_KEYUTILS_H=0 HAVE_XATTR_H=0 HAVE_LIB_BSD=0 \ HAVE_LIB_Z=0 HAVE_LIB_CRYPT=0 HAVE_LIB_RT=0 HAVE_LIB_PTHREAD=0 \ HAVE_FLOAT_DECIMAL=0 HAVE_SECCOMP_H=0 HAVE_LIB_AIO=0 HAVE_SYS_CAP_H=0 \ - HAVE_VECMATH=0 + HAVE_VECMATH=0 HAVE_ATOMIC=0 # # Do build time config only if cmd is "make" and no goals given @@ -334,9 +335,15 @@ CFLAGS += -DHAVE_VECMATH endif endif -endif +ifndef $(HAVE_ATOMIC) +HAVE_ATOMIC = $(shell $(MAKE) --no-print-directory $(HAVE_NOT) have_atomic) +ifeq ($(HAVE_ATOMIC),1) + CFLAGS += -DHAVE_ATOMIC +endif +endif +endif .SUFFIXES: .c .o @@ -531,6 +538,17 @@ fi @rm -rf stress-vecmath-test.o +# +# check if we can build atomic related code +# +have_atomic: stress-atomic.c + @$(CC) $(CPPFLAGS) -DTEST_ATOMIC_BUILD -DHAVE_ATOMIC stress-atomic.c -o stress-atomic-test 2> /dev/null || true + @if [ -e stress-atomic-test ]; then \ + echo 1 ;\ + else \ + echo 0 ;\ + fi + @rm -rf stress-atomic-test # # extract the PER_* personality enums diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-atomic.c new/stress-ng-0.06.12/stress-atomic.c --- old/stress-ng-0.06.07/stress-atomic.c 1970-01-01 01:00:00.000000000 +0100 +++ new/stress-ng-0.06.12/stress-atomic.c 2016-07-15 16:26:33.000000000 +0200 @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2013-2016 Canonical, Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * This code is a complete clean re-write of the stress tool by + * Colin Ian King <[email protected]> and attempts to be + * backwardly compatible with the stress tool by Amos Waterland + * <[email protected]> but has more stress tests and more + * functionality. + * + */ +#define _GNU_SOURCE + +#include <stdint.h> +#include <inttypes.h> + +#define DO_ATOMIC_OPS(type, var) \ +{ \ + type tmp = mwc64(); \ + \ + __atomic_store(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_load(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_load(var, &tmp, __ATOMIC_ACQUIRE); \ + __atomic_add_fetch(var, 1, __ATOMIC_RELAXED); \ + __atomic_add_fetch(var, 2, __ATOMIC_ACQUIRE); \ + __atomic_sub_fetch(var, 3, __ATOMIC_RELAXED); \ + __atomic_sub_fetch(var, 4, __ATOMIC_ACQUIRE); \ + __atomic_and_fetch(var, ~1, __ATOMIC_RELAXED); \ + __atomic_and_fetch(var, ~2, __ATOMIC_ACQUIRE); \ + __atomic_xor_fetch(var, ~4, __ATOMIC_RELAXED); \ + __atomic_xor_fetch(var, ~8, __ATOMIC_ACQUIRE); \ + __atomic_or_fetch(var, 16, __ATOMIC_RELAXED); \ + __atomic_or_fetch(var, 32, __ATOMIC_ACQUIRE); \ + __atomic_nand_fetch(var, 64, __ATOMIC_RELAXED); \ + __atomic_nand_fetch(var, 128, __ATOMIC_ACQUIRE);\ + __atomic_clear(var, __ATOMIC_RELAXED); \ + \ + __atomic_store(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_fetch_add(var, 1, __ATOMIC_RELAXED); \ + __atomic_fetch_add(var, 2, __ATOMIC_ACQUIRE); \ + __atomic_fetch_sub(var, 3, __ATOMIC_RELAXED); \ + __atomic_fetch_sub(var, 4, __ATOMIC_ACQUIRE); \ + __atomic_fetch_and(var, ~1, __ATOMIC_RELAXED); \ + __atomic_fetch_and(var, ~2, __ATOMIC_ACQUIRE); \ + __atomic_fetch_xor(var, ~4, __ATOMIC_RELAXED); \ + __atomic_fetch_xor(var, ~8, __ATOMIC_ACQUIRE); \ + __atomic_fetch_or(var, 16, __ATOMIC_RELAXED); \ + __atomic_fetch_or(var, 32, __ATOMIC_ACQUIRE); \ + __atomic_fetch_nand(var, 64, __ATOMIC_RELAXED); \ + __atomic_fetch_nand(var, 128, __ATOMIC_ACQUIRE);\ + __atomic_clear(var, __ATOMIC_RELAXED); \ + \ + __atomic_store(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_load(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_add_fetch(var, 1, __ATOMIC_RELAXED); \ + __atomic_sub_fetch(var, 3, __ATOMIC_RELAXED); \ + __atomic_and_fetch(var, ~1, __ATOMIC_RELAXED); \ + __atomic_xor_fetch(var, ~4, __ATOMIC_RELAXED); \ + __atomic_or_fetch(var, 16, __ATOMIC_RELAXED); \ + __atomic_nand_fetch(var, 64, __ATOMIC_RELAXED); \ + __atomic_load(var, &tmp, __ATOMIC_ACQUIRE); \ + __atomic_add_fetch(var, 2, __ATOMIC_ACQUIRE); \ + __atomic_sub_fetch(var, 4, __ATOMIC_ACQUIRE); \ + __atomic_and_fetch(var, ~2, __ATOMIC_ACQUIRE); \ + __atomic_xor_fetch(var, ~8, __ATOMIC_ACQUIRE); \ + __atomic_or_fetch(var, 32, __ATOMIC_ACQUIRE); \ + __atomic_nand_fetch(var, 128, __ATOMIC_ACQUIRE);\ + __atomic_clear(var, __ATOMIC_RELAXED); \ + \ + __atomic_store(var, &tmp, __ATOMIC_RELAXED); \ + __atomic_fetch_add(var, 1, __ATOMIC_RELAXED); \ + __atomic_fetch_sub(var, 3, __ATOMIC_RELAXED); \ + __atomic_fetch_and(var, ~1, __ATOMIC_RELAXED); \ + __atomic_fetch_xor(var, ~4, __ATOMIC_RELAXED); \ + __atomic_fetch_or(var, 16, __ATOMIC_RELAXED); \ + __atomic_fetch_nand(var, 64, __ATOMIC_RELAXED); \ + __atomic_fetch_add(var, 2, __ATOMIC_ACQUIRE); \ + __atomic_fetch_sub(var, 4, __ATOMIC_ACQUIRE); \ + __atomic_fetch_and(var, ~2, __ATOMIC_ACQUIRE); \ + __atomic_fetch_xor(var, ~8, __ATOMIC_ACQUIRE); \ + __atomic_fetch_or(var, 32, __ATOMIC_ACQUIRE); \ + __atomic_fetch_nand(var, 128, __ATOMIC_ACQUIRE);\ + __atomic_clear(var, __ATOMIC_RELAXED); \ +} + + +#if defined(TEST_ATOMIC_BUILD) +static inline uint64_t mwc64(void) +{ + return 0; +} + +int main(void) +{ + uint64_t val64; + uint32_t val32; + uint16_t val16; + uint8_t val8; + + DO_ATOMIC_OPS(uint64_t, &val64); + DO_ATOMIC_OPS(uint32_t, &val32); + DO_ATOMIC_OPS(uint16_t, &val16); + DO_ATOMIC_OPS(uint8_t, &val8); + + return 0; +} + +#else + +#include "stress-ng.h" + +#if defined(STRESS_ATOMIC) + +/* + * stress_atomic() + * stress gcc atomic memory ops + */ +int stress_atomic( + uint64_t *const counter, + const uint32_t instance, + const uint64_t max_ops, + const char *name) +{ + (void)instance; + (void)name; + + do { + DO_ATOMIC_OPS(uint64_t, &shared->atomic.val64); + DO_ATOMIC_OPS(uint32_t, &shared->atomic.val32); + DO_ATOMIC_OPS(uint16_t, &shared->atomic.val16); + DO_ATOMIC_OPS(uint8_t, &shared->atomic.val8); + (*counter)++; + } while (opt_do_run && (!max_ops || *counter < max_ops)); + + return EXIT_SUCCESS; +} +#endif + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-copy-file.c new/stress-ng-0.06.12/stress-copy-file.c --- old/stress-ng-0.06.07/stress-copy-file.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-copy-file.c 2016-07-15 16:26:33.000000000 +0200 @@ -134,7 +134,9 @@ ret = sys_copy_file_range(fd_in, &off_in, fd_out, &off_out, DEFAULT_COPY_FILE_SIZE, 0); if (ret < 0) { - if ((errno == EAGAIN) || (errno == EINTR)) + if ((errno == EAGAIN) || + (errno == EINTR) || + (errno == ENOSPC)) continue; pr_fail_err(name, "copy_file_range"); goto tidy_out; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-epoll.c new/stress-ng-0.06.12/stress-epoll.c --- old/stress-ng-0.06.07/stress-epoll.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-epoll.c 2016-07-15 16:26:33.000000000 +0200 @@ -124,7 +124,7 @@ timer.it_interval.tv_sec = timer.it_value.tv_sec; timer.it_interval.tv_nsec = timer.it_value.tv_nsec; - timer_settime(epoll_timerid, 0, &timer, NULL); + (void)timer_settime(epoll_timerid, 0, &timer, NULL); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-fault.c new/stress-ng-0.06.12/stress-fault.c --- old/stress-ng-0.06.07/stress-fault.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-fault.c 2016-07-15 16:26:33.000000000 +0200 @@ -28,6 +28,7 @@ #include <stdlib.h> #include <stdint.h> #include <errno.h> +#include <setjmp.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> @@ -37,6 +38,21 @@ #include "stress-ng.h" +static sigjmp_buf jmp_env; +static volatile bool do_jmp = true; + +/* + * stress_segvhandler() + * SEGV handler + */ +static void MLOCKED stress_segvhandler(int dummy) +{ + (void)dummy; + + if (do_jmp) + siglongjmp(jmp_env, 1); /* Ugly, bounce back */ +} + /* * stress_fault() * stress min and max page faulting @@ -49,7 +65,7 @@ { struct rusage usage; char filename[PATH_MAX]; - int ret, i = 0; + int ret, i; const pid_t pid = getpid(); ret = stress_temp_dir_mk(name, pid, instance); @@ -60,10 +76,22 @@ name, pid, instance, mwc32()); (void)umask(0077); + i = 0; + + if (stress_sighandler(name, SIGSEGV, stress_segvhandler, NULL) < 0) + return EXIT_FAILURE; + do { char *ptr; int fd; + ret = sigsetjmp(jmp_env, 1); + if (ret) { + do_jmp = false; + pr_err(stderr, "%s: unexpected segmentation fault\n", name); + break; + } + fd = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); if (fd < 0) { if ((errno == ENOSPC) || (errno == ENOMEM)) @@ -102,6 +130,14 @@ } } #endif + ret = sigsetjmp(jmp_env, 1); + if (ret) { + if (!opt_do_run || (max_ops && *counter >= max_ops)) + do_jmp = false; + if (fd != -1) + (void)close(fd); + goto next; + } /* * Removing file here causes major fault when we touch @@ -113,6 +149,7 @@ ptr = mmap(NULL, 1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); (void)close(fd); + fd = -1; if (ptr == MAP_FAILED) { pr_err(stderr, "%s: mmap failed: errno=%d (%s)\n", @@ -128,6 +165,7 @@ break; } +next: /* Remove file on-non major fault case */ if (!(i & 1)) (void)unlink(filename); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-fcntl.c new/stress-ng-0.06.12/stress-fcntl.c --- old/stress-ng-0.06.07/stress-fcntl.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-fcntl.c 2016-07-15 16:26:33.000000000 +0200 @@ -155,7 +155,7 @@ { int ret; struct f_owner_ex owner; - + owner.type = F_OWNER_PID; owner.pid = getpid(); ret = fcntl(fd, F_SETOWN_EX, &owner); @@ -260,12 +260,14 @@ ret = fcntl(fd, F_GETLK, &f); check_return(ret, name, "F_GETLK"); +#if 0 if (f.l_type != F_UNLCK) { pr_fail(stderr, "%s: fcntl F_GETLK failed, " "expecting l_type to return F_UNLCK\n", name); goto lock_abort; } +#endif f.l_type = F_WRLCK; f.l_whence = SEEK_SET; @@ -274,6 +276,8 @@ f.l_pid = getpid(); ret = fcntl(fd, F_SETLK, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto lock_abort; check_return(ret, name, "F_SETLK (F_WRLCK)"); f.l_type = F_UNLCK; @@ -283,6 +287,9 @@ f.l_pid = getpid(); ret = fcntl(fd, F_SETLK, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto lock_abort; + check_return(ret, name, "F_SETLK (F_UNLCK)"); f.l_type = F_WRLCK; @@ -292,6 +299,8 @@ f.l_pid = getpid(); ret = fcntl(fd, F_SETLKW, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto lock_abort; check_return(ret, name, "F_SETLKW (F_WRLCK)"); f.l_type = F_UNLCK; @@ -331,12 +340,14 @@ ret = fcntl(fd, F_OFD_GETLK, &f); check_return(ret, name, "F_GETLK"); +#if 0 if (f.l_type != F_UNLCK) { pr_fail(stderr, "%s: fcntl F_OFD_GETLK failed, " "expecting l_type to return F_UNLCK\n", name); goto ofd_lock_abort; } +#endif f.l_type = F_WRLCK; f.l_whence = SEEK_SET; @@ -345,6 +356,8 @@ f.l_pid = 0; ret = fcntl(fd, F_OFD_SETLK, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto ofd_lock_abort; check_return(ret, name, "F_OFD_SETLK (F_WRLCK)"); f.l_type = F_UNLCK; @@ -354,6 +367,8 @@ f.l_pid = 0; ret = fcntl(fd, F_OFD_SETLK, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto ofd_lock_abort; check_return(ret, name, "F_OFD_SETLK (F_UNLCK)"); f.l_type = F_WRLCK; @@ -363,6 +378,8 @@ f.l_pid = 0; ret = fcntl(fd, F_OFD_SETLKW, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto ofd_lock_abort; check_return(ret, name, "F_OFD_SETLKW (F_WRLCK)"); f.l_type = F_UNLCK; @@ -372,6 +389,8 @@ f.l_pid = 0; ret = fcntl(fd, F_OFD_SETLK, &f); + if ((ret < 0) && (errno == EAGAIN)) + goto ofd_lock_abort; check_return(ret, name, "F_OFD_SETLK (F_UNLCK)"); ofd_lock_abort: { /* Nowt */ } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-icache.c new/stress-ng-0.06.12/stress-icache.c --- old/stress-ng-0.06.07/stress-icache.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-icache.c 2016-07-15 16:26:33.000000000 +0200 @@ -34,6 +34,8 @@ #if defined(STRESS_ICACHE) +#define SIZE (4096) + #if defined(__GNUC__) && NEED_GNUC(4,6,0) #define SECTION(s) __attribute__((__section__(# s))) #define ALIGNED(a) __attribute__((aligned(a))) @@ -45,11 +47,12 @@ * code mapping and make it modifyable to force I-cache * refreshes by modifying the code */ -static void SECTION(stress_icache_callee) ALIGNED(4096) stress_icache_func(void) +static void SECTION(stress_icache_callee) ALIGNED(SIZE) stress_icache_func(void) { return; } + /* * stress_icache() * stress instruction cache load misses @@ -57,21 +60,35 @@ * I-cache load misses can be observed using: * perf stat -e L1-icache-load-misses stress-ng --icache 0 -t 1 */ -int SECTION(stress_icache_caller) stress_icache( +int SECTION(stress_icache_caller) ALIGNED(SIZE) stress_icache( uint64_t *const counter, const uint32_t instance, const uint64_t max_ops, const char *name) { volatile uint8_t *addr = (uint8_t *)stress_icache_func; + const size_t page_size = stress_get_pagesize(); (void)instance; - if (mprotect((void *)addr, 4096, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) { - pr_err(stderr, "%s: PROT_WRITE mprotect failed: errno=%d (%s)\n", - name, errno, strerror(errno)); - return EXIT_FAILURE; + if (page_size != SIZE) { + pr_inf(stderr, "%s: page size %zu is not %u, cannot test\n", + name, page_size, SIZE); + return EXIT_NO_RESOURCE; } +#if defined(MADV_NOHUGEPAGE) + if (madvise((void *)addr, SIZE, MADV_NOHUGEPAGE) < 0) { + /* + * We may get EINVAL on kernels that don't support this + * so don't treat that as non-fatal as this is just advistory + */ + if (errno != EINVAL) { + pr_inf(stderr, "%s: madvise MADV_NOHUGEPAGE failed on text page %p: errno=%d (%s)\n", + name, addr, errno, strerror(errno)); + return EXIT_NO_RESOURCE; + } + } +#endif do { register uint8_t val; @@ -79,27 +96,54 @@ while (--i) { /* - * Modifying executable code on x86 will - * call a I-cache reload when we execute - * the modfied ops. + * Change protection to make page modifyable. It may be that + * some architectures don't allow this, so don't bail out on + * a EXIT_FAILURE; this is a not necessarily a fault in the + * the stressor, just an arch resource protection issue. + */ + if (mprotect((void *)addr, SIZE, PROT_READ | PROT_WRITE) < 0) { + pr_inf(stderr, "%s: PROT_WRITE mprotect failed on text page %p: errno=%d (%s)\n", + name, addr, errno, strerror(errno)); + return EXIT_NO_RESOURCE; + } + /* + * Modifying executable code on x86 will + * call a I-cache reload when we execute + * the modfied ops. */ val = *addr; *addr ^= ~0; + + /* + * ARM CPUs need us to clear the I$ between + * each modification of the object code. + * + * We may need to do the same for other processors + * as the default code assumes smart x86 style + * I$ behaviour. + */ +#if defined(__GNUC__) && defined(STRESS_ARM) + __clear_cache((char *)addr, (char *)addr + 64); +#endif *addr = val; - stress_icache_func(); -#if defined(__GNUC__) +#if defined(__GNUC__) && defined(STRESS_ARM) __clear_cache((char *)addr, (char *)addr + 64); #endif + /* + * Set back to a text segment READ/EXEC page attributes, this + * really should not fail. + */ + if (mprotect((void *)addr, SIZE, PROT_READ | PROT_EXEC) < 0) { + pr_err(stderr, "%s: mprotect failed: errno=%d (%s)\n", + name, errno, strerror(errno)); + return EXIT_FAILURE; + } + + stress_icache_func(); } (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); - if (mprotect((void *)addr, 4096, PROT_READ | PROT_EXEC) < 0) { - pr_err(stderr, "%s: mprotect failed: errno=%d (%s)\n", - name, errno, strerror(errno)); - return EXIT_FAILURE; - } - return EXIT_SUCCESS; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-lockbus.c new/stress-ng-0.06.12/stress-lockbus.c --- old/stress-ng-0.06.07/stress-lockbus.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-lockbus.c 2016-07-15 16:26:33.000000000 +0200 @@ -37,12 +37,20 @@ #include <sys/mman.h> #define BUFFER_SIZE (1024 * 1024 * 16) -#define CHUNK_SIZE (64) +#define CHUNK_SIZE (64 * 4) -#define LOCK_AND_INC(ptr, inc) \ - asm volatile("lock addb %1,%0" : "+m" (*ptr) : "ir" (inc)); \ +#if defined(__GNUC__) && NEED_GNUC(4,7,0) +#define LOCK_AND_INC(ptr, inc) \ + __atomic_add_fetch(ptr, inc, __ATOMIC_SEQ_CST); \ ptr++; +#else +#define LOCK_AND_INC(ptr, inc) \ + asm volatile("lock addl %1,%0" : "+m" (*ptr) : "ir" (inc)); \ + ptr++; + +#endif + #define LOCK_AND_INCx8(ptr, inc) \ LOCK_AND_INC(ptr, inc) \ LOCK_AND_INC(ptr, inc) \ @@ -63,7 +71,7 @@ const uint64_t max_ops, const char *name) { - uint8_t *buffer; + uint32_t *buffer; int flags = MAP_ANONYMOUS | MAP_SHARED; (void)instance; @@ -79,8 +87,8 @@ } do { - uint8_t *ptr = buffer + (mwc32() % (BUFFER_SIZE - CHUNK_SIZE)); - const uint8_t inc = 1; + uint32_t *ptr = buffer + ((mwc32() % (BUFFER_SIZE - CHUNK_SIZE)) >> 2); + const uint32_t inc = 1; LOCK_AND_INCx8(ptr, inc); LOCK_AND_INCx8(ptr, inc); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-ng.1 new/stress-ng-0.06.12/stress-ng.1 --- old/stress-ng-0.06.07/stress-ng.1 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-ng.1 2016-07-15 16:26:33.000000000 +0200 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH STRESS-NG 1 "May 4, 2016" +.TH STRESS-NG 1 "July 15, 2016" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -359,6 +359,15 @@ .B \-\-apparmor-ops stop the AppArmor workers after N bogo operations. .TP +.B \-\-atomic N +start N workers that exercise various GCC __atomic_*() build in operations +on 8, 16, 32 and 64 bit intergers that are shared among the N workers. This +stressor is only available for builds using GCC 4.7.4 or higher. The stressor +forces many front end cache stalls and cache references. +.TP +.B \-\-atomic\-ops N +stop the atomic workers after N bogo atomic operations. +.TP .B \-B N, \-\-bigheap N start N workers that grow their heaps by reallocating memory. If the out of memory killer (OOM) on Linux kills the worker or the allocation fails then the @@ -2739,7 +2748,8 @@ T} 3 T{ One or more stressors failed to initialise because of lack of resources, -for example ENOMEM (no memory) and ENOSPC (no space on file system). +for example ENOMEM (no memory), ENOSPC (no space on file system) or a +missing or unimplemented system call. T} .TE .SH BUGS @@ -2755,7 +2765,7 @@ is a clean room re-implementation and extension of the original stress tool by Amos Waterland <[email protected]>. Thanks also for contributions from Christian Ehrhardt, James Hunt, Jim Rowan, -Tim Gardner and Luca Pizzamiglio. +Tim Gardner, Luca Pizzamiglio and Zhiyi Sun. .SH NOTES Note that the stress\-ng cpu, io, vm and hdd tests are different implementations of the original stress diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-ng.c new/stress-ng-0.06.12/stress-ng.c --- old/stress-ng-0.06.07/stress-ng.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-ng.c 2016-07-15 16:26:33.000000000 +0200 @@ -152,6 +152,9 @@ #if defined(STRESS_APPARMOR) STRESSOR(apparmor, APPARMOR, CLASS_OS | CLASS_SECURITY), #endif +#if defined(STRESS_ATOMIC) + STRESSOR(atomic, ATOMIC, CLASS_CPU | CLASS_MEMORY), +#endif STRESSOR(bigheap, BIGHEAP, CLASS_OS | CLASS_VM), #if defined(STRESS_BIND_MOUNT) STRESSOR(bind_mount, BIND_MOUNT, CLASS_FILESYSTEM | CLASS_OS | CLASS_PATHOLOGICAL), @@ -523,6 +526,10 @@ { "apparmor", 1, 0, OPT_APPARMOR }, { "apparmor-ops",1, 0, OPT_APPARMOR_OPS }, #endif +#if defined(STRESS_ATOMIC) + { "atomic", 1, 0, OPT_ATOMIC }, + { "atomic-ops", 1, 0, OPT_ATOMIC_OPS }, +#endif { "backoff", 1, 0, OPT_BACKOFF }, { "bigheap", 1, 0, OPT_BIGHEAP }, { "bigheap-ops",1, 0, OPT_BIGHEAP_OPS }, @@ -1229,6 +1236,10 @@ { NULL, "apparmor", "start N workers exercising AppArmor interfaces" }, { NULL, "apparmor-ops", "stop after N bogo AppArmor worker bogo operations" }, #endif +#if defined(STRESS_ATOMIC) + { NULL, "atomic", "start N workers exercising GCC atomic operations" }, + { NULL, "atomic-ops", "stop after N bogo atomic bogo operations" }, +#endif { "B N", "bigheap N", "start N workers that grow the heap using calloc()" }, { NULL, "bigheap-ops N", "stop after N bogo bigheap operations" }, { NULL, "bigheap-growth N", "grow heap by N bytes per iteration" }, @@ -1246,7 +1257,7 @@ { NULL, "cache-ops N", "stop after N cache bogo operations" }, { NULL, "cache-prefetch", "prefetch on memory reads/writes" }, { NULL, "cache-flush", "flush cache after every memory write (x86 only)" }, - { NULL, "cache-fence", "serialize stores (x86 only)" }, + { NULL, "cache-fence", "serialize stores" }, { NULL, "cache-level N", "only exercise specified cache" }, { NULL, "cache-ways N", "only fill specified number of cache ways" }, #if defined(STRESS_CAP) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-ng.h new/stress-ng-0.06.12/stress-ng.h --- old/stress-ng-0.06.07/stress-ng.h 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-ng.h 2016-07-15 16:26:33.000000000 +0200 @@ -577,6 +577,16 @@ #define STRESS_X86 1 #endif +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ + defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || \ + defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) || \ + defined(__ARM_ARCH_6M__) || defined(__ARM_ARCH_7__) || \ + defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || \ + defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) || \ + defined(__ARM_ARCH_8A__) || defined(__aarch64__) +#define STRESS_ARM 1 +#endif + #if NEED_GNUC(4,7,0) #define STRESS_VECTOR 1 #endif @@ -793,6 +803,12 @@ uint32_t mem_cache_ways; /* cache ways size */ uint8_t str_shared[STR_SHARED_SIZE]; /* str copying buffer */ struct { + uint64_t val64; + uint32_t val32; + uint16_t val16; + uint8_t val8; + } atomic; /* Shared atomic temp vars */ + struct { uint32_t futex[STRESS_PROCS_MAX]; /* Shared futexes */ uint64_t timeout[STRESS_PROCS_MAX]; /* Shared futex timeouts */ } futex; @@ -853,6 +869,10 @@ __STRESS_APPARMOR, #define STRESS_APPARMOR __STRESS_APPARMOR #endif +#if defined(HAVE_ATOMIC) + __STRESS_ATOMIC, +#define STRESS_ATOMIC __STRESS_ATOMIC +#endif STRESS_BRK, STRESS_BSEARCH, STRESS_BIGHEAP, @@ -953,7 +973,8 @@ #define STRESS_HEAPSORT __STRESS_HEAPSORT #endif STRESS_HSEARCH, -#if defined(STRESS_X86) && defined(__GNUC__) && NEED_GNUC(4,6,0) +#if (defined(STRESS_X86) || defined(STRESS_ARM)) && \ + defined(__GNUC__) && NEED_GNUC(4,6,0) __STRESS_ICACHE, #define STRESS_ICACHE __STRESS_ICACHE #endif @@ -985,7 +1006,8 @@ #define STRESS_LEASE __STRESS_LEASE #endif STRESS_LINK, -#if (defined(__GNUC__) || defined(__clang__)) && defined(STRESS_X86) && defined(__linux__) +#if (((defined(__GNUC__) || defined(__clang__)) && defined(STRESS_X86)) || \ + (defined(__GNUC__) && NEED_GNUC(4,7,0) && defined(STRESS_ARM))) && defined(__linux__) __STRESS_LOCKBUS, #define STRESS_LOCKBUS __STRESS_LOCKBUS #endif @@ -1360,6 +1382,11 @@ OPT_APPARMOR_OPS, #endif +#if defined(STRESS_ATOMIC) + OPT_ATOMIC, + OPT_ATOMIC_OPS, +#endif + OPT_BRK, OPT_BRK_OPS, OPT_BRK_NOTOUCH, @@ -2515,6 +2542,7 @@ STRESS(stress_aio); STRESS(stress_aiol); STRESS(stress_apparmor); +STRESS(stress_atomic); STRESS(stress_bigheap); STRESS(stress_bind_mount); STRESS(stress_brk); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-ptrace.c new/stress-ng-0.06.12/stress-ptrace.c --- old/stress-ng-0.06.07/stress-ptrace.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-ptrace.c 2016-07-15 16:26:33.000000000 +0200 @@ -56,7 +56,8 @@ return true; } if (waitpid(pid, &status, 0) < 0) { - pr_fail_dbg(name, "waitpid"); + if (errno != EINTR) + pr_fail_dbg(name, "waitpid"); return true; } @@ -124,8 +125,11 @@ setpgid(pid, pgrp); if (waitpid(pid, &status, 0) < 0) { - pr_fail_dbg(name, "waitpid"); - return EXIT_FAILURE; + if (errno != EINTR) { + pr_fail_dbg(name, "waitpid"); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } if (ptrace(PTRACE_SETOPTIONS, pid, 0, PTRACE_O_TRACESYSGOOD) < 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-seal.c new/stress-ng-0.06.12/stress-seal.c --- old/stress-ng-0.06.07/stress-seal.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-seal.c 2016-07-15 16:26:33.000000000 +0200 @@ -97,6 +97,11 @@ fd = sys_memfd_create(filename, MFD_ALLOW_SEALING); if (fd < 0) { + if (errno == ENOSYS) { + pr_inf(stderr, "%s: aborting, unimplemented " + "system call memfd_created\n", name); + return EXIT_NO_RESOURCE; + } pr_fail_err(name, "memfd_create"); return EXIT_FAILURE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/stress-tlb-shootdown.c new/stress-ng-0.06.12/stress-tlb-shootdown.c --- old/stress-ng-0.06.07/stress-tlb-shootdown.c 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/stress-tlb-shootdown.c 2016-07-15 16:26:33.000000000 +0200 @@ -72,12 +72,6 @@ return EXIT_FAILURE; } cpus = CPU_COUNT(&proc_mask); - if (cpus < 2) { - pr_fail(stderr, "%s: requires 2 or more CPUs to " - "be effective, only have %d available\n", - name, (int)CPU_COUNT(&proc_mask)); - return EXIT_NO_RESOURCE; - } tlb_procs = STRESS_MAXIMUM(cpus, MAX_TLB_PROCS); for (;;) { @@ -147,7 +141,6 @@ (*counter)++; } while (opt_do_run && (!max_ops || *counter < max_ops)); - return EXIT_SUCCESS; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/stress-ng-0.06.07/syscalls.txt new/stress-ng-0.06.12/syscalls.txt --- old/stress-ng-0.06.07/syscalls.txt 2016-06-24 10:57:11.000000000 +0200 +++ new/stress-ng-0.06.12/syscalls.txt 2016-07-15 16:26:33.000000000 +0200 @@ -186,6 +186,7 @@ prctl process name setting pread readahead preadv +preadv2 prlimit get /proc proc process_vm_readv vm_rw @@ -194,6 +195,7 @@ ptrace ptrace pwrite readahead, aio pwritev ioprio +pwritev2 quotactl quota read pipe, zero, .. readahead readahead @@ -210,6 +212,7 @@ removexattr rename rename renameat +renameat2 request_key key restart_syscall [ ignore this ] rmdir dir
