From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, alex.bennee@linaro.org
Subject: [RISU v2 13/17] Split RES_MISMATCH for registers and memory
Date: Mon, 18 May 2020 19:53:51 -0700 [thread overview]
Message-ID: <20200519025355.4420-14-richard.henderson@linaro.org> (raw)
In-Reply-To: <20200519025355.4420-1-richard.henderson@linaro.org>
By remembering the specific comparison that failed, we do not
have to try again when it comes time to report. This makes
the mem_used flag redundant. Also, packet_mismatch is now
redundant with RES_BAD_IO.
This means that the only thing that report_match_status does
is to report on register status, so rename to report_mismatch_reg.
Also, we know there is a failure, so don't return a status from
the report.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
risu.h | 13 ++++++-------
reginfo.c | 45 ++++++++-------------------------------------
risu.c | 10 +++++++---
3 files changed, 21 insertions(+), 47 deletions(-)
diff --git a/risu.h b/risu.h
index 2ded5c4..b234f93 100644
--- a/risu.h
+++ b/risu.h
@@ -54,7 +54,8 @@ typedef enum {
typedef enum {
RES_OK = 0,
RES_END,
- RES_MISMATCH,
+ RES_MISMATCH_REG,
+ RES_MISMATCH_MEM,
RES_BAD_IO,
} RisuResult;
@@ -105,13 +106,11 @@ RisuResult send_register_info(void *uc);
*/
RisuResult recv_and_compare_register_info(void *uc);
-/* Print a useful report on the status of the last comparison
- * done in recv_and_compare_register_info(). This is called on
- * exit, so need not restrict itself to signal-safe functions.
- * Should return 0 if it was a good match (ie end of test)
- * and 1 for a mismatch.
+/*
+ * Print a useful report on the status of the last reg comparison
+ * done in recv_and_compare_register_info().
*/
-int report_match_status(void);
+void report_mismatch_reg(void);
/* Interface provided by CPU-specific code: */
diff --git a/reginfo.c b/reginfo.c
index 31bc699..a007f16 100644
--- a/reginfo.c
+++ b/reginfo.c
@@ -17,9 +17,6 @@
static struct reginfo master_ri, apprentice_ri;
static uint8_t master_memblock[MEMBLOCKLEN];
-static int mem_used;
-static int packet_mismatch;
-
RisuResult send_register_info(void *uc)
{
struct reginfo ri;
@@ -107,10 +104,10 @@ RisuResult recv_and_compare_register_info(void *uc)
*/
res = read_buffer(&master_ri, reginfo_size());
if (res != RES_OK) {
- packet_mismatch = 1;
+ /* fail */
} else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) {
/* register mismatch */
- res = RES_MISMATCH;
+ res = RES_MISMATCH_REG;
} else if (op == OP_TESTEND) {
res = RES_END;
}
@@ -124,13 +121,12 @@ RisuResult recv_and_compare_register_info(void *uc)
(uintptr_t)memblock);
break;
case OP_COMPAREMEM:
- mem_used = 1;
res = read_buffer(master_memblock, MEMBLOCKLEN);
if (res != RES_OK) {
- packet_mismatch = 1;
+ /* fail */
} else if (memcmp(memblock, master_memblock, MEMBLOCKLEN) != 0) {
/* memory mismatch */
- res = RES_MISMATCH;
+ res = RES_MISMATCH_MEM;
}
respond(res == RES_OK ? RES_OK : RES_END);
break;
@@ -141,40 +137,15 @@ RisuResult recv_and_compare_register_info(void *uc)
return res;
}
-/* Print a useful report on the status of the last comparison
- * done in recv_and_compare_register_info(). This is called on
- * exit, so need not restrict itself to signal-safe functions.
- * Should return 0 if it was a good match (ie end of test)
- * and 1 for a mismatch.
+/*
+ * Print a useful report on the status of the last reg comparison
+ * done in recv_and_compare_register_info().
*/
-int report_match_status(void)
+void report_mismatch_reg(void)
{
- int resp = 0;
- fprintf(stderr, "match status...\n");
- if (packet_mismatch) {
- fprintf(stderr, "packet mismatch (probably disagreement "
- "about UNDEF on load/store)\n");
- return 1;
- }
- if (!reginfo_is_eq(&master_ri, &apprentice_ri)) {
- fprintf(stderr, "mismatch on regs!\n");
- resp = 1;
- }
- if (mem_used
- && memcmp(memblock, &master_memblock, MEMBLOCKLEN) != 0) {
- fprintf(stderr, "mismatch on memory!\n");
- resp = 1;
- }
- if (!resp) {
- fprintf(stderr, "match!\n");
- return 0;
- }
-
fprintf(stderr, "master reginfo:\n");
reginfo_dump(&master_ri, stderr);
fprintf(stderr, "apprentice reginfo:\n");
reginfo_dump(&apprentice_ri, stderr);
-
reginfo_dump_mismatch(&master_ri, &apprentice_ri, stderr);
- return resp;
}
diff --git a/risu.c b/risu.c
index ea4b4d3..398faac 100644
--- a/risu.c
+++ b/risu.c
@@ -224,9 +224,13 @@ static int apprentice(void)
case RES_END:
return EXIT_SUCCESS;
- case RES_MISMATCH:
- fprintf(stderr, "mismatch after %zd checkpoints\n", signal_count);
- report_match_status();
+ case RES_MISMATCH_REG:
+ fprintf(stderr, "mismatch reg after %zd checkpoints\n", signal_count);
+ report_mismatch_reg();
+ return EXIT_FAILURE;
+
+ case RES_MISMATCH_MEM:
+ fprintf(stderr, "mismatch mem after %zd checkpoints\n", signal_count);
return EXIT_FAILURE;
case RES_BAD_IO:
--
2.20.1
next prev parent reply other threads:[~2020-05-19 2:59 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 2:53 [RISU v2 00/17] risu cleanups and improvements Richard Henderson
2020-05-19 2:53 ` [RISU v2 01/17] Use bool for tracing variables Richard Henderson
2020-05-19 15:52 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 02/17] Unify master_fd and apprentice_fd to comm_fd Richard Henderson
2020-05-19 15:52 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 03/17] Hoist trace file opening Richard Henderson
2020-05-19 16:50 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 04/17] Adjust tracefile open for write Richard Henderson
2020-05-19 18:24 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 05/17] Use EXIT_FAILURE, EXIT_SUCCESS Richard Henderson
2020-05-19 18:24 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 06/17] Make some risu.c symbols static Richard Henderson
2020-05-19 18:25 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 07/17] Add enum RisuOp Richard Henderson
2020-05-19 18:39 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 08/17] Add enum RisuResult Richard Henderson
2020-05-19 19:06 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 09/17] Unify i/o functions and use RisuResult Richard Henderson
2020-05-20 15:50 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 10/17] Pass non-OK result back through siglongjmp Richard Henderson
2020-05-20 15:52 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 11/17] Always write for --master Richard Henderson
2020-05-20 16:12 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 12/17] Simplify syncing with master Richard Henderson
2020-05-20 16:14 ` Alex Bennée
2020-05-19 2:53 ` Richard Henderson [this message]
2020-05-20 16:25 ` [RISU v2 13/17] Split RES_MISMATCH for registers and memory Alex Bennée
2020-05-19 2:53 ` [RISU v2 14/17] Add magic and size to the trace header Richard Henderson
2020-05-19 21:16 ` Richard Henderson
2020-05-20 16:59 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 15/17] Compute reginfo_size based on the reginfo Richard Henderson
2020-05-20 17:30 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 16/17] aarch64: Reorg sve reginfo to save space Richard Henderson
2020-05-20 18:43 ` Alex Bennée
2020-05-19 2:53 ` [RISU v2 17/17] Add --dump option to inspect trace files Richard Henderson
2020-05-20 17:49 ` Alex Bennée
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=20200519025355.4420-14-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).