Received: (at 70474) by debbugs.gnu.org; 22 Apr 2024 11:23:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 22 07:23:39 2024 Received: from localhost ([127.0.0.1]:45806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ryrlq-0000um-OJ for submit <at> debbugs.gnu.org; Mon, 22 Apr 2024 07:23:39 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:52074 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1ryrln-0000uO-EZ for 70474 <at> debbugs.gnu.org; Mon, 22 Apr 2024 07:23:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713784993; bh=Ck32pH87pFOGYtKIy4+yzqNsU8sjfbEP/jkKxmP0M5U=; h=Date:Subject:From:To:References:In-Reply-To; b=WTgApe6D4PpJSlfeYtP5CPySeL7PsJYdguVxhyysPqY5fpcxNAFlPX1Jpk8hs4qXA AKQan0WaqWhtHvWlgFatLSn3LPBTdq02quvc6/YEiPYNONWe2EP0yrC8If0Vd0fgKW u3B2oN4+8HUK2dDzOZ6Y75g135w7OgFukn06BLqA= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 86AF63FB85 for <70474 <at> debbugs.gnu.org>; Mon, 22 Apr 2024 13:23:13 +0200 (CEST) Message-ID: <976a4750-7006-462f-b158-cf4d6687cad9@HIDDEN> Date: Mon, 22 Apr 2024 13:23:13 +0200 MIME-Version: 1.0 Subject: Re: bug#70474: [PATCH] Move the spin loop target to the LDAXR instruction. From: Tony Garnock-Jones <tonyg@HIDDEN> To: 70474 <at> debbugs.gnu.org References: <825897f1-19fa-4f6a-b459-8db93791d1c3@HIDDEN> <35ead1ce-582e-4378-b894-c9ca1deb8cc2@HIDDEN> Content-Language: en-US In-Reply-To: <35ead1ce-582e-4378-b894-c9ca1deb8cc2@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Andy Wingo in IRC pointed out that the reason the patch appears to work is that the `movr` isn't idempotent! By the time it comes round again, `val` has already been overwritten by LDAXR in the case that `dst == val`. On 22/04/2024 10:18, Tony Garnock-Jones wrote: > Oh man. This little patch all by itself makes the problem behaviour go > away. No switching to SWPAL/CASAL, just tightening the spinloop. (And no > changes at all to the CAS code, so nothing to do with the fibers bug I > guess.) > > With the patch, the spinloop goes LDAXR-STLXR-CBNZ (which is what GCC > does when SWPAL isn't there) instead of potentially MOV-LDAXR-STLXR-CBNZ > (which isn't). > > Could the machine really be so sensitive to the target of the CBNZ? > > --- > libguile/lightening/lightening/aarch64-cpu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libguile/lightening/lightening/aarch64-cpu.c > b/libguile/lightening/lightening/aarch64-cpu.c > index 13aa351e9..4df712a0e 100644 > --- a/libguile/lightening/lightening/aarch64-cpu.c > +++ b/libguile/lightening/lightening/aarch64-cpu.c > @@ -2532,10 +2532,10 @@ str_atomic(jit_state_t *_jit, int32_t loc, > int32_t val) > static void > swap_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t val) > { > - void *retry = jit_address(_jit); > int32_t result = jit_gpr_regno(get_temp_gpr(_jit)); > int32_t val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) > : val; > movr(_jit, val_or_tmp, val); > + void *retry = jit_address(_jit); > LDAXR(_jit, dst, loc); > STLXR(_jit, val_or_tmp, loc, result); > jit_patch_there(_jit, bnei(_jit, result, 0), retry);
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 22 Apr 2024 08:19:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 22 04:19:16 2024 Received: from localhost ([127.0.0.1]:45642 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ryotP-0000i6-8S for submit <at> debbugs.gnu.org; Mon, 22 Apr 2024 04:19:15 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:39476 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1ryotJ-0000ge-7a for 70474 <at> debbugs.gnu.org; Mon, 22 Apr 2024 04:19:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713773927; bh=eqRGAiv3Djr96GNGF8SD8LVx+qk5Jdtgafhsk5njnK0=; h=Date:From:Subject:To; b=LmkVaSMu/lvY9ziesY85NbeboKjoAhCkiOud0cSF1yqpuc7/UGWrYlNQ7w4YVVojO l0nmf6tvmgAzTdxhUyQrESzqHCvYhyL6WjuRGha8t80B+6CfmL8umTdUZkjgGV2eRr /vDJTm9lwZ/TN61wty+U9LJ0+dn6tU0rpe98b690= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 013CD3FB85 for <70474 <at> debbugs.gnu.org>; Mon, 22 Apr 2024 10:18:46 +0200 (CEST) Message-ID: <35ead1ce-582e-4378-b894-c9ca1deb8cc2@HIDDEN> Date: Mon, 22 Apr 2024 10:18:46 +0200 MIME-Version: 1.0 From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: [PATCH] Move the spin loop target to the LDAXR instruction. Content-Language: en-US To: 70474 <at> debbugs.gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Oh man. This little patch all by itself makes the problem behaviour go away. No switching to SWPAL/CASAL, just tightening the spinloop. (And no changes at all to the CAS code, so nothing to do with the fibers bug I guess.) With the patch, the spinloop goes LDAXR-STLXR-CBNZ (which is what GCC does when SWPAL isn't there) instead of potentially MOV-LDAXR-STLXR-CBNZ (which isn't). Could the machine really be so sensitive to the target of the CBNZ? --- libguile/lightening/lightening/aarch64-cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libguile/lightening/lightening/aarch64-cpu.c b/libguile/lightening/lightening/aarch64-cpu.c index 13aa351e9..4df712a0e 100644 --- a/libguile/lightening/lightening/aarch64-cpu.c +++ b/libguile/lightening/lightening/aarch64-cpu.c @@ -2532,10 +2532,10 @@ str_atomic(jit_state_t *_jit, int32_t loc, int32_t val) static void swap_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t val) { - void *retry = jit_address(_jit); int32_t result = jit_gpr_regno(get_temp_gpr(_jit)); int32_t val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) : val; movr(_jit, val_or_tmp, val); + void *retry = jit_address(_jit); LDAXR(_jit, dst, loc); STLXR(_jit, val_or_tmp, loc, result); jit_patch_there(_jit, bnei(_jit, result, 0), retry); -- 2.44.0
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 22 Apr 2024 07:53:14 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Apr 22 03:53:14 2024 Received: from localhost ([127.0.0.1]:45637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ryoUD-0006Il-0I for submit <at> debbugs.gnu.org; Mon, 22 Apr 2024 03:53:14 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:41394 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1ryoU9-0006HK-Ju for 70474 <at> debbugs.gnu.org; Mon, 22 Apr 2024 03:53:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713772367; bh=7MU1dsnc1qNK5XthnQOqkb774yf23sbvNjr1s32zjno=; h=Date:To:From:Subject; b=X1+TDD+yROkRSDEKUgz2xntbwYZHcuEa28qd8Vd1bNJIbTE99UUkmKTyWS0FHAW04 AEPCju8nrFVIWMrHcHcTJnbxyRjx8xrPpwVdY0+boWly4foicD4GS+kooRdVtbOmri GQ3jxgFm9FhxWwp0NJuO4sDtyKxE5l8/wEkn3Y50= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 84ED43FB85 for <70474 <at> debbugs.gnu.org>; Mon, 22 Apr 2024 09:52:47 +0200 (CEST) Content-Type: multipart/mixed; boundary="------------uzzYWvSAmkTVY95d3Hmaf6VX" Message-ID: <be393d49-cf57-4099-a75a-f540bb8c338d@HIDDEN> Date: Mon, 22 Apr 2024 09:52:47 +0200 MIME-Version: 1.0 To: 70474 <at> debbugs.gnu.org Content-Language: en-US From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: Just adding DMB doesn't help X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------uzzYWvSAmkTVY95d3Hmaf6VX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit As an alternative to changing the JIT to produce SWPAL/CASAL, because I wasn't sure if *all* aarch64 targets support these, I tried adding DMB ISH or DMB SY to the end of the generated code sequences. Surprisingly, this did not fix the issue! So there's perhaps something fishy about the LDAXR-STLXR sequences themselves? So for now I'll stick on my own machine with SWPAL/CASAL, since this does seem to work well enough to let both my own code and fibers run. Tony --------------uzzYWvSAmkTVY95d3Hmaf6VX Content-Type: text/plain; charset=UTF-8; name="add-dmb-does-not-help.patch" Content-Disposition: attachment; filename="add-dmb-does-not-help.patch" Content-Transfer-Encoding: base64 ZGlmZiAtLWdpdCBhL2xpYmd1aWxlL2xpZ2h0ZW5pbmcvbGlnaHRlbmluZy9hYXJjaDY0LWNw dS5jIGIvbGliZ3VpbGUvbGlnaHRlbmluZy9saWdodGVuaW5nL2FhcmNoNjQtY3B1LmMKaW5k ZXggMTNhYTM1MWU5Li5iZmY1ODNlMzMgMTAwNjQ0Ci0tLSBhL2xpYmd1aWxlL2xpZ2h0ZW5p bmcvbGlnaHRlbmluZy9hYXJjaDY0LWNwdS5jCisrKyBiL2xpYmd1aWxlL2xpZ2h0ZW5pbmcv bGlnaHRlbmluZy9hYXJjaDY0LWNwdS5jCkBAIC0yMjUsNiArMjI1LDcgQEAgb3h4cnMoaml0 X3N0YXRlX3QgKl9qaXQsIGludDMyX3QgT3AsCiAjZGVmaW5lIEE2NF9TVExSICAgICAgICAg ICAgICAgICAgICAgIDB4Yzg5ZmZjMDAKICNkZWZpbmUgQTY0X0xEQVhSICAgICAgICAgICAg ICAgICAgICAgMHhjODVmZmMwMAogI2RlZmluZSBBNjRfU1RMWFIgICAgICAgICAgICAgICAg ICAgICAweGM4MDBmYzAwCisjZGVmaW5lIEE2NF9ETUIgICAgICAgICAgICAgICAgICAgICAg IDB4ZDUwMzMwYmYKICNkZWZpbmUgQTY0X1NUUkJJICAgICAgICAgICAgICAgICAgICAgMHgz OTAwMDAwMAogI2RlZmluZSBBNjRfTERSQkkgICAgICAgICAgICAgICAgICAgICAweDM5NDAw MDAwCiAjZGVmaW5lIEE2NF9MRFJTQkkgICAgICAgICAgICAgICAgICAgIDB4Mzk4MDAwMDAK QEAgLTY3NSw2ICs2NzYsMzEgQEAgU1RMWFIoaml0X3N0YXRlX3QgKl9qaXQsIGludDMyX3Qg UnQsIGludDMyX3QgUm4sIGludDMyX3QgUm0pCiAgIHJldHVybiBveHh4KF9qaXQsIEE2NF9T VExYUiwgUnQsIFJuLCBSbSk7CiB9CiAKK3N0YXRpYyB2b2lkCitETUIoaml0X3N0YXRlX3Qg Kl9qaXQsIGludDMyX3QgQ1JtKQoreworICB1aW50MzJfdCBpbnN0ID0gQTY0X0RNQjsKKyAg aW5zdCA9IHdyaXRlX3Vuc2lnbmVkX2JpdGZpZWxkKGluc3QsIENSbSwgNCwgOCk7CisgIGVt aXRfdTMyX3dpdGhfcG9vbChfaml0LCBpbnN0KTsKK30KKworc3RhdGljIHZvaWQKK0RNQl9J U0goaml0X3N0YXRlX3QgKl9qaXQpCit7CisgIERNQihfaml0LCAxMSk7CisgIC8vIF4gMTEg PSBJU0gsICJJbm5lciBTaGFyZWFibGUiLiBUaGlzIGlzIHdoYXQgSmF2YSBhcHBhcmVudGx5 IHVzZXMKKyAgLy8gU2VlCisgIC8vICAtIGh0dHBzOi8vZ2lzdC5naXRodWIuY29tL1JhYXNB aHNhbi84ZTM1NTRhNDFlMDcwNjg1MzY0MjVjYTBkZTQ2YzllOAorICAvLyAgLSBodHRwczov L21haWwub3Blbmpkay5vcmcvcGlwZXJtYWlsL2hvdHNwb3QtZGV2LzIwMjEtTWFyY2gvMDQ5 Njk0Lmh0bWwKKyAgLy8gIC0gaHR0cHM6Ly9idWdzLm9wZW5qZGsub3JnL2Jyb3dzZS9KREst ODI2MjUxOQorfQorCitzdGF0aWMgdm9pZAorRE1CX1NZKGppdF9zdGF0ZV90ICpfaml0KQor eworICBETUIoX2ppdCwgMTUpOworfQorCiBzdGF0aWMgdm9pZAogTERSU0Ioaml0X3N0YXRl X3QgKl9qaXQsIGludDMyX3QgUnQsIGludDMyX3QgUm4sIGludDMyX3QgUm0pIAogewpAQCAt MjU0MSw2ICsyNTY3LDcgQEAgc3dhcF9hdG9taWMoaml0X3N0YXRlX3QgKl9qaXQsIGludDMy X3QgZHN0LCBpbnQzMl90IGxvYywgaW50MzJfdCB2YWwpCiAgIGppdF9wYXRjaF90aGVyZShf aml0LCBibmVpKF9qaXQsIHJlc3VsdCwgMCksIHJldHJ5KTsKICAgaWYgKGRzdCA9PSB2YWwp IHVuZ2V0X3RlbXBfZ3ByKF9qaXQpOwogICB1bmdldF90ZW1wX2dwcihfaml0KTsKKyAgRE1C X1NZKF9qaXQpOwogfQogCiBzdGF0aWMgdm9pZApAQCAtMjU2Miw2ICsyNTg5LDcgQEAgY2Fz X2F0b21pYyhqaXRfc3RhdGVfdCAqX2ppdCwgaW50MzJfdCBkc3QsIGludDMyX3QgbG9jLCBp bnQzMl90IGV4cGVjdGVkLAogICBqaXRfcGF0Y2hfaGVyZShfaml0LCBiYWQpOwogICBtb3Zy KF9qaXQsIGRzdCwgZHN0X29yX3RtcCk7CiAgIHVuZ2V0X3RlbXBfZ3ByKF9qaXQpOworICBE TUJfU1koX2ppdCk7CiB9CiAKIHN0YXRpYyB2b2lkCg== --------------uzzYWvSAmkTVY95d3Hmaf6VX--
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 19 Apr 2024 20:49:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 16:49:19 2024 Received: from localhost ([127.0.0.1]:60306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxvAb-0002bi-11 for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 16:49:19 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:46806 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1rxvAY-0002aB-2s for 70474 <at> debbugs.gnu.org; Fri, 19 Apr 2024 16:49:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713559734; bh=5GvdGAiEy6L8uduTPQHO6lj7mWJFAtq4mOkXDAynviM=; h=Date:From:Subject:To; b=AvUrIBeXA5R/WstxMZ8Tb99EqaRDEv7uVau7xCET6u7Sn3jvnh7khJh10HJ7QuVKv /4SgBMANkkOzKwlh+9UsNXE3V3ErIezSNmJhuKEadxzsM3I9vHlqNndbBS8t5mrbKy W+e+4TiIZHaGR+raVszcQ+cFNBo3f1o2Q7r+56aI= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 2F2743F69F for <70474 <at> debbugs.gnu.org>; Fri, 19 Apr 2024 22:48:54 +0200 (CEST) Message-ID: <6cacb4fa-4547-469b-b28c-c621e664e8be@HIDDEN> Date: Fri, 19 Apr 2024 22:48:53 +0200 MIME-Version: 1.0 From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: [PATCH 2/2] Replace aarch64 CAS and atomic-swap generated JIT code with CASAL and SWPAL instructions Content-Language: en-US To: 70474 <at> debbugs.gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This appears to make the problem go away. I'm new at working with `lightening` so I'm not confident I've covered everything that needs covering, particularly wrt the implementation of cas_atomic. But perhaps this can be a foundation for someone who knows more than I do to work from. --- libguile/lightening/lightening/aarch64-cpu.c | 41 ++++++-------------- 1 file changed, 11 insertions(+), 30 deletions(-) diff --git a/libguile/lightening/lightening/aarch64-cpu.c b/libguile/lightening/lightening/aarch64-cpu.c index 13aa351e9..30766652f 100644 --- a/libguile/lightening/lightening/aarch64-cpu.c +++ b/libguile/lightening/lightening/aarch64-cpu.c @@ -223,8 +223,8 @@ oxxrs(jit_state_t *_jit, int32_t Op, #define A64_UMULH 0x9bc07c00 #define A64_LDAR 0xc8dffc00 #define A64_STLR 0xc89ffc00 -#define A64_LDAXR 0xc85ffc00 -#define A64_STLXR 0xc800fc00 +#define A64_SWPAL 0xf8e08000 +#define A64_CASAL 0xc8e0fc00 #define A64_STRBI 0x39000000 #define A64_LDRBI 0x39400000 #define A64_LDRSBI 0x39800000 @@ -664,15 +664,15 @@ STLR(jit_state_t *_jit, int32_t Rt, int32_t Rn) } static void -LDAXR(jit_state_t *_jit, int32_t Rt, int32_t Rn) +SWPAL(jit_state_t *_jit, int32_t Rt, int32_t Rn, int32_t Rs) { - return o_xx(_jit, A64_LDAXR, Rt, Rn); + return oxxx(_jit, A64_SWPAL, Rt, Rn, Rs); } static void -STLXR(jit_state_t *_jit, int32_t Rt, int32_t Rn, int32_t Rm) +CASAL(jit_state_t *_jit, int32_t Rt, int32_t Rn, int32_t Rs) { - return oxxx(_jit, A64_STLXR, Rt, Rn, Rm); + return oxxx(_jit, A64_CASAL, Rt, Rn, Rs); } static void @@ -2532,36 +2532,17 @@ str_atomic(jit_state_t *_jit, int32_t loc, int32_t val) static void swap_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t val) { - void *retry = jit_address(_jit); - int32_t result = jit_gpr_regno(get_temp_gpr(_jit)); - int32_t val_or_tmp = dst == val ? jit_gpr_regno(get_temp_gpr(_jit)) : val; - movr(_jit, val_or_tmp, val); - LDAXR(_jit, dst, loc); - STLXR(_jit, val_or_tmp, loc, result); - jit_patch_there(_jit, bnei(_jit, result, 0), retry); - if (dst == val) unget_temp_gpr(_jit); - unget_temp_gpr(_jit); + SWPAL(_jit, dst, loc, val); } static void cas_atomic(jit_state_t *_jit, int32_t dst, int32_t loc, int32_t expected, int32_t desired) { - int32_t dst_or_tmp; - if (dst == loc || dst == expected || dst == expected) - dst_or_tmp = jit_gpr_regno(get_temp_gpr(_jit)); - else - dst_or_tmp = dst; - void *retry = jit_address(_jit); - LDAXR(_jit, dst_or_tmp, loc); - jit_reloc_t bad = bner(_jit, dst_or_tmp, expected); - int result = jit_gpr_regno(get_temp_gpr(_jit)); - STLXR(_jit, desired, loc, result); - jit_patch_there(_jit, bnei(_jit, result, 0), retry); - unget_temp_gpr(_jit); - jit_patch_here(_jit, bad); - movr(_jit, dst, dst_or_tmp); - unget_temp_gpr(_jit); + if (dst != expected) { + movr(_jit, dst, expected); + } + CASAL(_jit, desired, loc, dst); } static void -- 2.44.0
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 19 Apr 2024 20:47:12 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 16:47:12 2024 Received: from localhost ([127.0.0.1]:60295 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxv8a-0002Iv-H7 for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 16:47:12 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:35892 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1rxv8X-0002HV-B0 for 70474 <at> debbugs.gnu.org; Fri, 19 Apr 2024 16:47:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713559608; bh=/EqZboH04xeZkD1XiBJLH4aun0ZWyW6ot2INBx9RgEY=; h=Date:From:Subject:To; b=hi7mgsgae0Dkf48OfIwWccp/aN1gYVlmrL+mUuixvSS3B1XsUbIwGFh02KQ8Ld0ns xdUIcK9OcFQsqkfYq9veGdmIJgJcdxR4f5HH7wZFsllXFDdqNClFRRsnPhKQKyfd7+ bcaFuca8uGcRTOnrB/qDVK8CwkTw4GtwL9GtGUYY= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id DC2813F69F for <70474 <at> debbugs.gnu.org>; Fri, 19 Apr 2024 22:46:48 +0200 (CEST) Message-ID: <0a3bee59-a20e-492e-9908-5b03ff5833c2@HIDDEN> Date: Fri, 19 Apr 2024 22:46:48 +0200 MIME-Version: 1.0 From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: [PATCH 1/2] Including the cast makes Apple clang 15.0.0 happy; without it, clang is sad Content-Language: en-US To: 70474 <at> debbugs.gnu.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) I'm not sure why, exactly, but I needed this to get builds to work on OSX Sonoma at all. --- libguile/scmsigs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c index 7fd3fd8f1..be96dbd5c 100644 --- a/libguile/scmsigs.c +++ b/libguile/scmsigs.c @@ -302,7 +302,7 @@ scm_i_signals_post_fork () } #if SCM_USE_PTHREAD_THREADS - once = SCM_I_PTHREAD_ONCE_INIT; + once = (scm_i_pthread_once_t) SCM_I_PTHREAD_ONCE_INIT; #endif if (active) scm_i_ensure_signal_delivery_thread (); -- 2.44.0
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 19 Apr 2024 13:36:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 09:36:05 2024 Received: from localhost ([127.0.0.1]:58326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxoPL-00020A-OV for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 09:36:04 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66]:35166 helo=mail.leastfixedpoint.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1rxn8l-0000nE-Kx for 70474 <at> debbugs.gnu.org; Fri, 19 Apr 2024 08:14:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713528871; bh=dtLbz9Dlg68RYMZcoCbEH/mIj0yklq46Npuqi5bCTzY=; h=Date:To:From:Subject; b=pErrpAwZDI5Zc4RaLPWmhdOT8lQDaok+fak/CXTstbRhBz7tc9FAyNc+u9iJKtkyI sb11iWYozWgRoTZs39rQs5Vf1L7RIyxF50UQFvc6jPG00XYNdL1Tf0f7/450lCL+Lx WJbucS7rdPeQ8DH73vmhovV3JeuDRDOvPslAAwhY= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 85C113F69F for <70474 <at> debbugs.gnu.org>; Fri, 19 Apr 2024 14:14:31 +0200 (CEST) Message-ID: <2db23b95-92a0-43be-b9eb-0f14fd543d84@HIDDEN> Date: Fri, 19 Apr 2024 14:14:31 +0200 MIME-Version: 1.0 To: 70474 <at> debbugs.gnu.org Content-Language: en-US From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: Also manifests on an M1 running 14.1.1 and with newer Guile versions Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 70474 X-Mailman-Approved-At: Fri, 19 Apr 2024 09:36:02 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) A small bit of extra information: it's not just one machine; the problem also manifests on an M1 running OSX 14.1.1. In addition, it happens with newer Guile versions including `guile-next` from `aconchillo`'s Homebrew tap and including a version I built from Guile git main just now. Regards, Tony
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at 70474) by debbugs.gnu.org; 19 Apr 2024 13:20:13 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 09:20:13 2024 Received: from localhost ([127.0.0.1]:58278 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxoA0-0008Ub-Tz for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 09:20:13 -0400 Received: from mira.cbaines.net ([212.71.252.8]:43352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <mail@HIDDEN>) id 1rxo9y-0008UV-TD for 70474 <at> debbugs.gnu.org; Fri, 19 Apr 2024 09:20:11 -0400 Received: from localhost (unknown [212.132.255.10]) by mira.cbaines.net (Postfix) with ESMTPSA id 9D33C27BBE9; Fri, 19 Apr 2024 14:19:55 +0100 (BST) Received: from felis (localhost.lan [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 1774406a; Fri, 19 Apr 2024 13:19:55 +0000 (UTC) From: Christopher Baines <mail@HIDDEN> To: Tony Garnock-Jones <tonyg@HIDDEN> Subject: Re: bug#70474: Possible bug with `atomic-box-swap!` on OSX/M3 (?!?!) In-Reply-To: <825897f1-19fa-4f6a-b459-8db93791d1c3@HIDDEN> (Tony Garnock-Jones's message of "Fri, 19 Apr 2024 12:54:32 +0200") References: <825897f1-19fa-4f6a-b459-8db93791d1c3@HIDDEN> User-Agent: mu4e 1.12.2; emacs 29.3 Date: Fri, 19 Apr 2024 14:19:52 +0100 Message-ID: <87o7a54hhj.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 70474 Cc: 70474 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.9 (/) --=-=-= Content-Type: text/plain Tony Garnock-Jones <tonyg@HIDDEN> writes: > I'm seeing some very strange behaviour from `atomic-box-swap!` (but > not `atomic-box-compare-and-swap!`) on Guile 3.0.9 from Homebrew on > OSX Sonoma using an M3 Pro cpu. The issue does not seem to manifest on > x86_64. Could it be some interaction between Guile and M3 CPUs? > > Or am I just doing something very silly that shouldn't work at all and > just happens to look like it works on x86_64? > > Here's the program that fails. It will run for a few hundred million > rounds and then yield "q null in get". Note that using CAS seems to > work, but plain old swap doesn't. There are known issue(s) with Guile JIT and atomics on ARM (e.g. [1]). If the problem doesn't appear when disabling JIT, then you're probably seeing the same issue. 1: https://github.com/wingo/fibers/issues/83 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmYib3hfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XdcGA//Qv+7hdmyETA6quu0eSzC5hr+q0Me//xp 3E0sYsZIp4Vm6q4qsNdTpOv+2BzcM+UsqRPQa/BCwCcfQGNXlVOEkCkO//QmbjW1 hCwFuKJq/3LKwvqYu1r5+tqYUYnNvfwzbhf7z63SXqww3SeR1rjGsjIG0tTLUzOl PNy9eseYVMGQzKgqV7kG8B14eyYMawHnFcTk+PBrM9ctX0esfvDYFrTcz50TIXVK 50Djlq6oDNpzd5pxiJxK1FgSpmcNrWnoNcmAHSSsLHzabAMpzIFQ7x5SV1la7+k+ YygFfCe4/pDQJ6VwJfJmPn3K+MAF1oB/zrGnRYIg4M+b0rr+1NK0vFRQiTeFaywL 4EjNI+zeREVWdl/sgXoHZtzpXRuZnhYjy3pq/xMLkrOIJy4qwXbTqzB3nu4d4/2Y jJvYd7lT+cMqrEYLZqQ19yoHADSr9OCswQq8MAMqMqt1SIk/AS4cKD6LWDmoHrXM qWi7/3zg0GYhbyHi6lT9rHR9BXtz4czE2rCUP6MrhtXec3qdEXki1xRt6H1Aju6u 4enJcd0pCMPYCWRp3ZktvkWGx0QllF7w3RODOfAXgWU0c8H5Xll25skkCdn2O2r7 E0G69s7++rtMYGzxXsQ3owHi1rOVE05fvPoflj7Nv35eBFupbTNnh7YqfYg2A5+f jcXRZxREh+s= =OPiV -----END PGP SIGNATURE----- --=-=-=--
bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.Received: (at submit) by debbugs.gnu.org; 19 Apr 2024 12:10:30 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 08:10:30 2024 Received: from localhost ([127.0.0.1]:58223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rxn4W-0000Hl-Tp for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 08:10:30 -0400 Received: from lists.gnu.org ([2001:470:142::17]:50742) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <tonyg@HIDDEN>) id 1rxltg-00056Z-MT for submit <at> debbugs.gnu.org; Fri, 19 Apr 2024 06:55:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <tonyg@HIDDEN>) id 1rxltI-0007GH-B9 for bug-guile@HIDDEN; Fri, 19 Apr 2024 06:54:48 -0400 Received: from smoke.leastfixedpoint.com ([81.4.107.66] helo=mail.leastfixedpoint.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <tonyg@HIDDEN>) id 1rxltF-0006cc-1Z for bug-guile@HIDDEN; Fri, 19 Apr 2024 06:54:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leastfixedpoint.com; s=default; t=1713524073; bh=eRHgaV+xDi31xqWcrPubRTb2thhX/WE0VWITiQ0eVO8=; h=Date:To:From:Subject; b=o8oHNkVVz7W7Fwz8X6f+jVusWEq44douA+NDn5QR60WrxxGHip08HpDes+e2dKayF faE43w+AuYnwp0c4i7QBnTKVNUW1XXmz4kHc3NGcZJZvrFDimGAdA/5jKrSrJ3rD9I VVj6MDl8g1MPlGLSVtoLWjBu2hDMzCXipBxGqjgU= Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.leastfixedpoint.com (Postfix) with ESMTPSA id 61CE03F9CE for <bug-guile@HIDDEN>; Fri, 19 Apr 2024 12:54:33 +0200 (CEST) Message-ID: <825897f1-19fa-4f6a-b459-8db93791d1c3@HIDDEN> Date: Fri, 19 Apr 2024 12:54:32 +0200 MIME-Version: 1.0 Content-Language: en-US To: bug-guile@HIDDEN From: Tony Garnock-Jones <tonyg@HIDDEN> Subject: Possible bug with `atomic-box-swap!` on OSX/M3 (?!?!) Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=81.4.107.66; envelope-from=tonyg@HIDDEN; helo=mail.leastfixedpoint.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PLING_QUERY=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 19 Apr 2024 08:10:28 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.0 (/) Hello all, I'm seeing some very strange behaviour from `atomic-box-swap!` (but not `atomic-box-compare-and-swap!`) on Guile 3.0.9 from Homebrew on OSX Sonoma using an M3 Pro cpu. The issue does not seem to manifest on x86_64. Could it be some interaction between Guile and M3 CPUs? Or am I just doing something very silly that shouldn't work at all and just happens to look like it works on x86_64? Here's the program that fails. It will run for a few hundred million rounds and then yield "q null in get". Note that using CAS seems to work, but plain old swap doesn't. ;;-- ;; Eventually this fails with "q null in get" if `atomic-box-swap!` is ;; used where marked (*) below. It takes usually between hundreds of ;; millions and a few billion increments to fail. ;; ;; It does NOT fail if the line marked (*) is commented out and the line ;; below it mentioning `atomic-box-compare-and-swap!` is uncommented and ;; used instead. ;; ;; The failure happens on OSX Sonoma 14.4.1 on a MacBook Pro running an ;; M3 Pro CPU using Guile version 3.0.9 from Homebrew as of 2024-04-17. ;; ;; It does NOT happen on AMD x86_64 Debian linux with Guile 3.0.9 from ;; Debian packaging. (use-modules (ice-9 atomic)) (define r (make-atomic-box '(0))) (let loop () (let ((v (let ((q (atomic-box-ref r))) (when (null? q) (error "q null in get")) (unless (eq? (atomic-box-compare-and-swap! r q (cdr q)) q) (error "CAS failed in get")) (car q)))) (when (zero? (remainder v 10000000)) (write v) (newline)) (unless (null? (atomic-box-swap! r (list (+ v 1))) ;; (*) ;; (atomic-box-compare-and-swap! r '() (list (+ v 1))) ) (error "swap failed in put")) (loop)))
Tony Garnock-Jones <tonyg@HIDDEN>
:bug-guile@HIDDEN
.
Full text available.bug-guile@HIDDEN
:bug#70474
; Package guile
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.