From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 6A75F26255 for ; Thu, 14 Mar 2024 14:44:20 +0100 (CET) Received: (qmail 12056 invoked by uid 550); 14 Mar 2024 13:40:02 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 12021 invoked from network); 14 Mar 2024 13:40:02 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710423847; x=1711028647; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FDp5hDAfGub5mHLY+qb1Qkr883KZgaSLxEV94ONMwAs=; b=CJm4K7BR4IiT/5SmYuGlNTtVPwGj+Xhatabvib7VGK16F2CBvi9fS3TTVRoeo1Wmkg grtDNegJ4hUE+mxfOAwo2E/AapV84qTF+e8ZBs96oPxFzVpM+r6Piomnm7Ue2AOC78Rp FD+ot20YcGjyHlgFrE5/YoL0AZO91eQpxamG8IM2KUv5EYlowmxxXJqxpkk07M1LSq0d nckA6kYAviGCyRQSl3ojvMv9Yd8fNcXVhXkW12d+meqlL1S/izdv/ikeyMQ1vw9Mv3xG QKaTc+/S6wFZNN1zeLpby0UYvWOn0ukvuILRhECtQQzvNcbwdC113h/5slfUyQ3oMM4V YYwA== X-Gm-Message-State: AOJu0YyRi8cPMcgxLoP9ZHa+ust0gsiUwqW0OC1Z0cdwun4GIFvvGkLi UJRiibJg7IaUOp6SgojdHtWDfmp7vhuVoF+Ki0D0J54BFQFQX+rMDSN1d9vN X-Google-Smtp-Source: AGHT+IFqYGARgFtdCeAmC29t+eKi4h2KsXqfd8ctptinuhYF7AO34C3YPtHU9Mc+a8VAbu0GMMLsjQ== X-Received: by 2002:a05:6402:1cc8:b0:568:2fd3:6139 with SMTP id ds8-20020a0564021cc800b005682fd36139mr643330edb.38.1710423846733; Thu, 14 Mar 2024 06:44:06 -0700 (PDT) From: Leah Neukirchen To: lixing Cc: musl@lists.openwall.com In-Reply-To: <4ee5d461-a0c2-d70d-ca81-4325d0103516@loongson.cn> (lixing@loongson.cn's message of "Thu, 14 Mar 2024 14:45:29 +0800") References: <20240312005150.GB4163@brightrain.aerifal.cx> <4f5abddd-09f9-f05f-6cc6-719fc365b449@loongson.cn> <20240313145215.GF4163@brightrain.aerifal.cx> <4ee5d461-a0c2-d70d-ca81-4325d0103516@loongson.cn> Date: Thu, 14 Mar 2024 14:44:03 +0100 Message-ID: <87jzm5j5cs.fsf@vuxu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [musl] loongarch64 atomics not working? lixing 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 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 https://leahneukirchen.org/