From: Leah Neukirchen <leah@vuxu.org>
To: lixing <lixing@loongson.cn>
Cc: musl@lists.openwall.com
Subject: Re: [musl] loongarch64 atomics not working?
Date: Thu, 14 Mar 2024 14:44:03 +0100 [thread overview]
Message-ID: <87jzm5j5cs.fsf@vuxu.org> (raw)
In-Reply-To: <4ee5d461-a0c2-d70d-ca81-4325d0103516@loongson.cn> (lixing@loongson.cn's message of "Thu, 14 Mar 2024 14:45:29 +0800")
lixing <lixing@loongson.cn> writes:
> we checked the objdump binaries for -Os and -O2, the a_cas_p implement
> looks ok for both.
>
> Also, we cross build the musl and mksh with -Os, the binary hang with
> qemu user mode emulation , but not hang in the real hardware.
>
> so, maybe this is a qemu problem, we will let our qemu guys to check
> this problem.
Pretty surely it's a bug in QEMU. qemu 8.1.5 works with mksh.Os,
qemu 8.2.1 hangs. I have bisected the issue down to:
commit c5af6628f4be5d30800233e59ba3842ca19a12e6 (HEAD)
Author: Jiajie Chen <c@jia.je>
Date: Tue Aug 22 09:13:52 2023 +0200
target/loongarch: Extract make_address_i() helper
Reverting this hunk fixes it:
diff --git a/target/loongarch/insn_trans/trans_atomic.c.inc b/target/loongarch/insn_trans/trans_atomic.c.inc
index fbc081448d..bff3e7a74c 100644
--- a/target/loongarch/insn_trans/trans_atomic.c.inc
+++ b/target/loongarch/insn_trans/trans_atomic.c.inc
@@ -7,8 +7,9 @@ static bool gen_ll(DisasContext *ctx, arg_rr_i *a, MemOp mop)
{
TCGv dest = gpr_dst(ctx, a->rd, EXT_NONE);
TCGv src1 = gpr_src(ctx, a->rj, EXT_NONE);
- TCGv t0 = make_address_i(ctx, src1, a->imm);
+ TCGv t0 = tcg_temp_new();
+ tcg_gen_addi_tl(t0, src1, a->imm);
tcg_gen_qemu_ld_i64(dest, t0, ctx->mem_idx, mop);
tcg_gen_st_tl(t0, cpu_env, offsetof(CPULoongArchState, lladdr));
tcg_gen_st_tl(dest, cpu_env, offsetof(CPULoongArchState, llval));
I think the issue is that make_address_i optimizes the addition away
if a->imm is zero, but that's just from looking at the code for 15min.
hth,
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org/
next prev parent reply other threads:[~2024-03-14 13:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 0:51 Rich Felker
2024-03-12 2:06 ` Hongliang Wang
2024-03-12 8:31 ` lixing
2024-03-12 16:18 ` Waldemar Brodkorb
2024-03-12 16:47 ` Thorsten Glaser
2024-03-12 17:18 ` Waldemar Brodkorb
2024-03-13 1:42 ` lixing
2024-03-13 14:45 ` Waldemar Brodkorb
2024-03-13 14:52 ` Rich Felker
2024-03-14 5:44 ` Waldemar Brodkorb
2024-03-14 6:45 ` lixing
2024-03-14 13:44 ` Leah Neukirchen [this message]
2024-03-15 0:58 ` lixing
2024-03-12 8:48 ` Jingyun Hua
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=87jzm5j5cs.fsf@vuxu.org \
--to=leah@vuxu.org \
--cc=lixing@loongson.cn \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).