From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Richard Henderson <richard.henderson@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH v2 2/3] tests/tcg/multiarch: Improve mutator randomness
Date: Mon, 6 Jul 2026 18:51:24 +0200 [thread overview]
Message-ID: <20260706165445.57418-3-iii@linux.ibm.com> (raw)
In-Reply-To: <20260706165445.57418-1-iii@linux.ibm.com>
Currently mutators perform the same actions, because the RNG seed is
derived from the current time in seconds. Mix in thread ID.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tests/tcg/multiarch/vma-pthread.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/tcg/multiarch/vma-pthread.c b/tests/tcg/multiarch/vma-pthread.c
index 7045da08fc4..0b8ce9751be 100644
--- a/tests/tcg/multiarch/vma-pthread.c
+++ b/tests/tcg/multiarch/vma-pthread.c
@@ -11,6 +11,7 @@
* pages, which are guaranteed to have the respective protection bit set.
* Two mutator threads change the non-fixed protection bits randomly.
*/
+#define _GNU_SOURCE
#include <assert.h>
#include <fcntl.h>
#include <pthread.h>
@@ -121,7 +122,7 @@ static void *thread_mutate(void *arg)
unsigned int seed;
int prot, ret;
- seed = (unsigned int)time(NULL);
+ seed = (unsigned int)time(NULL) + (unsigned int)gettid();
for (i = 0; i < 10000; i++) {
start_idx = rand_r(&seed) & PAGE_IDX_MASK;
end_idx = rand_r(&seed) & PAGE_IDX_MASK;
--
2.54.0
next prev parent reply other threads:[~2026-07-06 16:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 16:51 [PATCH v2 0/3] accel/tcg: Make PageFlagsNodes' start and last immutable Ilya Leoshkevich
2026-07-06 16:51 ` [PATCH v2 1/3] " Ilya Leoshkevich
2026-07-06 16:58 ` Ilya Leoshkevich
2026-07-07 17:54 ` Pierrick Bouvier
2026-07-06 16:51 ` Ilya Leoshkevich [this message]
2026-07-07 17:51 ` [PATCH v2 2/3] tests/tcg/multiarch: Improve mutator randomness Pierrick Bouvier
2026-07-06 16:51 ` [PATCH v2 3/3] Revert "tests/tcg: skip the vma-pthread test on CI" Ilya Leoshkevich
2026-07-07 17:50 ` Pierrick Bouvier
2026-07-07 17:31 ` [PATCH v2 0/3] accel/tcg: Make PageFlagsNodes' start and last immutable Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260706165445.57418-3-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.