linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] MIPS: loongson3-llsc-check: Downgrade failures to notices
@ 2020-02-02 17:00 Wang Xuerui
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Xuerui @ 2020-02-02 17:00 UTC (permalink / raw)
  To: linux-mips; +Cc: Huacai Chen, Wang Xuerui

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-10 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-02 17:00 [PATCH 1/2] MIPS: loongson3-llsc-check: Downgrade failures to notices Wang Xuerui
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

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).