From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 4A2B56EC40; Wed, 11 Aug 2021 10:46:02 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4A2B56EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1628667962; bh=2NDDgV09W5mreuvrq1Uz1UEZjMPVHgwdRfaZ73QZ2JI=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=TtfAy2eYffsF46CXY7+sH3FxqcM3BiTsTJySCgLAyB1TeTWex+8BEPO3yZyELVyP0 hFkzoO7kyd7dZAf1UdnArS3LuFbL2ierDL5WHkaFVljJZmtnYObh7Zj3nXuphiMQOx UJY5UV8ZjPzTz/206UKrb97uFWlYznXNCvMffl7o= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DD8B36EC40 for ; Wed, 11 Aug 2021 10:45:45 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DD8B36EC40 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mDivo-0001eb-Qq; Wed, 11 Aug 2021 10:45:45 +0300 Date: Wed, 11 Aug 2021 10:22:05 +0300 To: Sergey Kaplun Message-ID: <20210811072205.GM27855@tarantool.org> References: <20210707143606.3499-1-skaplun@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210707143606.3499-1-skaplun@tarantool.org> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-4EC0790: 10 X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9ECFD080E047A606F56291F8739A291D6182A05F5380850407C0AC244BB1C1054EA7581035965AD139D61111A9B116A1E3AAEAD6689879B79 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79A02CDD1178524C2EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637FC0948D7756001208638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8F927CE3C3072BF2EED26EDF200158F29117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6BF3059D42242344A089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5474C6AB44CD59F178974BEE281ACFFF2C928B6F2F0E38B58D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753177526CD55AFC11410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FD9114F69CA58D1E8C128AA0DDBD32592B5B1AFDD78F290105072D215D25682A1A5ED8391F378CAC1D7E09C32AA3244CC1F1B68347B546D2AE09880A6BD4877F435BF7150578642F927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj6qlzQV0oSZPyYRnpySX+QA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D8BBDFEDAC8DAFA2096F65E0C3599A336A7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] ARM64: Fix write barrier in BC_USETS. X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Sergey, I've checked the patch into tarantool branch in tarantool/luajit and bumped a new version in master. On 07.07.21, Sergey Kaplun wrote: > From: Mike Pall > > Contributed by Javier Guerra Giraldez. > > (cherry picked from commit c785131ca5a6d24adc519e5e0bf1b69b671d912f) > > Closed upvalues are never gray. So after closed upvalue is marked, it is > marked as black. Black objects can't refer white objects, so for storing > a white value in closed upvalue, we need to move the barrier forward and > color our value to gray by using `lj_gc_barrieruv()`. This function > can't be called on closed upvalues with non-white values (at least there > is no need to mark it again). > > USETS bytecode for arm64 architecture has the incorrect instruction to > check that upvalue is closed: > | ccmp TMP0w, #0, #0, ne > | beq <1 // branch out from barrier movement > `TMP0w` contains `upvalue->closed` field. If it equals NULL (the first > `#0`). The second zero is the value of NZCV condition flags set if the > condition (`ne`) is FALSE [1][2]. If the set value is not white, then > flags are set to zero and branch is not taken (no Zero flag). If it > happens at propagate or atomic GC State and the `lj_gc_barrieruv()` > function is called then the gray value to set is marked as white. That > leads to the assertion failure in the `gc_mark()` function. > > This patch changes yielded NZCV condition flag to 4 (Zero flag is up) to > take the correct branch after `ccmp` instruction. > > Sergey Kaplun: > * added the description and the test for the problem > > [1]: https://developer.arm.com/documentation/dui0801/g/pge1427897656225 > [2]: https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/condition-codes-1-condition-flags-and-codes > --- > > LuaJIT branch: https://github.com/tarantool/luajit/tree/skaplun/lj-426-incorrect-check-closed-uv > Tarantool branch: https://github.com/tarantool/tarantool/tree/skaplun/lj-426-incorrect-check-closed-uv > > Assertion failure [1] is not related to the patch (I've reproduced it on > master branch). Looks like another one GC64 issue. > > How to reproduce: > 1) Run the following command from the Tarantool repo on Odroid: > | $ i=0; while [[ $? == 0 ]]; do i=$(($i+1)); echo $i; make LuaJIT-tests; done > 2) Wait (need 4-15 iterations). > > [1]: https://github.com/tarantool/tarantool/runs/3009273464#step:4:4013 > > Side note: Thanks to the Lord, that there is no #0 issue and it is not > mentioned that way... > > src/vm_arm64.dasc | 2 +- > ...6-arm64-incorrect-check-closed-uv.test.lua | 38 +++++++++++++++++++ > 2 files changed, 39 insertions(+), 1 deletion(-) > create mode 100644 test/tarantool-tests/lj-426-arm64-incorrect-check-closed-uv.test.lua > > -- > 2.31.0 > -- Best regards, IM