From: Wang Xuerui <git@xen0n.name>
To: linux-mips@vger.kernel.org
Cc: Huacai Chen <chenhc@lemote.com>, Wang Xuerui <git@xen0n.name>
Subject: [PATCH 1/2] MIPS: loongson3-llsc-check: Downgrade failures to notices
Date: Mon, 3 Feb 2020 01:00:51 +0800 [thread overview]
Message-ID: <20200202170052.14012-1-git@xen0n.name> (raw)
From: Huacai Chen <chenhc@lemote.com>
Local ops (and other similar cases) don't need SYNCs before LL/SC
because there is only one writer, so don't always fail on missing SYNCs.
Print a notice instead.
[git@xen0n.name: Massaged commit message and symbol naming.]
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Wang Xuerui <git@xen0n.name>
---
arch/mips/tools/loongson3-llsc-check.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/mips/tools/loongson3-llsc-check.c b/arch/mips/tools/loongson3-llsc-check.c
index 0ebddd0ae46f..c485950b7a36 100644
--- a/arch/mips/tools/loongson3-llsc-check.c
+++ b/arch/mips/tools/loongson3-llsc-check.c
@@ -138,6 +138,12 @@ static bool is_branch(uint32_t insn, int *off)
}
}
+#define REPORT_OK 0x0
+#define REPORT_LL 0x1
+#define REPORT_BRANCH_TARGET 0x2
+
+static int err_report = REPORT_OK;
+
static int check_ll(uint64_t pc, uint32_t *code, size_t sz)
{
ssize_t i, max, sc_pos;
@@ -149,8 +155,8 @@ static int check_ll(uint64_t pc, uint32_t *code, size_t sz)
* execute after the LL & cause erroneous results.
*/
if (!is_sync(le32toh(code[-1]))) {
+ err_report |= REPORT_LL;
fprintf(stderr, "%" PRIx64 ": LL not preceded by sync\n", pc);
- return -EINVAL;
}
/* Find the matching SC instruction */
@@ -185,9 +191,9 @@ static int check_ll(uint64_t pc, uint32_t *code, size_t sz)
continue;
/* ...but if not, we have a problem */
+ err_report |= REPORT_BRANCH_TARGET;
fprintf(stderr, "%" PRIx64 ": Branch target not a sync\n",
pc + (i * 4));
- return -EINVAL;
}
return 0;
@@ -297,6 +303,13 @@ int main(int argc, char *argv[])
goto out_munmap;
}
+ if (err_report & REPORT_LL)
+ fprintf(stderr, "Notice: there are LLs not preceded by"
+ " syncs, please confirm manually.\n");
+ if (err_report & REPORT_BRANCH_TARGET)
+ fprintf(stderr, "Notice: there are branches within LL/SC blocks"
+ " not targeting syncs, please confirm manually.\n");
+
status = EXIT_SUCCESS;
out_munmap:
munmap(vmlinux, st.st_size);
--
2.21.0
next reply other threads:[~2020-02-03 3:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-02 17:00 Wang Xuerui [this message]
2020-02-02 17:00 ` [PATCH 2/2] Revert "MIPS: asm: local: add barriers for Loongson" Wang Xuerui
2020-02-10 19:24 ` [PATCH 1/2] MIPS: loongson3-llsc-check: Downgrade failures to notices Paul Burton
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=20200202170052.14012-1-git@xen0n.name \
--to=git@xen0n.name \
--cc=chenhc@lemote.com \
--cc=linux-mips@vger.kernel.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