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 272F0733EF1; Fri, 7 Feb 2025 15:57:29 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 272F0733EF1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1738933049; bh=TGlVcXuwSSMK3RPfE/XEI2I2DgjLF5X0nHlcQOSkLUg=; 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=eAkznE5S3tTr5VTKSjYa0f78tLk6xgetHrIvunDb1UHVivbq7E9hysPkCGl6lqs7J kRwiZ8HBVTaWXeQJdNrNeAEFRuSNygYHgKPs5LKwT2bBVhVbGENk8koND8pq3EB1xN dQN7RYOCrL2/1oB/uY7usQ/zbpY/iW88thFLm5C8= Received: from send242.i.mail.ru (send242.i.mail.ru [95.163.59.81]) (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 3D200733EF1 for ; Fri, 7 Feb 2025 15:57:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3D200733EF1 Received: by exim-smtp-5c664d6544-kdxrl with esmtpa (envelope-from ) id 1tgNvC-00000000IW7-0oNP; Fri, 07 Feb 2025 15:57:26 +0300 Content-Type: multipart/alternative; boundary="------------7mR3MUPws5LnVyhhCNa0tI7Z" Message-ID: <52258e70-bdc4-4718-9fdf-d326aa1e0a8f@tarantool.org> Date: Fri, 7 Feb 2025 15:57:25 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: Content-Language: en-US In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD980EDB4062763125EF12BC0850CD4868D8D6D180C49CB07F600894C459B0CD1B945FA08BF0F6E8C50C7D0F6C13AE992132D466438D455D72F1C6D0FF4F6D144BB21323E01452AE1F2 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE76D9A64DA33E5B915EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372521E7C1CE72986C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8149E5E596CEDB705F3737DB1F7C0E07A24FC687D9FBA0903CC7F00164DA146DAFE8445B8C89999728AA50765F7900637DCE3DBD6F8E38AFD389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC8A9FF340AA05FB58CF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C2D01283D1ACF37BAC0837EA9F3D197644AD6D5ED66289B523666184CF4C3C14F6136E347CC761E07725E5C173C3A84C36E36DCD5FF651F90BA3038C0950A5D36B5C8C57E37DE458B330BD67F2E7D9AF16D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE74F0F518E68DBD4F843847C11F186F3C59DAA53EE0834AAEE X-C1DE0DAB: 0D63561A33F958A52D7D9970CACE13DF5002B1117B3ED6965890F670D9D95D2922DFD5397F446790823CB91A9FED034534781492E4B8EEAD17AEC49845D0B908 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D346BEB6F73FB9D1E4A6A67F58EBB1B475699381C6DA1F7A252B6078D8F6513AF22AB01805B6CE7F3561D7E09C32AA3244CCA05A2567D5886EA77DD89D51EBB77422883A52494A83022EA455F16B58544A2E30DDF7C44BCB90DA5AE236DF995FB59978A700BF655EAEEED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojaieVYTt/pxSYW4/C24R0AA== X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D614045FA08BF0F6E8C50C7D0F6C13AE992130BA85ED3F340254A0152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit][v2] Handle all stack layouts in (delayed) TRACE vmevent. 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" This is a multi-part message in MIME format. --------------7mR3MUPws5LnVyhhCNa0tI7Z Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Bonjour, Sergey, fixed and force-pushed. Sergey On 07.02.2025 13:50, Sergey Kaplun via Tarantool-patches wrote: > Hi, Sergey! > Thanks for the fixes! > LGTM, after fixing a bunch of nits below. > > On 06.02.25, Sergey Bronnikov wrote: >> From: Mike Pall >> > > >> --- >> Branch:https://github.com/tarantool/luajit/tree/ligurio/lj-1087-vm-handler-call >> >> Related issues: >> -https://github.com/LuaJIT/LuaJIT/issues/1087 >> -https://github.com/tarantool/tarantool/issues/10709 >> >> Changes in the v2: >> * Addressed comments by Sergey Kaplun >> > > >> diff --git a/src/lj_trace.c b/src/lj_trace.c >> index 94cb27e5..6b97cc13 100644 >> --- a/src/lj_trace.c >> +++ b/src/lj_trace.c > > >> diff --git a/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c b/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c >> new file mode 100644 >> index 00000000..ebdf63e1 >> --- /dev/null >> +++ b/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c > > >> +/* XXX: Still need normal assert inside writer functions. */ > Minor: Since there is no writer function, I would rather use the > following wording: > | Still need normal assert for sanity checks. Fixed. >> +#undef NDEBUG >> +#include >> + >> +/* >> + * Test file to demonstrate a segmentation fault, when C function > Typo: s/C function/a C function/ Fixed. > >> + * is used as a VM handler in LuaJIT: > Minor: `as a VM handler for trace events` is a little bit more verbose. > Feel free to ignore. Fixed.  /* - * Test file to demonstrate a segmentation fault, when C function - * is used as a VM handler in LuaJIT: + * Test file to demonstrate a segmentation fault, when a C + * function is used as a VM handler for trace events in LuaJIT:   *   * Program received signal SIGSEGV, Segmentation fault.   * 0x000055555557e77d in trace_abort (J=0x7ffff7f9b6b8) at lj_trace.c:615 >> + * >> + * Program received signal SIGSEGV, Segmentation fault. >> + * 0x000055555557e77d in trace_abort (J=0x7ffff7f9b6b8) at lj_trace.c:615 >> + * 615 lj_vmevent_send(L, TRACE, >> + * (gdb) bt >> + * >> + * See details inhttps://github.com/LuaJIT/LuaJIT/issues/1087. >> + */ >> + > > >> + /* >> + * The number 32767 is `REF_DROP - REF_BIAS`. > It will be better to rephrase the next sentence. > >> See the commit >> + * 0fdf06b456e6 ("test: relax JIT setup in misc.getmetrics >> + * test") for the details. >> + */ > I suggest the following comment. > | This is the maximum possible IR amount, so the trace is always > | aborted. > > The amount of text to read is approximately the same, but we don't need > to look into the mysterious commit anymore. :) Fixed. @@ -103,9 +103,9 @@ static int handle_cont_frame(void *test_state)         jit_attach(L, nop, "trace");         /* -        * The number 32767 is `REF_DROP - REF_BIAS`. See the commit -        * 0fdf06b456e6 ("test: relax JIT setup in misc.getmetrics -        * test") for the details. +        * The number 32767 is `REF_DROP - REF_BIAS`. This is the +        * maximum possible IR amount, so the trace is always +        * aborted.          */ > >> + int res = luaL_dostring(L, "jit.opt.start('minstitch=32767')"); > > --------------7mR3MUPws5LnVyhhCNa0tI7Z Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Bonjour, Sergey,

fixed and force-pushed.

Sergey


On 07.02.2025 13:50, Sergey Kaplun via Tarantool-patches wrote:
Hi, Sergey!
Thanks for the fixes!
LGTM, after fixing a bunch of nits below.

On 06.02.25, Sergey Bronnikov wrote:
From: Mike Pall <mike>

<snipped>

---
Branch: https://github.com/tarantool/luajit/tree/ligurio/lj-1087-vm-handler-call

Related issues:
- https://github.com/LuaJIT/LuaJIT/issues/1087
- https://github.com/tarantool/tarantool/issues/10709

Changes in the v2:
* Addressed comments by Sergey Kaplun

<snipped>

diff --git a/src/lj_trace.c b/src/lj_trace.c
index 94cb27e5..6b97cc13 100644
--- a/src/lj_trace.c
+++ b/src/lj_trace.c
<snipped>

diff --git a/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c b/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c
new file mode 100644
index 00000000..ebdf63e1
--- /dev/null
+++ b/test/tarantool-c-tests/lj-1087-vm-handler-call.test.c
<snipped>

+/* XXX: Still need normal assert inside writer functions. */
Minor: Since there is no writer function, I would rather use the
following wording:
| Still need normal assert for sanity checks.
Fixed.

      
+#undef NDEBUG
+#include <assert.h>
+
+/*
+ * Test file to demonstrate a segmentation fault, when C function
Typo: s/C function/a C function/
Fixed.

+ * is used as a VM handler in LuaJIT:
Minor: `as a VM handler for trace events` is a little bit more verbose.
Feel free to ignore.

Fixed.

 /*
- * Test file to demonstrate a segmentation fault, when C function
- * is used as a VM handler in LuaJIT:
+ * Test file to demonstrate a segmentation fault, when a C
+ * function is used as a VM handler for trace events in LuaJIT:
  *
  * Program received signal SIGSEGV, Segmentation fault.
  * 0x000055555557e77d in trace_abort (J=0x7ffff7f9b6b8) at lj_trace.c:615


      
+ *
+ * Program received signal SIGSEGV, Segmentation fault.
+ * 0x000055555557e77d in trace_abort (J=0x7ffff7f9b6b8) at lj_trace.c:615
+ * 615         lj_vmevent_send(L, TRACE,
+ * (gdb) bt
+ *
+ * See details in https://github.com/LuaJIT/LuaJIT/issues/1087.
+ */
+
<snipped>

+	/*
+	 * The number 32767 is `REF_DROP - REF_BIAS`.
It will be better to rephrase the next sentence.

                                                 See the commit
+	 * 0fdf06b456e6 ("test: relax JIT setup in misc.getmetrics
+	 * test") for the details.
+	 */
I suggest the following comment.
| This is the maximum possible IR amount, so the trace is always
| aborted.

The amount of text to read is approximately the same, but we don't need
to look into the mysterious commit anymore. :)

Fixed.

@@ -103,9 +103,9 @@ static int handle_cont_frame(void *test_state)
        jit_attach(L, nop, "trace");
 
        /*
-        * The number 32767 is `REF_DROP - REF_BIAS`. See the commit
-        * 0fdf06b456e6 ("test: relax JIT setup in misc.getmetrics
-        * test") for the details.
+        * The number 32767 is `REF_DROP - REF_BIAS`. This is the
+        * maximum possible IR amount, so the trace is always
+        * aborted.
         */


+	int res = luaL_dostring(L, "jit.opt.start('minstitch=32767')");
<snipped>

--------------7mR3MUPws5LnVyhhCNa0tI7Z--