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 20C175B1634; Wed, 16 Aug 2023 15:44:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 20C175B1634 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1692189893; bh=ymB2TMcnMROJ3e27ZD3P/fU9L3OiuWga1P6NTu9oFEU=; 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=PzYTP2gOCmxYp74R4MztCSH3jLwn0Hnc6NuFppXBJgiTaXiPQDUoGpYYrfxOTPVTP /+5BGMlulGlJnr6DS6AkRDy6jHI3VhvclBqgiRGPW/GiIz05qz81kfD3Og6jHvu1J8 LVIydYYpIXmU40dsdPJ1WUVQ7t1rfI1whOl+/gVg= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (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 6130654EB90 for ; Wed, 16 Aug 2023 15:44:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6130654EB90 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1qWFtK-0001e3-A5; Wed, 16 Aug 2023 15:44:50 +0300 Date: Wed, 16 Aug 2023 15:40:03 +0300 To: Maxim Kokryashkin Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9700E0DCE2907754D4FC677755C812E332EA741D6A7864909182A05F538085040044529DF8854F18E9B321D6AAC2E79CF42A8679E62AB4FFE24DB7171D5CDCD34 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE745C0EDBD94D46193EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006374FA524FBD8B89EAA8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D83033B0BE028B4D4051FFF1A0FD92816A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCC2ED6D5310B1F811A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269176DF2183F8FC7C0D75EB778CE7D8A0C68655334FD4449CB33AC447995A7AD18CE5475246E174218D5E8D9A59859A8B666D37212B2E9A769089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A5D8AEAD07A0F12D8D462C7AB3E0B5ADBAF35FE6A44186B444F87CCE6106E1FC07E67D4AC08A07B9B0A6C7FFFE744CA7FBCB5012B2E24CD356 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D3441661D6226BE8C314240274E3196D069729A380DA9A8CAC889C52F575943ADB9179458C8A7C71F311D7E09C32AA3244C9452AE478F57C266FCA26E20D5C295B305AB220A9D022EBCBAD658CF5C8AB4025DA084F8E80FEBD3202CD0F03380D9577A83BD0C44CE203720ABEDE4BBDD9CDD X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojHVl7ekwB6hgGMX7hIIPaGQ== X-DA7885C5: 2C08D155152032B006534FD90F51B86D9723C12FC2B3FA5DE19C34F9CC66C32F262E2D401490A4A0DB037EFA58388B346E8BC1A9835FDE71 X-Mailru-Sender: 689FA8AB762F73930F533AC2B33E986B62A728B3DCA8A99A98BCF2D222078B950FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 01/19] MIPS: Use precise search for exit jump patching. 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the review! On 15.08.23, Maxim Kokryashkin wrote: > Hi, Sergey! > LGTM, except for a few comments below. > > On Wed, Aug 09, 2023 at 06:35:50PM +0300, Sergey Kaplun via Tarantool-patches wrote: > > From: Mike Pall > > > > Contributed by Djordje Kovacevic and Stefan Pejic. > > > > (cherry-picked from commit 7381b620358c2561e8690149f1d25828fdad6675) > > > > Without the aforementioned checks, some non-branch instructions may be > > interpreted as some branch due to memory address collisions. This patch > Please add a more comprehensive description of behavior before the patch. > Because of magic values it is not obvious that the difference between the > current PC and the jump address is XORed with the opcode, to make sure > that this is a branching instruction. Added. The new commit message is the following: | MIPS: Use precise search for exit jump patching. | | Contributed by Djordje Kovacevic and Stefan Pejic. | | (cherry-picked from commit 7381b620358c2561e8690149f1d25828fdad6675) | | The branch instruction contains PC-relative mcode address in the lowest | 4 bytes. To ensure that it is branch instruction we check that | difference of the address of the current instruction and jump target is | contained in the lowest 4 bytes of the instruction. But there is no | check that opcode of this instruction is branch opcode. Without the | aforementioned checks, some non-branch instructions may be interpreted | as branches due to memory address collisions. This patch adds the | corresponding mask values for comparisons with instruction opcodes used | in the LuaJIT: | * `MIPSI_BEQ` for `beq` and `bne`, | * `MIPSI_BLTZ` for `bltz`, `blez`, `bgtz` and `bgez`, | * `MIPSI_BC1F` for `bc1f` and `bc1t`, | see and MIPS Instruction Set Manual [1] for | details. | | To reproduce this failure, we need specific memory mapping, so the test | case is omitted. | | Since MIPS architecture is not supported by Tarantool (at the moment) | this patch is not necessary for backport. OTOH, it gives us the | following benefits: | * Be in sync with the LuaJIT upstream not only for x86_64, arm64 | architectures. | * Avoid conflicts during future backporting. | So, it's more useful to backport some of the patches to avoid conflicts | with the future patch series. | | [1]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf | | Sergey Kaplun: | * added the description for the problem | | Part of tarantool/tarantool#8825 > > Typo: s/some branch/branches/ Fixed. > > adds the corresponding comparisons masked values with instruction > Typo: s/comparisons masked values/mask values for comparisons/ Fixed. > > opcodes used in the LuaJIT: > > * `MIPSI_BEQ` for `beq` and `bne`, > > * `MIPSI_BLTZ` for `bltz`, `blez`, `bgtz` and `bgez`, > > * `MIPSI_BC1F` for `bc1f` and `bc1t`, > > see and MIPS Instruction Set Manual [1] for > > details. > > > > To reproduce this failure, we need specific memory mapping, so testcase > Typo: s/testcase/the test case/ Fixed. > > is omitted. > > > > Since MIPS architecture is not supported by Tarantool (at the moment) > > this patch is not necessary for backport. OTOH, it gives to us the > Typo: s/gives to us/gives us/ Fixed. > > following benefits: > > * Be in sync with the LuaJIT upstream not only for x86_64, arm64 > > architectures. > > * Avoid conflicts during the future backporting. > Typo: s/during the future/during future/ Fixed. > > So, it's more useful to backport some of the patches to avoid conflicts > > > Best regards, > Maxim Kokryashkin -- Best regards, Sergey Kaplun