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 90E539D89EB; Wed, 6 Mar 2024 21:16:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 90E539D89EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1709749004; bh=iEROtd8DIrzFZwA4g1ab+LTrAVDBWZvseEaGPTY/L60=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=In4NcOjO9V9kFmcjLuZx/c7PWAlJCUL0GXTT/qhKdgS5HqWqAsg12F43jdS8fydQh ZVo2CU2tkPeD7pdABJC+lUm70QVoImIKPAXFTIO+sf9SIN4qQvsptUo4WB5gyk+NHB /NurvsJQwDJ4eFeo4op4f/HeWSvxYsKSr1aYPfLE= Received: from smtp32.i.mail.ru (smtp32.i.mail.ru [95.163.41.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 060B49D89C1 for ; Wed, 6 Mar 2024 21:16:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 060B49D89C1 Received: by smtp32.i.mail.ru with esmtpa (envelope-from ) id 1rhvoo-000000032G5-1HVv; Wed, 06 Mar 2024 21:16:42 +0300 Date: Wed, 6 Mar 2024 21:16:41 +0300 To: Sergey Kaplun Cc: Maxim Kokryashkin , tarantool-patches@dev.tarantool.org Message-ID: References: <20240301132127.136533-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD987C0EE6E7F0A597D8D64E6F18B2E2E3258EF6A9BB0633F3C182A05F53808504046189378E70C55B3A6D5EE0DB6E1EC8D7C28C419CE05561286A3D6B4135AE094E85E5E11D6F148DD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE766DBE83FD69AB645EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637835928C62272F24E8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D88A409F483D522D252DD2B94A227825EE2712C6E5D7A2FFC0CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F3E38EE449E3E2AE389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8D2DCF9CF1F528DBCF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C457EE4B4996FC54603F1AB874ED890284AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C3CD582FA7F3E0DDE5BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF17B107DEF921CE791DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3C74813BC7F81EC8435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A5FEB3BBC53F362E545002B1117B3ED6968DCC784EDD319DB2CA7E60A991436CA2823CB91A9FED034534781492E4B8EEAD8D8BB953E4894305BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CFF01A40D87C8A5B25CEFB9729A2D3FC79F3B4F6146F2898C7B7227214C958DC4EE98901B1639BBD63A2A143A52978B9DD161251486035096800F23590E96C8E59FEC763BCE2D391295F4332CA8FE04980913E6812662D5F2A54F6898A6FDCBDC72A617DFBE5FEC2C6383653B6C8D9AE0FD16FCAA6493B703A X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj9auBsoWJeY+1UvPzWHdz9g== X-Mailru-Sender: 7940E2A4EB16C9976F80DCDCD59EC227D90DA69E9A6CCB43A6D5EE0DB6E1EC8D7C28C419CE055612E2527C969975515CFF9FCECFB8D89CB6C77752E0C033A69E235A20A81F3B0E39AB3C5F247CB2F7F93A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit v2] Throw any errors before stack changes in trace stitching. 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: Maxim Kokryashkin via Tarantool-patches Reply-To: Maxim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the review! Here is the new commit message: === Throw any errors before stack changes in trace stitching. Thanks to doujiang24. (cherry-picked from commit 3f9389edc6cdf3f78a6896d550c236860aed62b2) The Lua stack is changed in the `recff_stitch`, so if the trace is aborted, for example, when the `maxsnap` is reached, and an error is thrown from there, the execution continues with an unbalanced stack. This patch adds a check for snapshot overflow to the `recff_stitch` to overcome the issue for the `LJ_TRERR_SNAPOV` case, but other cases remain unresolved and should be fixed in other series. For a detailed description of the remaining cases, see the issue LJ#1166. Maxim Kokryashkin: * added the description and the test for the problem Part of tarantool/tarantool#9595 === And here is the diff with changes: === diff --git a/test/tarantool-tests/lj-720-errors-before-stitch.test.lua b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua index 00fb0b9b..a2c6eef2 100644 --- a/test/tarantool-tests/lj-720-errors-before-stitch.test.lua +++ b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua @@ -5,6 +5,7 @@ local test = tap.test('lj-720-errors-before-stitch'):skipcond({ test:plan(1) -- `math.modf` recording is NYI. +-- Local `modf` simplifies jdump output. local modf = math.modf jit.opt.start('hotloop=1', 'maxsnap=1') === Branch is force-pushed. On Mon, Mar 04, 2024 at 05:13:58PM +0300, Sergey Kaplun via Tarantool-patches wrote: > Hi, Maxim! > Thanks for the fixes! > LGTM, after fixing the comments below. > > On 01.03.24, Maxim Kokryashkin wrote: > > From: Mike Pall > > > > Thanks to doujiang24. > > > > (cherry-picked from commit 3f9389edc6cdf3f78a6896d550c236860aed62b2) > > > > The Lua stack is changed in the `recff_stitch`, so if the trace > > is aborted, for example, when the `maxsnap` is reached, and an > > error is thrown from there, the execution continues with an > > unbalanced stack. > > > > This patch adds a check for snapshot overflow to the > > `recff_stitch` to overcome the issue for the `LJ_TRERR_SNAPOV` > > case, but other cases remain unresolved and should be fixed in > > other series. For a detailed description of the remaining cases, > > see the issue[1]. > > > > [1]: https://github.com/LuaJIT/LuaJIT/issues/1166 > > I suppose it is better to drop the link (or just mention it in the test) > to avoid excess notification in the upstream repository. > > > > > Maxim Kokryashkin: > > * added the description and the test for the problem > > > > Part of tarantool/tarantool#9595 > > --- > > Changes in v2: > > - Fixed comments as per review by Sergey Kaplun > > > > Branch: https://github.com/tarantool/luajit/tree/fckxorg/lj-720-errors-before-stitch > > > > src/lj_ffrecord.c | 4 ++++ > > .../lj-720-errors-before-stitch.test.lua | 20 +++++++++++++++++++ > > 2 files changed, 24 insertions(+) > > create mode 100644 test/tarantool-tests/lj-720-errors-before-stitch.test.lua > > > > diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c > > index 1b2ddb72..e3ed80fb 100644 > > --- a/src/lj_ffrecord.c > > +++ b/src/lj_ffrecord.c > > > > > diff --git a/test/tarantool-tests/lj-720-errors-before-stitch.test.lua b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua > > new file mode 100644 > > index 00000000..00fb0b9b > > --- /dev/null > > +++ b/test/tarantool-tests/lj-720-errors-before-stitch.test.lua > > @@ -0,0 +1,20 @@ > > +local tap = require('tap') > > +local test = tap.test('lj-720-errors-before-stitch'):skipcond({ > > + ['Test requires JIT enabled'] = not jit.status(), > > +}) > > +test:plan(1) > > + > > +-- `math.modf` recording is NYI. > > +local modf = math.modf > > Why do we need to the use local value here? > > > +jit.opt.start('hotloop=1', 'maxsnap=1') > > + > > +-- The loop has only two iterations: the first to detect its > > +-- hotness and the second to record it. The snapshot limit is > > +-- set to one and is certainly reached. > > +for _ = 1, 2 do > > + -- Forcify stitch. > > + modf(1.2) > > +end > > + > > +test:ok(true, 'stack is balanced') > > +test:done(true) > > -- > > 2.43.0 > > > > -- > Best regards, > Sergey Kaplun