Hello community,

here is the log from the commit of package stress-ng for openSUSE:Factory 
checked in at 2019-10-22 15:45:05
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/stress-ng (Old)
 and      /work/SRC/openSUSE:Factory/.stress-ng.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "stress-ng"

Tue Oct 22 15:45:05 2019 rev:67 rq:741614 version:0.10.08

Changes:
--------
--- /work/SRC/openSUSE:Factory/stress-ng/stress-ng.changes      2019-10-02 
14:55:53.819286182 +0200
+++ /work/SRC/openSUSE:Factory/.stress-ng.new.2352/stress-ng.changes    
2019-10-22 15:45:05.993693071 +0200
@@ -1,0 +2,23 @@
+Mon Oct 21 13:26:17 UTC 2019 - Martin Hauke <[email protected]>
+
+- Update to version 0.10.08
+  * README: Add SuSE package information
+  * stress-x86syscall: use cpuid if it is available
+  * stress-judy: Add Judy array stressor
+  * Add memory hotplug stressor
+  * stress-sendfile: add missing line after variable declaration
+  * stress-dev: add some more linux keyboard ioctls to exercise
+  * stress-tree: fix error messages when nodes are not found
+  * stress-swap: detect for EINVAL errors on swapon
+  * stress-filename: don't use chars in filename that throw EILSEQ
+    errors
+  * stress-fiemap: detect if file system can support FIEMAP ioctls
+  * stress-zlib: make some char * pointers non-clobberable by longjmp
+  * stress-urandom: add mmap'ing to /dev/urandom for more exercising
+  * stress-zlib: use text_start and text_end based on stress-zlib
+    object code
+  * Add x86syscall vsyscall stressor
+  * stress-tsc: fix info message when tsc is not supported
+- Add BuildRequires "libapparmor-devel" needed by stress-apparmor
+
+-------------------------------------------------------------------

Old:
----
  stress-ng-0.10.07.tar.xz

New:
----
  stress-ng-0.10.08.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ stress-ng.spec ++++++
--- /var/tmp/diff_new_pack.Ugt7js/_old  2019-10-22 15:45:06.825694020 +0200
+++ /var/tmp/diff_new_pack.Ugt7js/_new  2019-10-22 15:45:06.829694025 +0200
@@ -18,7 +18,7 @@
 
 
 Name:           stress-ng
-Version:        0.10.07
+Version:        0.10.08
 Release:        0
 Summary:        Tool to load and stress a computer
 License:        GPL-2.0-only
@@ -27,6 +27,7 @@
 Source:         
https://kernel.ubuntu.com/~cking/tarballs/%{name}/%{name}-%{version}.tar.xz
 BuildRequires:  keyutils-devel
 BuildRequires:  libaio-devel
+BuildRequires:  libapparmor-devel
 BuildRequires:  libattr-devel
 BuildRequires:  libbsd-devel
 BuildRequires:  libcap-devel

++++++ stress-ng-0.10.07.tar.xz -> stress-ng-0.10.08.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/Makefile 
new/stress-ng-0.10.08/Makefile
--- old/stress-ng-0.10.07/Makefile      2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/Makefile      2019-10-21 12:49:31.000000000 +0200
@@ -16,7 +16,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
 #
 
-VERSION=0.10.07
+VERSION=0.10.08
 #
 # Codename "systematic system smasher"
 #
@@ -147,6 +147,7 @@
        stress-iosync.c \
        stress-ipsec-mb.c \
        stress-itimer.c \
+       stress-judy.c \
        stress-kcmp.c \
        stress-key.c \
        stress-kill.c \
@@ -168,6 +169,7 @@
        stress-membarrier.c \
        stress-memcpy.c \
        stress-memfd.c \
+       stress-memhotplug.c \
        stress-memrate.c \
        stress-memthrash.c \
        stress-mergesort.c \
@@ -284,6 +286,7 @@
        stress-wait.c \
        stress-watchdog.c \
        stress-wcstr.c \
+       stress-x86syscall.c \
        stress-xattr.c \
        stress-yield.c \
        stress-zero.c \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/Makefile.config 
new/stress-ng-0.10.08/Makefile.config
--- old/stress-ng-0.10.07/Makefile.config       2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/Makefile.config       2019-10-21 12:49:31.000000000 
+0200
@@ -33,6 +33,7 @@
 LIB_SCTP = -lsctp
 LIB_DL = -ldl
 LIB_IPSEC_MB = -lIPSec_MB
+LIB_JUDY = -lJudy
 
 HAVE_NOT = HAVE_CONFIG=1
 DIR=test
@@ -129,6 +130,15 @@
 endif
 endif
 
+ifndef $(HAVE_LIB_JUDY)
+HAVE_LIB_JUDY = $(shell $(MAKE) -f Makefile.config --no-print-directory 
$(HAVE_NOT) TEST_LIBS=$(LIB_JUDY) TEST_PROG=test-judy have_test_prog)
+ifeq ($(HAVE_LIB_JUDY),1)
+       CONFIG_CFLAGS += -DHAVE_LIB_JUDY
+       CONFIG_LDFLAGS += $(LIB_JUDY)
+$(info autoconfig: using $(LIB_JUDY))
+endif
+endif
+
 ifndef $(HAVE_LIB_PTHREAD_SPINLOCK)
 HAVE_LIB_PTHREAD_SPINLOCK = $(shell $(MAKE) -f Makefile.config 
--no-print-directory $(HAVE_NOT) TEST_LIBS=$(LIB_PTHREAD) 
TEST_PROG=test-libpthread-spinlock have_test_prog)
 ifeq ($(HAVE_LIB_PTHREAD_SPINLOCK),1)
@@ -289,6 +299,14 @@
 endif
 endif
 
+ifndef $(HAVE_JUDY_H)
+HAVE_JUDY_H = $(shell $(MAKE) -f Makefile.config --no-print-directory 
$(HAVE_NOT) HEADER=Judy.h have_header_h)
+ifeq ($(HAVE_JUDY_H),1)
+       CONFIG_CFLAGS += -DHAVE_JUDY_H
+$(info autoconfig: using Judy.h)
+endif
+endif
+
 ifndef $(HAVE_KEYUTILS_H)
 HAVE_KEYUTILS_H = $(shell $(MAKE) -f Makefile.config --no-print-directory 
$(HAVE_NOT) HEADER=keyutils.h have_header_h)
 ifeq ($(HAVE_KEYUTILS_H),1)
@@ -857,6 +875,14 @@
 endif
 endif
 
+ifndef $(HAVE_LINUX_KD_H)
+HAVE_LINUX_KD_H = $(shell $(MAKE) -f Makefile.config --no-print-directory 
$(HAVE_NOT) HEADER=linux/kd.h have_header_h)
+ifeq ($(HAVE_LINUX_KD_H),1)
+       CONFIG_CFLAGS += -DHAVE_LINUX_KD_H
+$(info autoconfig: using linux/kd.h)
+endif
+endif
+
 ifndef $(HAVE_LINUX_LOOP_H)
 HAVE_LINUX_LOOP_H = $(shell $(MAKE) -f Makefile.config --no-print-directory 
$(HAVE_NOT) HEADER=linux/loop.h have_header_h)
 ifeq ($(HAVE_LINUX_LOOP_H),1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/README new/stress-ng-0.10.08/README
--- old/stress-ng-0.10.07/README        2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/README        2019-10-21 12:49:31.000000000 +0200
@@ -40,6 +40,7 @@
   * libcap-dev
   * libgcrypt11-dev
   * libipsec-mb-dev
+  * libjudy-dev
   * libkeyutils-dev
   * libsctp-dev
   * zlib1g-dev
@@ -51,10 +52,20 @@
   * libbsd-devel
   * libcap-devel
   * libgcrypt-devel
+  * Judy-devel
   * keyutils-libs
   * libsctp-devel
   * zlib-devel
 
+SuSE:
+  * libaio-dev
+  * libapparmor-dev
+  * libattr-dev
+  * libbsd-dev
+  * libcap-dev
+  * libgcrypt-dev
+  * zlib1g-dev
+
 NOTE: the build will try to detect build depedencies and will build an image
 with functionality disabled if the support libraries are not installed.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/snap/Makefile 
new/stress-ng-0.10.08/snap/Makefile
--- old/stress-ng-0.10.07/snap/Makefile 2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/snap/Makefile 1970-01-01 01:00:00.000000000 +0100
@@ -1,18 +0,0 @@
-VERSION=$(shell git tag | tail -1 | cut -c2-)
-COMMITS=$(shell git log --oneline | wc -l)
-SHA=$(shell git log -1 --oneline | cut -d' ' -f1)
-DATE=$(shell date +'%Y%m%d')
-V=$(VERSION)-$(DATE)-$(COMMITS)-$(SHA)
-
-all: set_version
-       snapcraft
-
-set_version:
-       cat snapcraft.yaml | sed 's/version: .*/version: $(V)/' > 
snapcraft-tmp.yaml
-       mv snapcraft-tmp.yaml snapcraft.yaml
-
-clean:
-       rm -rf setup *.snap
-       snapcraft clean
-       cat snapcraft.yaml | sed 's/version: .*/version: 0/' > 
snapcraft-tmp.yaml
-       mv snapcraft-tmp.yaml snapcraft.yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/snap/snapcraft.yaml 
new/stress-ng-0.10.08/snap/snapcraft.yaml
--- old/stress-ng-0.10.07/snap/snapcraft.yaml   2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/snap/snapcraft.yaml   2019-10-21 12:49:31.000000000 
+0200
@@ -30,6 +30,7 @@
             - libaio-dev
             - libcap-dev
             - libsctp-dev
+            - libjudy-dev
 apps:
     stress-ng:
         plugs: [ home, log-observe, system-observe, hardware-observe ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-dev.c 
new/stress-ng-0.10.08/stress-dev.c
--- old/stress-ng-0.10.07/stress-dev.c  2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-dev.c  2019-10-21 12:49:31.000000000 +0200
@@ -346,6 +346,52 @@
                (void)ret;
        }
 #endif
+
+#if defined(KDGETLED)
+       {
+               char state;
+
+               ret = ioctl(fd, KDGETLED, &state);
+               (void)ret;
+       }
+#endif
+
+#if defined(KDGKBTYPE)
+       {
+               char type;
+
+               ret = ioctl(fd, KDGKBTYPE, &type);
+               (void)ret;
+       }
+#endif
+
+#if defined(KDGETMODE)
+       {
+               int mode;
+
+               ret = ioctl(fd, KDGETMODE, &mode);
+               (void)ret;
+       }
+#endif
+
+#if defined(KDGKBMODE)
+       {
+               long mode;
+
+               ret = ioctl(fd, KDGKBMODE, &mode);
+               (void)ret;
+       }
+#endif
+
+#if defined(KDGKBMETA)
+       {
+               long mode;
+
+               ret = ioctl(fd, KDGKBMETA, &mode);
+               (void)ret;
+       }
+#endif
+
 }
 #endif
 
@@ -1301,6 +1347,7 @@
                        break;
                if (stress_is_dot_filename(d->d_name))
                        continue;
+
                /*
                 * Xen clients hang on hpet when running as root
                 * see: LP#1741409, so avoid opening /dev/hpet
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-fiemap.c 
new/stress-ng-0.10.08/stress-fiemap.c
--- old/stress-ng-0.10.07/stress-fiemap.c       2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/stress-fiemap.c       2019-10-21 12:49:31.000000000 
+0200
@@ -146,6 +146,13 @@
 
                /* Find out how many extents there are */
                if (ioctl(fd, FS_IOC_FIEMAP, fiemap) < 0) {
+                       if (errno == EOPNOTSUPP) {
+                               pr_inf("%s: FS_IOC_FIEMAP not supported on the 
file system, skipping stressor\n",
+                                       args->name);
+                               free(fiemap);
+                               break;
+                       }
+
                        pr_fail_err("FS_IOC_FIEMAP ioctl()");
                        free(fiemap);
                        break;
@@ -221,6 +228,7 @@
        const uint64_t ops_per_proc = args->max_ops / MAX_FIEMAP_PROCS;
        const uint64_t ops_remaining = args->max_ops % MAX_FIEMAP_PROCS;
        uint64_t fiemap_bytes = DEFAULT_FIEMAP_SIZE;
+       struct fiemap fiemap;
 
        if (!get_setting("fiemap-bytes", &fiemap_bytes)) {
                if (g_opt_flags & OPT_FLAGS_MAXIMIZE)
@@ -257,6 +265,18 @@
        }
        (void)unlink(filename);
 
+       memset(&fiemap, 0, sizeof(fiemap));
+       fiemap.fm_length = ~0;
+       if (ioctl(fd, FS_IOC_FIEMAP, &fiemap) < 0) {
+               errno = EOPNOTSUPP;
+               if (errno == EOPNOTSUPP) {
+                       pr_inf("%s: FS_IOC_FIEMAP not supported on the file 
system, skipping stressor\n",
+                               args->name);
+                       rc = EXIT_NOT_IMPLEMENTED;
+                       goto close_clean;
+               }
+       }
+
        for (n = 0; n < MAX_FIEMAP_PROCS; n++) {
                uint64_t proc_max_ops = ops_per_proc +
                        ((n == 0) ? ops_remaining : 0);
@@ -289,6 +309,7 @@
                (void)shim_waitpid(pids[i], &status, 0);
                add_counter(args, counters[i]);
        }
+close_clean:
        (void)close(fd);
 clean:
        (void)munmap(counters, counters_sz);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-filename.c 
new/stress-ng-0.10.08/stress-filename.c
--- old/stress-ng-0.10.07/stress-filename.c     2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/stress-filename.c     2019-10-21 12:49:31.000000000 
+0200
@@ -118,7 +118,9 @@
                         *  We only expect EINVAL on bad filenames,
                         *  and WSL on Windows 10 can return ENOENT
                         */
-                       if ((errno != EINVAL) && (errno != ENOENT)) {
+                       if ((errno != EINVAL) &&
+                           (errno != ENOENT) &&
+                           (errno != EILSEQ)) {
                                pr_err("%s: creat() failed when probing "
                                        "for allowed filename characters, "
                                        "errno = %d (%s)\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-judy.c 
new/stress-ng-0.10.08/stress-judy.c
--- old/stress-ng-0.10.07/stress-judy.c 1970-01-01 01:00:00.000000000 +0100
+++ new/stress-ng-0.10.08/stress-judy.c 2019-10-21 12:49:31.000000000 +0200
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2013-2019 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.
+ *
+ */
+#include "stress-ng.h"
+
+static const help_t help[] = {
+       { NULL, "judy N",       "start N workers that exercise a judy array 
search" },
+       { NULL, "judy-ops N",   "stop after N judy array search bogo 
operations" },
+       { NULL, "judy-size N",  "number of 32 bit integers to insert into judy 
array" },
+       { NULL, NULL,           NULL }
+};
+
+/*
+ *  stress_set_judy_size()
+ *      set judy size from given option string
+ */
+static int stress_set_judy_size(const char *opt)
+{
+       uint64_t judy_size;
+
+       judy_size = get_uint64(opt);
+       check_range("judy-size", judy_size,
+               MIN_JUDY_SIZE, MAX_JUDY_SIZE);
+       return set_setting("judy-size", TYPE_ID_UINT64, &judy_size);
+}
+
+static const opt_set_func_t opt_set_funcs[] = {
+       { OPT_judy_size,        stress_set_judy_size },
+       { 0,                    NULL }
+};
+
+#if defined(HAVE_JUDY_H) && \
+    defined(HAVE_LIB_JUDY)
+/*
+ *  generate a unique large index position into a Judy array
+ *  from a known small index
+ */
+static inline Word_t gen_index(const Word_t index)
+{
+       return ((~index & 0xff) << 24) | (index & 0x00ffffff);
+}
+
+/*
+ *  stress_judy()
+ *     stress judy
+ */
+static int stress_judy(const args_t *args)
+{
+       uint64_t judy_size = DEFAULT_JUDY_SIZE;
+       size_t n;
+       Word_t i, j;
+
+       if (!get_setting("judy-size", &judy_size)) {
+               if (g_opt_flags & OPT_FLAGS_MAXIMIZE)
+                       judy_size = MAX_JUDY_SIZE;
+               if (g_opt_flags & OPT_FLAGS_MINIMIZE)
+                       judy_size = MIN_JUDY_SIZE;
+       }
+       n = (size_t)judy_size;
+
+       do {
+               Pvoid_t PJLArray = (Pvoid_t)NULL;
+               Word_t *pvalue;
+               int rc;
+
+               /* Step #1, populate Judy array in sparse index order */
+               for (i = 0; i < n; i++) {
+                       Word_t idx = gen_index(i);
+
+                       JLI(pvalue, PJLArray, idx);
+                       if (pvalue == PJERR) {
+                               pr_err("%s: cannot allocate new "
+                                       "judy node\n", args->name);
+                               for (j = 0; j < n; j++) {
+                                       JLD(rc, PJLArray, idx);
+                               }
+                               goto abort;
+                       }
+                       *pvalue = i;
+               }
+
+               /* Step #2, find */
+               for (i = 0; g_keep_stressing_flag && i < n; i++) {
+                       Word_t idx = gen_index(i);
+
+                       JLG(pvalue, PJLArray, idx);
+                       if (g_opt_flags & OPT_FLAGS_VERIFY) {
+                               if (!pvalue) {
+                                       pr_fail("%s: element %" PRIu32
+                                               "could not be found\n",
+                                               args->name, (uint32_t)idx);
+                               } else {
+                                       if ((uint32_t)*pvalue != i)
+                                               pr_fail("%s: element "
+                                                       "%" PRIu32 " found %" 
PRIu32
+                                                       ", expecting %" PRIu32 
"\n",
+                                                       args->name, 
(uint32_t)idx,
+                                                       (uint32_t)*pvalue, 
(uint32_t)i);
+                               }
+                       }
+               }
+
+               /* Step #3, delete, reverse index order */
+               for (j = n -1, i = 0; i < n; i++, j--) {
+                       Word_t idx = gen_index(j);
+
+                       JLD(rc, PJLArray, idx);
+                       if ((g_opt_flags & OPT_FLAGS_VERIFY) && (rc != 1))
+                               pr_fail("%s: element %" PRIu32 " could not "
+                                       "be found\n", args->name, 
(uint32_t)idx);
+               }
+               inc_counter(args);
+       } while (keep_stressing());
+
+abort:
+       return EXIT_SUCCESS;
+}
+
+stressor_info_t stress_judy_info = {
+       .stressor = stress_judy,
+       .class = CLASS_CPU_CACHE | CLASS_CPU | CLASS_MEMORY,
+       .opt_set_funcs = opt_set_funcs,
+       .help = help
+};
+#else
+stressor_info_t stress_judy_info = {
+       .stressor = stress_not_implemented,
+       .class = CLASS_CPU_CACHE | CLASS_CPU | CLASS_MEMORY,
+       .opt_set_funcs = opt_set_funcs,
+       .help = help
+};
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-memhotplug.c 
new/stress-ng-0.10.08/stress-memhotplug.c
--- old/stress-ng-0.10.07/stress-memhotplug.c   1970-01-01 01:00:00.000000000 
+0100
+++ new/stress-ng-0.10.08/stress-memhotplug.c   2019-10-21 12:49:31.000000000 
+0200
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2013-2019 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.
+ *
+ */
+#include "stress-ng.h"
+
+typedef struct {
+       char *name;
+       bool timeout;
+} mem_info_t;
+
+static const help_t help[] = {
+       { NULL, "memhotplug N", "start N workers that exercise memory hotplug" 
},
+       { NULL, "memhotplug-ops N",     "stop after N memory hotplug 
operations" },
+       { NULL, NULL,           NULL }
+};
+
+#if defined(__linux__)
+static const char sys_memory_path[] = "/sys/devices/system/memory";
+
+/*
+ *  stress_memhotplug_supported()
+ *      check if we can run this as root
+ */
+static int stress_memhotplug_supported(void)
+{
+       if (!stress_check_capability(SHIM_CAP_SYS_ADMIN)) {
+               pr_inf("memhotplug stressor will be skipped, "
+                       "need to be running with CAP_SYS_ADMIN "
+                       "rights for this stressor\n");
+               return -1;
+       }
+       return 0;
+}
+
+static void stress_itimer_handler(int sig)
+{
+       (void)sig;
+}
+
+static bool stress_memhotplug_removable(char *name)
+{
+       char path[PATH_MAX];
+       char buf[64];
+       int val;
+
+       (void)snprintf(path, sizeof(path), "%s/%s/removable",
+               sys_memory_path, name);
+       if (system_read(path, buf, sizeof(buf)) < 0)
+               return false;
+       if (sscanf(buf, "%1d", &val) != 1)
+               return false;
+       if (val == 0)
+               return false;
+       return true;
+}
+
+static void stress_memhotplug_set_timer(const unsigned int secs)
+{
+       struct itimerval timer;
+
+       (void)memset(&timer, 0, sizeof(timer));
+       timer.it_value.tv_sec = secs;
+       timer.it_value.tv_usec = 0;
+       timer.it_interval.tv_sec = secs;
+       timer.it_interval.tv_usec = 0;
+       (void)setitimer(ITIMER_PROF, &timer, NULL);
+}
+
+static void stress_memhotplug_mem_toggle(mem_info_t *mem_info)
+{
+       char path[PATH_MAX];
+       int fd;
+       ssize_t n;
+
+       /*
+        *  Skip any hotplug memory regions that previously
+        *  timeout to avoid any repeated delays
+        */
+       if (mem_info->timeout)
+               return;
+
+       if (!stress_memhotplug_removable(mem_info->name))
+               return;
+
+       (void)snprintf(path, sizeof(path), "%s/%s/state",
+               sys_memory_path, mem_info->name);
+       fd = open(path, O_RDWR | O_NONBLOCK);
+       if (fd < 0)
+               return;
+
+       stress_memhotplug_set_timer(3);
+       errno = 0;
+       n = write(fd, "offline", 7);
+       if (n < 0) {
+               if (errno == EINTR)
+                       mem_info->timeout = true;
+       }
+
+       stress_memhotplug_set_timer(5);
+       errno = 0;
+       n = write(fd, "online", 6);
+       (void)n;
+       stress_memhotplug_set_timer(0);
+       (void)close(fd);
+}
+
+static void stress_memhotplug_mem_online(mem_info_t *mem_info)
+{
+       char path[PATH_MAX];
+       int fd;
+       ssize_t n;
+
+       (void)snprintf(path, sizeof(path), "%s/%s/state",
+               sys_memory_path, mem_info->name);
+       fd = open(path, O_RDWR | O_NONBLOCK);
+       if (fd < 0)
+               return;
+
+       stress_memhotplug_set_timer(5);
+       errno = 0;
+       n = write(fd, "online", 6);
+       if (n < 0) {
+               if (errno == EINTR)
+                       mem_info->timeout = true;
+       }
+       stress_memhotplug_set_timer(0);
+       (void)close(fd);
+}
+
+/*
+ *  stress_memhotplug()
+ *     stress the linux memory hotplug subsystem
+ */
+static int stress_memhotplug(const args_t *args)
+{
+       DIR *dir;
+        struct dirent *d;
+       mem_info_t *mem_info;
+       size_t i, n = 0, max;
+
+       if (stress_sighandler(args->name, SIGPROF, stress_itimer_handler, NULL))
+               return EXIT_NO_RESOURCE;
+
+       dir = opendir(sys_memory_path);
+       if (!dir) {
+               pr_inf("%s: %s not accessible, skipping stressor\n",
+                       args->name, sys_memory_path);
+               return EXIT_NOT_IMPLEMENTED;
+       }
+
+       /* Figure out number of potential hotplug memory regsions */
+       while ((d = readdir(dir)) != NULL) {
+               if ((strncmp(d->d_name, "memory", 6) == 0) &&
+                     stress_memhotplug_removable(d->d_name))
+                       n++;
+       }
+       if (n == 0) {
+               pr_inf("%s: no hotplug memory entries found, skipping 
stressor\n",
+                       args->name);
+               (void)closedir(dir);
+               return EXIT_NOT_IMPLEMENTED;
+       }
+       rewinddir(dir);
+
+       mem_info = calloc(n, sizeof(*mem_info));
+       if (!mem_info) {
+               pr_inf("%s: out of memory\n", args->name);
+               return EXIT_NO_RESOURCE;
+       }
+
+       max = 0;
+       while ((max < n) && ((d = readdir(dir)) != NULL)) {
+               if ((strncmp(d->d_name, "memory", 6) == 0) &&
+                    stress_memhotplug_removable(d->d_name)) {
+                       mem_info[max].name = strdup(d->d_name);
+                       mem_info[max].timeout = false;
+                       max++;
+               }
+       }
+       (void)closedir(dir);
+
+       pr_dbg("%s: found %zd removable hotplug memory regions\n",
+               args->name, max);
+
+       do {
+               bool ok = false;
+               for (i = 0; keep_stressing() && (i < max); i++) {
+                       stress_memhotplug_mem_toggle(&mem_info[i]);
+                       if (!mem_info[i].timeout)
+                               ok |= true;
+                       inc_counter(args);
+               }
+               if (!ok) {
+                       for (i = 0; i < max; i++)
+                               stress_memhotplug_mem_online(&mem_info[i]);
+               }
+       } while (keep_stressing());
+
+       for (i = 0; i < max; i++)
+               stress_memhotplug_mem_online(&mem_info[i]);
+       for (i = 0; i < n; i++)
+               free(mem_info[i].name);
+       free(mem_info);
+
+       return EXIT_SUCCESS;
+}
+
+stressor_info_t stress_memhotplug_info = {
+       .stressor = stress_memhotplug,
+       .class = CLASS_OS,
+       .supported = stress_memhotplug_supported,
+       .help = help
+};
+#else
+stressor_info_t stress_memhotplug_info = {
+       .stressor = stress_not_implemented,
+       .class = CLASS_OS,
+       .help = help
+};
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-ng.1 
new/stress-ng-0.10.08/stress-ng.1
--- old/stress-ng-0.10.07/stress-ng.1   2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-ng.1   2019-10-21 12:49:31.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 "September 2, 2019"
+.TH STRESS-NG 1 "October 20, 2019"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -1754,6 +1754,19 @@
 frequency +/- 12.5% random jitter. This tries to force more variability in
 the timer interval to make the scheduling less predictable.
 .TP
+.B \-\-judy N
+start N workers that insert, search and delete 32 bit integers in a Judy
+array using a predictable yet sparse array index. By default,
+there are 131072 integers used in the Judy array.  This is a useful method
+to exercise random access of memory and processor cache.
+.TP
+.B \-\-judy\-ops N
+stop the judy workers after N bogo judy operations are completed.
+.TP
+.B \-\-judy\-size N
+specify the size (number of 32 bit integers) in the Judy array to exercise.
+Size can be from 1K to 4M 32 bit integers.
+.TP
 .B \-\-kcmp N
 start N workers that use kcmp(2) to compare parent and child processes to
 determine if they share kernel resources. Supported only for Linux and
@@ -2133,6 +2146,13 @@
 .B \-\-memfd\-ops N
 stop after N memfd-create(2) bogo operations.
 .TP
+.B \-\-memhotplug N
+start N workers that offline and online memory hotplug regions. Linux only
+and requires CAP_SYS_ADMIN capabilities.
+.TP
+.B \-\-memhotplug\-ops N
+stop memhotplug stressors after N memory offline and online bogo operations.
+.TP
 .B \-\-memrate N
 start N workers that exercise a buffer with 64, 32, 16 and 8 bit reads and
 writes.  This memory stressor allows one to also specify the maximum read
@@ -3871,6 +3891,18 @@
 .B \-\-wcs-ops N
 stop after N bogo wide character string operations.
 .TP
+.B \-\-x86syscall N
+start N workers that repeatedly exercise the x86-64 syscall instruction to
+call the getcpu(2), gettimeofday(2) and time(2) system using the Linux
+vsyscall handler. Only for Linux.
+.TP
+.B \-\-x86syscall\-ops N
+stop after N x86syscall system calls.
+.TP
+.B \-\-x86syscall\-func F
+Instead of exercising the 3 syscall system calls, just call the syscall
+function F. The function F must be one of getcpu, gettimeofday and time.
+.TP
 .B \-\-xattr N
 start N workers that create, update and delete batches of extended attributes
 on a file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-ng.c 
new/stress-ng-0.10.08/stress-ng.c
--- old/stress-ng-0.10.07/stress-ng.c   2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-ng.c   2019-10-21 12:49:31.000000000 +0200
@@ -419,6 +419,9 @@
        { "itimer-freq",1,      0,      OPT_itimer_freq },
        { "itimer-rand",0,      0,      OPT_itimer_rand },
        { "job",        1,      0,      OPT_job },
+       { "judy",       1,      0,      OPT_judy },
+       { "judy-ops",   1,      0,      OPT_judy_ops },
+       { "judy-size",  1,      0,      OPT_judy_size },
        { "kcmp",       1,      0,      OPT_kcmp },
        { "kcmp-ops",   1,      0,      OPT_kcmp_ops },
        { "key",        1,      0,      OPT_key },
@@ -480,6 +483,8 @@
        { "memfd-ops",  1,      0,      OPT_memfd_ops },
        { "memfd-bytes",1,      0,      OPT_memfd_bytes },
        { "memfd-fds",  1,      0,      OPT_memfd_fds },
+       { "memhotplug", 1,      0,      OPT_memhotplug },
+       { "memhotplug-ops",1,   0,      OPT_memhotplug_ops },
        { "memrate",    1,      0,      OPT_memrate },
        { "memrate-ops",1,      0,      OPT_memrate_ops },
        { "memrate-rd-mbs",1,   0,      OPT_memrate_rd_mbs },
@@ -835,6 +840,9 @@
        { "wcs",        1,      0,      OPT_wcs},
        { "wcs-ops",    1,      0,      OPT_wcs_ops },
        { "wcs-method", 1,      0,      OPT_wcs_method },
+       { "x86syscall", 1,      0,      OPT_x86syscall },
+       { "x86syscall-ops",1,   0,      OPT_x86syscall_ops },
+       { "x86syscall-func",1,  0,      OPT_x86syscall_func },
        { "xattr",      1,      0,      OPT_xattr },
        { "xattr-ops",  1,      0,      OPT_xattr_ops },
        { "yaml",       1,      0,      OPT_yaml },
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-ng.h 
new/stress-ng-0.10.08/stress-ng.h
--- old/stress-ng-0.10.07/stress-ng.h   2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-ng.h   2019-10-21 12:49:31.000000000 +0200
@@ -123,6 +123,10 @@
 #include <grp.h>
 #endif
 
+#if defined(HAVE_JUDY_H)
+#include <Judy.h>
+#endif
+
 #if defined(HAVE_INTEL_IPSEC_MB_H)
 #include <intel-ipsec-mb.h>
 #endif
@@ -456,6 +460,10 @@
 #include <linux/hpet.h>
 #endif
 
+#if defined(HAVE_LINUX_KD_H)
+#include <linux/kd.h>
+#endif
+
 #if defined(HAVE_LINUX_LOOP_H)
 #include <linux/loop.h>
 #endif
@@ -1265,6 +1273,10 @@
 #define MAX_IOMIX_BYTES                (256ULL * GB)
 #define DEFAULT_IOMIX_BYTES    (1 * GB)
 
+#define MIN_JUDY_SIZE          (1 * KB)
+#define MAX_JUDY_SIZE          (4 * MB)
+#define DEFAULT_JUDY_SIZE      (256 * KB)
+
 #define MIN_VFORKS             (1)
 #define MAX_VFORKS             (16000)
 #define DEFAULT_VFORKS         (1)
@@ -1909,6 +1921,7 @@
        MACRO(ioprio)           \
        MACRO(ipsec_mb)         \
        MACRO(itimer)           \
+       MACRO(judy)             \
        MACRO(kcmp)             \
        MACRO(key)              \
        MACRO(kill)             \
@@ -1930,6 +1943,7 @@
        MACRO(membarrier)       \
        MACRO(memcpy)           \
        MACRO(memfd)            \
+       MACRO(memhotplug)       \
        MACRO(memrate)          \
        MACRO(memthrash)        \
        MACRO(mergesort)        \
@@ -2048,6 +2062,7 @@
        MACRO(wait)             \
        MACRO(watchdog)         \
        MACRO(wcs)              \
+       MACRO(x86syscall)       \
        MACRO(xattr)            \
        MACRO(yield)            \
        MACRO(zero)             \
@@ -2397,6 +2412,10 @@
        OPT_itimer_freq,
        OPT_itimer_rand,
 
+       OPT_judy,
+       OPT_judy_ops,
+       OPT_judy_size,
+
        OPT_kcmp,
        OPT_kcmp_ops,
 
@@ -2480,6 +2499,9 @@
        OPT_memfd_bytes,
        OPT_memfd_fds,
 
+       OPT_memhotplug,
+       OPT_memhotplug_ops,
+
        OPT_memrate,
        OPT_memrate_ops,
        OPT_memrate_rd_mbs,
@@ -2945,6 +2967,10 @@
        OPT_wcs_ops,
        OPT_wcs_method,
 
+       OPT_x86syscall,
+       OPT_x86syscall_ops,
+       OPT_x86syscall_func,
+
        OPT_xattr,
        OPT_xattr_ops,
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-sendfile.c 
new/stress-ng-0.10.08/stress-sendfile.c
--- old/stress-ng-0.10.07/stress-sendfile.c     2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/stress-sendfile.c     2019-10-21 12:49:31.000000000 
+0200
@@ -98,6 +98,7 @@
 
        do {
                off_t offset = 0;
+
                if (sendfile(fdout, fdin, &offset, sz) < 0) {
                        if (errno == ENOSYS) {
                                pr_inf("%s: skipping stressor, sendfile not 
implemented\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-swap.c 
new/stress-ng-0.10.08/stress-swap.c
--- old/stress-ng-0.10.07/stress-swap.c 2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-swap.c 2019-10-21 12:49:31.000000000 +0200
@@ -193,15 +193,21 @@
                }
                ret = swapon(filename, swapflags);
                if (ret < 0) {
-                       if (errno == EPERM) {
+                       switch (errno) {
+                       case EPERM:
+                       case EINVAL:
                                /*
                                 * We may hit EPERM if we request
                                 * too many swap files
                                 */
+                               pr_inf("%s: cannot enable swap file on the 
filesystem, skipping test\n",
+                                       args->name);
                                ret = EXIT_NO_RESOURCE;
-                       } else {
+                               break;
+                       default:
                                pr_fail_err("swapon");
                                ret = EXIT_FAILURE;
+                               break;
                        }
                        goto tidy_close;
                }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-tree.c 
new/stress-ng-0.10.08/stress-tree.c
--- old/stress-ng-0.10.07/stress-tree.c 2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-tree.c 2019-10-21 12:49:31.000000000 +0200
@@ -148,7 +148,7 @@
 
                find = RB_FIND(stress_rb_tree, &rb_root, node);
                if (!find)
-                       pr_err("%s: rb tree node #%zd node found\n",
+                       pr_err("%s: rb tree node #%zd not found\n",
                                args->name, i);
        }
        for (node = RB_MIN(stress_rb_tree, &rb_root); node; node = next) {
@@ -179,7 +179,7 @@
 
                find = SPLAY_FIND(stress_splay_tree, &splay_root, node);
                if (!find)
-                       pr_err("%s: splay tree node #%zd node found\n",
+                       pr_err("%s: splay tree node #%zd not found\n",
                                args->name, i);
        }
        for (node = SPLAY_MIN(stress_splay_tree, &splay_root); node; node = 
next) {
@@ -243,7 +243,7 @@
 
                find = binary_find(head, node);
                if (!find)
-                       pr_err("%s: binary tree node #%zd node found\n",
+                       pr_err("%s: binary tree node #%zd not found\n",
                                args->name, i);
        }
        binary_remove_tree(head);
@@ -418,7 +418,7 @@
 
                find = avl_find(head, node);
                if (!find)
-                       pr_err("%s: avl tree node #%zd node found\n",
+                       pr_err("%s: avl tree node #%zd not found\n",
                                args->name, i);
        }
        avl_remove_tree(head);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-tsc.c 
new/stress-ng-0.10.08/stress-tsc.c
--- old/stress-ng-0.10.07/stress-tsc.c  2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-tsc.c  2019-10-21 12:49:31.000000000 +0200
@@ -55,7 +55,7 @@
        __cpuid(1, eax, ebx, ecx, edx);
        if (!(edx & 0x10)) {
                pr_inf("tsc stressor will be skipped, CPU "
-                       "does not support the rdtsc instruction\n");
+                       "does not support the tsc instruction\n");
                return -1;
        }
        tsc_supported = true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-urandom.c 
new/stress-ng-0.10.08/stress-urandom.c
--- old/stress-ng-0.10.07/stress-urandom.c      2019-10-01 17:49:32.000000000 
+0200
+++ new/stress-ng-0.10.08/stress-urandom.c      2019-10-21 12:49:31.000000000 
+0200
@@ -94,6 +94,19 @@
                                }
                        }
                }
+
+               /*
+                *  Exerise mmap'ing to /dev/urandom
+                */
+               if (fd_urnd >= 0) {
+                       void *ptr;
+
+                       ptr = mmap(NULL, args->page_size, PROT_READ,
+                               MAP_PRIVATE | MAP_ANONYMOUS, fd_urnd, 0);
+                       if (ptr != MAP_FAILED)
+                               (void)munmap(ptr, args->page_size);
+               }
+
 #if defined(RNDGETENTCNT)
 next:
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-x86syscall.c 
new/stress-ng-0.10.08/stress-x86syscall.c
--- old/stress-ng-0.10.07/stress-x86syscall.c   1970-01-01 01:00:00.000000000 
+0100
+++ new/stress-ng-0.10.08/stress-x86syscall.c   2019-10-21 12:49:31.000000000 
+0200
@@ -0,0 +1,318 @@
+/*
+ * Copyright (C) 2013-2019 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.
+ *
+ */
+#include "stress-ng.h"
+
+static const help_t help[] = {
+       { NULL, "x86syscall N",         "start N workers exercising functions 
using syscall" },
+       { NULL, "x86syscall-ops N",     "stop after N syscall function calls" },
+       { NULL, "x86syscall-func F",    "use just syscall function F" },
+       { NULL, NULL,           NULL }
+};
+
+/*
+ *  stress_set_x86syscall_func()
+ *      set the default x86syscall function
+ */
+static int stress_set_x86syscall_func(const char *name)
+{
+       return set_setting("x86syscall-func", TYPE_ID_STR, name);
+}
+
+static const opt_set_func_t opt_set_funcs[] = {
+       { OPT_x86syscall_func,  stress_set_x86syscall_func },
+       { 0,                    NULL }
+};
+
+#if defined(__linux__) &&      \
+    (defined(__x86_64__) || defined(__x86_64)) && \
+    defined(HAVE_CPUID_H) &&    \
+    defined(HAVE_CPUID) &&      \
+    NEED_GNUC(4,6,0)
+
+typedef void (*func_t)(void);
+
+/*
+ *  syscall symbol mapping name to address and wrapper function
+ */
+typedef struct x86syscall {
+       const func_t func;      /* Wrapper function */
+       const char *name;       /* Function name */
+       bool exercise;          /* True = exercise the syscall */
+} x86syscall_t;
+
+/*
+ *  stress_x86syscall_supported()
+ *     check if tsc is supported
+ */
+static int stress_x86syscall_supported(void)
+{
+       uint32_t eax, ebx, ecx, edx;
+
+       /* Intel CPU? */
+       if (!cpu_is_x86()) {
+               pr_inf("x86syscall stressor will be skipped, "
+                       "not a recognised Intel CPU\n");
+               return -1;
+       }
+       /* ..and supports syscall? */
+       __cpuid(0x80000001, eax, ebx, ecx, edx);
+       if (!(edx & (1ULL << 11))) {
+               pr_inf("x86syscall stressor will be skipped, CPU "
+                       "does not support the syscall instruction\n");
+               return -1;
+       }
+       return 0;
+}
+
+/*
+ *  x86_64_syscall1()
+ *     syscall 1 arg wrapper
+ */
+static inline long x86_64_syscall1(long number, long arg1)
+{
+       long ret;
+       unsigned long _arg1 = arg1;
+       register long __arg1 asm ("rdi") = _arg1;
+
+       asm volatile ("syscall\n\t"
+                       : "=a" (ret)
+                       : "0" (number), "r" (__arg1)
+                       : "memory", "cc", "r11", "cx");
+       if (ret < 0) {
+               errno = ret;
+               ret = -1;
+       }
+       return ret;
+}
+
+/*
+ *  x86_64_syscall2()
+ *     syscall 2 arg wrapper
+ */
+static inline long x86_64_syscall2(long number, long arg1, long arg2)
+{
+       long ret;
+       unsigned long _arg1 = arg1;
+       unsigned long _arg2 = arg2;
+       register long __arg1 asm ("rdi") = _arg1;
+       register long __arg2 asm ("rsi") = _arg2;
+
+       asm volatile ("syscall\n\t"
+                       : "=a" (ret)
+                       : "0" (number), "r" (__arg1), "r" (__arg2)
+                       : "memory", "cc", "r11", "cx");
+       if (ret < 0) {
+               errno = ret;
+               ret = -1;
+       }
+       return ret;
+}
+
+/*
+ *  x86_64_syscall3()
+ *     syscall 3 arg wrapper
+ */
+static inline long x86_64_syscall3(long number, long arg1, long arg2, long 
arg3)
+{
+       long ret;
+       unsigned long _arg1 = arg1;
+       unsigned long _arg2 = arg2;
+       unsigned long _arg3 = arg3;
+       register long __arg1 asm ("rdi") = _arg1;
+       register long __arg2 asm ("rsi") = _arg2;
+       register long __arg3 asm ("rdx") = _arg3;
+
+       asm volatile ("syscall\n\t"
+                       : "=a" (ret)
+                       : "0" (number), "r" (__arg1), "r" (__arg2), "r" (__arg3)
+                       : "memory", "cc", "r11", "cx");
+       if (ret < 0) {
+               errno = ret;
+               ret = -1;
+       }
+       return ret;
+}
+
+/*
+ *  wrap_getcpu()
+ *     invoke getcpu()
+ */
+static void wrap_getcpu(void)
+{
+       unsigned cpu, node;
+
+       (void)x86_64_syscall3(__NR_getcpu, (long)&cpu, (long)&node, (long)NULL);
+}
+
+/*
+ *  wrap_gettimeofday()
+ *     invoke gettimeofday()
+ */
+static void wrap_gettimeofday(void)
+{
+       struct timeval tv;
+
+       (void)x86_64_syscall2(__NR_gettimeofday, (long)&tv, (long)NULL);
+}
+
+/*
+ *  wrap_time()
+ *     invoke time()
+ */
+static void wrap_time(void)
+{
+       time_t t;
+
+       (void)x86_64_syscall1(__NR_time, (long)&t);
+}
+
+/*
+ *  mapping of wrappers to function symbol name
+ */
+static x86syscall_t x86syscalls[] = {
+       { wrap_getcpu,          "getcpu",               true },
+       { wrap_gettimeofday,    "gettimeofday",         true },
+       { wrap_time,            "time",                 true },
+};
+
+/*
+ *  x86syscall_list_str()
+ *     gather symbol names into a string
+ */
+static char *x86syscall_list_str(void)
+{
+       char *str = NULL;
+       size_t i, len = 0;
+
+       for (i = 0; i < SIZEOF_ARRAY(x86syscalls); i++) {
+               if (x86syscalls[i].exercise) {
+                       char *tmp;
+
+                       len += (strlen(x86syscalls[i].name) + 2);
+                       tmp = realloc(str, len);
+                       if (!tmp) {
+                               free(str);
+                               return NULL;
+                       }
+                       if (!str) {
+                               *tmp = '\0';
+                       } else {
+                               (void)strcat(tmp, " ");
+                               str = tmp;
+                       }
+                       (void)strcat(tmp, x86syscalls[i].name);
+                       str = tmp;
+               }
+       }
+       return str;
+}
+
+/*
+ *  x86syscall_check_x86syscall_func()
+ *     if a x86syscall-func has been specified, locate it and
+ *     mark it to be exercised.
+ */
+static int x86syscall_check_x86syscall_func(void)
+{
+       char *name;
+       size_t i;
+       bool exercise = false;
+
+       if (!get_setting("x86syscall-func", &name))
+               return 0;
+
+       for (i = 0; i < SIZEOF_ARRAY(x86syscalls); i++) {
+               const bool match = !strcmp(x86syscalls[i].name, name);
+
+               exercise |= match;
+               x86syscalls[i].exercise = match;
+       }
+
+       if (!exercise) {
+               (void)fprintf(stderr, "invalid x86syscall-func '%s', must be 
one of:", name);
+               for (i = 0; i < SIZEOF_ARRAY(x86syscalls); i++)
+                       (void)fprintf(stderr, " %s", x86syscalls[i].name);
+               (void)fprintf(stderr, "\n");
+               return -1;
+        }
+       return 0;
+}
+
+/*
+ *  stress_x86syscall()
+ *     stress x86 syscall instruction
+ */
+static int stress_x86syscall(const args_t *args)
+{
+       char *str;
+       double t1, t2;
+
+       if (x86syscall_check_x86syscall_func() < 0)
+               return EXIT_FAILURE;
+
+       if (args->instance == 0) {
+               str = x86syscall_list_str();
+               if (str) {
+                       pr_inf("%s: exercising syscall on: %s\n",
+                               args->name, str);
+                       free(str);
+               }
+       }
+
+       t1 = time_now();
+       do {
+               size_t i;
+
+               for (i = 0; i < SIZEOF_ARRAY(x86syscalls); i++) {
+                       if (x86syscalls[i].exercise) {
+                               x86syscalls[i].func();
+                               inc_counter(args);
+                       }
+               }
+       } while (keep_stressing());
+       t2 = time_now();
+
+       pr_inf("%s: %.2f nanoseconds per call\n",
+               args->name,
+               ((t2 - t1) * 1000000000.0) / (double)get_counter(args));
+
+       return EXIT_SUCCESS;
+}
+
+stressor_info_t stress_x86syscall_info = {
+       .stressor = stress_x86syscall,
+       .class = CLASS_OS,
+       .supported = stress_x86syscall_supported,
+       .opt_set_funcs = opt_set_funcs,
+       .help = help
+};
+#else
+stressor_info_t stress_x86syscall_info = {
+       .stressor = stress_not_implemented,
+       .class = CLASS_OS,
+       .opt_set_funcs = opt_set_funcs,
+       .help = help
+};
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/stress-zlib.c 
new/stress-ng-0.10.08/stress-zlib.c
--- old/stress-ng-0.10.07/stress-zlib.c 2019-10-01 17:49:32.000000000 +0200
+++ new/stress-ng-0.10.08/stress-zlib.c 2019-10-21 12:49:31.000000000 +0200
@@ -567,8 +567,16 @@
        register int i;
        static bool use_rand_data = false;
        struct sigaction sigsegv_orig, sigbus_orig;
-       char *text = NULL, *dataptr, *text_start, *text_end;
-       const size_t text_len = stress_text_addr(&text_start, &text_end);
+       char *text, *dataptr;
+       NOCLOBBER char *text_start, *text_end;
+
+       if ((char *)stress_rand_data_bcd < (char *)stress_rand_data_objcode) {
+               text_start = (char *)stress_rand_data_bcd;
+               text_end = (char *)stress_rand_data_objcode;
+       } else {
+               text_start = (char *)stress_rand_data_objcode;
+               text_end = (char *)stress_rand_data_bcd;
+       }
 
        if (use_rand_data) {
                stress_rand_data_binary(args, data, size);
@@ -600,8 +608,7 @@
                return;
        }
 
-       /* Start in random place in stress-ng text segment */
-       text = text_len ? text_start + (mwc64() % text_len) : text_start;
+       text = text_start + (mwc64() % (text_end - text_start));
 
        for (dataptr = (char *)data, i = 0; i < n; i++, dataptr++) {
                *dataptr = *text;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/stress-ng-0.10.07/test/test-judy.c 
new/stress-ng-0.10.08/test/test-judy.c
--- old/stress-ng-0.10.07/test/test-judy.c      1970-01-01 01:00:00.000000000 
+0100
+++ new/stress-ng-0.10.08/test/test-judy.c      2019-10-21 12:49:31.000000000 
+0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2013-2019 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.
+ *
+ */
+
+#include <unistd.h>
+#include <Judy.h>
+
+
+int main(void)
+{
+       Pvoid_t PJLArray = (Pvoid_t)NULL;
+       Word_t *pvalue;
+       Word_t idx = 0;
+       int rc;
+
+       JLI(pvalue, PJLArray, idx);
+       if (pvalue == PJERR) {
+               JLD(rc, PJLArray, idx);
+               return -1;
+       }
+       JLG(pvalue, PJLArray, idx);
+       JLD(rc, PJLArray, idx);
+
+       return 0;
+}


Reply via email to