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 2EAFE1466C81; Fri, 27 Jun 2025 16:00:50 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2EAFE1466C81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1751029250; bh=t12f228cWc22hRm9LElvoY0977TjEUGlrDln+gWVD08=; 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=B7Lj0ukc72YdYi2yXUC0PoHFYiBcw9fsHtOl6Sebs/q+7rrtgc+xbVLFH83aG1CRB M2I660ghcb/k4IYjRm+Vh642cDxm5wdCvxh+v3i16csbtH87OxdQG7gS1UMnKv1FW/ hIfF5Fq5g7iXKS42G6ZVnMqbwGexT5bsMz5g7PqM= Received: from send174.i.mail.ru (send174.i.mail.ru [95.163.59.13]) (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 5BE5447EED4 for ; Fri, 27 Jun 2025 16:00:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5BE5447EED4 Received: by exim-smtp-68f89ddb46-g7ljf with esmtpa (envelope-from ) id 1uV8hD-000000007Tf-0Z7V; Fri, 27 Jun 2025 16:00:47 +0300 Content-Type: multipart/alternative; boundary="------------sNvO069jCOGV99Hf6dR9jggK" Message-ID: <4ff91097-b8ab-4292-b79d-c3e121b8ed74@tarantool.org> Date: Fri, 27 Jun 2025 16:00:46 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <20250625100327.5563-1-skaplun@tarantool.org> <4569e398-f93d-4192-8eae-5408eeaed9e7@tarantool.org> Content-Language: en-US In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD933AE9F878D93CC2950D789EAA8C360273D69486295C9F583182A05F5380850404C228DA9ACA6FE2725E189762DEA54FE3DE06ABAFEAF67058243F093847A6B78EA7A1689F9366A4B386F63046B3269FA X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE70D278D70F8433719EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AC83A81C8FD4AD23D82A6BABE6F325AC2E85FA5F3EDFCBAA7353EFBB55337566AE9ED57A64F3638E602B54BB4E1DA70EFE910C40A0EA21AF02FE2696B867EA26389733CBF5DBD5E913377AFFFEAFD269176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481FCF19DD082D7633A0EF3E4896CB9E6436389733CBF5DBD5E9D5E8D9A59859A8B64854413538E1713FCC7F00164DA146DA6F5DAA56C3B73B237318B6A418E8EAB8D32BA5DBAC0009BE9E8FC8737B5C22493749BA5C53AD944B76E601842F6C81A12EF20D2F80756B5FB606B96278B59C4276E601842F6C81A127C277FBC8AE2E8BC4D393A224A4E0BA3AA81AA40904B5D99C9F4D5AE37F343AD1F44FA8B9022EA23BBE47FD9DD3FB595F5C1EE8F4F765FC72CEEB2601E22B093A03B725D353964B0B7D0EA88DDEDAC722CA9DD8327EE4930A3850AC1BE2E735A3CCBC2573AEBDE1C4224003CC83647689D4C264860C145E X-C1DE0DAB: 0D63561A33F958A5573991F73857FDBD5002B1117B3ED696390CBCAB568B8CD65B6221DB6D7A72AD823CB91A9FED034534781492E4B8EEAD47A3109F1ACFD409BDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF0B0D0398A952E703A9A7E5B23437A94ACB7E9C0D0936FDAC81767B920A0BCD09AF1510F4A86D2C81CDE0AF47C568F6FD3343BEC3D52225F355E3422AC51FAA5A15B83C3CF5BCC67B111DC66A97D0BFE2913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVV45pMz5J5bNTfEPqA0S1ss= X-Mailru-Sender: 520A125C2F17F0B1E52FEF5D219D61409769001E405F85DE91417EB218679B82E636DD222DE1321D0152A3D17938EB451EB5A0BCEC6A560B3DDE9B364B0DF289BE2DA36745F2EEB5CEBA01FB949A1F1EEAB4BC95F72C04283CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] sysprof: fix sampling outside the VM 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. --------------sNvO069jCOGV99Hf6dR9jggK Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Sergey, LGTM Sergey On 6/26/25 13:11, Sergey Kaplun wrote: > Hi, Sergey! > Thanks for the review! > Fixed your comments and force-pushed the branch. > > On 25.06.25, Sergey Bronnikov wrote: >> Hi, Sergey, >> >> thanks for the patch! Please see my comments below. >> >> Sergey >> >> On 6/25/25 13:03, Sergey Kaplun wrote: >>> If the signal by timer is handled outside the VM, the `g->vmstate` >>> equals zero. This was interpreted by the sysprof as the trace with the >>> corresponding number and leads to the assertion failure. >>> >>> This patch fixes that by checking this case and dumping only the host >>> stack outside the VM. >>> >>> Resolves tarantool/tarantool#11185 >>> Resolves tarantool/tarantool#11429 >>> --- >>> >>> Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-11185-stream-trace-assert >>> Related issues: >>> *https://github.com/tarantool/tarantool/issues/11185 >>> *https://github.com/tarantool/tarantool/issues/11429 >>> >>> Mentinoned in the test: >>> *https://github.com/tarantool/tarantool/issues/10803 >>> >>> src/lj_sysprof.c | 4 +- >>> .../gh-11185-stream-trace-assert.test.c | 54 +++++++++++++++++++ >>> 2 files changed, 57 insertions(+), 1 deletion(-) >>> create mode 100644 test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c >>> >>> diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c >>> index cf6161a5..013df2cd 100644 >>> --- a/src/lj_sysprof.c >>> +++ b/src/lj_sysprof.c >>> @@ -297,7 +297,9 @@ static void sysprof_record_sample(struct sysprof *sp, siginfo_t *info) >>> { >>> global_State *g = sp->g; >>> uint32_t _vmstate = ~(uint32_t)(g->vmstate); >>> - uint32_t vmstate = _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE; >>> + /* `g->vmstate` is 0 outside the VM. Hence, dump only the host stack. */ >>> + uint32_t vmstate = ~_vmstate == 0 ? LJ_VMST_INTERP : >>> + _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE; >> Nested ternary operators is not convenient for reading, I would probably >> convert at least outer condition to >> >> if-else. Feel free to ignore. > Fixed. See the iterative patch below: > > =================================================================== > diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c > index 013df2cd..4c109074 100644 > --- a/src/lj_sysprof.c > +++ b/src/lj_sysprof.c > @@ -297,9 +297,15 @@ static void sysprof_record_sample(struct sysprof *sp, siginfo_t *info) > { > global_State *g = sp->g; > uint32_t _vmstate = ~(uint32_t)(g->vmstate); > + uint32_t vmstate; > + > /* `g->vmstate` is 0 outside the VM. Hence, dump only the host stack. */ > - uint32_t vmstate = ~_vmstate == 0 ? LJ_VMST_INTERP : > - _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE; > + if (g->vmstate == 0) > + vmstate = LJ_VMST_INTERP; > + else if (_vmstate < LJ_VMST_TRACE) > + vmstate = _vmstate; > + else > + vmstate = LJ_VMST_TRACE; > > lj_assertX(pthread_self() == sp->thread, > "bad thread during sysprof record sample"); > =================================================================== Thanks! >>> >>> lj_assertX(pthread_self() == sp->thread, >>> "bad thread during sysprof record sample"); >>> diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c >>> new file mode 100644 >>> index 00000000..c4d7ea67 >>> --- /dev/null >>> +++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c >>> @@ -0,0 +1,54 @@ >>> +#include "lua.h" >>> +#include "lauxlib.h" >>> + >>> +/* Need for skipcond for OS and ARCH. */ >>> +#include "lj_arch.h" >>> + >>> +#include "test.h" >>> +#include "utils.h" >>> + >>> +#include >>> +#include >>> + >>> +/* >>> + * Check that there is no assertion failure during the dump of the >>> + * sample outside the VM. >>> + */ >>> +static int gh_11185_stream_trace_assert(void *test_state) >>> +{ >> I got the following warnings produced by compiler: >> >> [ 97%] Building C object >> test/tarantool-c-tests/CMakeFiles/gh-11185-stream-trace-assert.dir/gh-11185-stream-trace-assert.test.c.o >> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c:17:12: >> warning: ‘gh_11185_stream_trace_assert’ defined but not used >> [-Wunused-function] >>    17 | static int gh_11185_stream_trace_assert(void *test_state) >>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> In file included from >> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c:8: >> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/utils.h:34:13: >> warning: ‘utils_lua_close’ defined but not used [-Wunused-function] >>    34 | static void utils_lua_close(lua_State *L) >>       |             ^~~~~~~~~~~~~~~ >> /home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/utils.h:17:19: >> warning: ‘utils_lua_init’ defined but not used [-Wunused-function] >>    17 | static lua_State *utils_lua_init(void) >>       |                   ^~~~~~~~~~~~~~ >> [100%] Linking C executable gh-11185-stream-trace-assert.c_test > Fixed like the following: > > =================================================================== > diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > index 78f08cde..69cd4da1 100644 > --- a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > +++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > @@ -5,7 +5,10 @@ > #include "lj_arch.h" > > #include "test.h" > + > +#if LJ_HASSYSPROF && !defined(LUAJIT_USE_VALGRIND) > #include "utils.h" > +#endif /* LJ_HASSYSPROF && !defined(LUAJIT_USE_VALGRIND) */ > > #include > #include > @@ -32,8 +35,10 @@ static int stream_trace_assert(void *test_state) > int main(void) > { > #if LUAJIT_USE_VALGRIND > + UNUSED(stream_trace_assert); > return skip_all("Disabled due to #10803"); > -#elif LUAJIT_DISABLE_SYSPROF > +#elif !LJ_HASSYSPROF > + UNUSED(stream_trace_assert); > return skip_all("Sysprof is disabled"); > #else /* LUAJIT_DISABLE_SYSPROF */ > if (LUAJIT_OS != LUAJIT_OS_LINUX) > =================================================================== > >> CMake config string: cmake -S . -B build -DLUAJIT_USE_VALGRIND=ON >> -DLUAJIT_USE_ASAN=OFF -DLUAJIT_USE_SYSMALLOC=ON -DLUAJIT_ENABLE_GC64=ON >> -DLUA_USE_APICHECK=ON -DLUA_USE_ASSERT=ON -DCMAKE_BUILD_TYPE=Debug >> >>> + lua_State *L = test_state; >>> + (void)luaL_dostring(L, >>> + "misc.sysprof.start({mode = 'C', path = '/dev/null'})"); >>> + >>> + pid_t self_pid = getpid(); >>> + /* Dump the single sample outside the VM. */ >>> + kill(self_pid, SIGPROF); >>> + >>> + /* No assertion fail -- stop the profiler and exit. */ >>> + (void)luaL_dostring(L, "misc.sysprof.stop()"); >>> + return TEST_EXIT_SUCCESS; >>> +} >>> + >>> +int main(void) >>> +{ >>> +#if LUAJIT_USE_VALGRIND >>> + return skip_all("Disabled due to #10803"); >>> +#elif LUAJIT_DISABLE_SYSPROF >>> + return skip_all("Sysprof is disabled"); >>> +#else /* LUAJIT_DISABLE_SYSPROF */ >>> + if (LUAJIT_OS != LUAJIT_OS_LINUX) >>> + return skip_all("Sysprof is implemented for Linux only"); >>> + if (LUAJIT_TARGET != LUAJIT_ARCH_X86 >>> + && LUAJIT_TARGET != LUAJIT_ARCH_X64) >>> + return skip_all("Sysprof is implemented for x86_64 only"); >>> + >>> + lua_State *L = utils_lua_init(); >>> + >>> + const struct test_unit tgroup[] = { >>> + test_unit_def(gh_11185_stream_trace_assert) >> Do we really need a prefix "gh_11185_" when it is already present in the >> filename? >> >> I would omit it. > Removed prefix: > > =================================================================== > diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > index c4d7ea67..78f08cde 100644 > --- a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > +++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c > @@ -14,7 +14,7 @@ > * Check that there is no assertion failure during the dump of the > * sample outside the VM. > */ > -static int gh_11185_stream_trace_assert(void *test_state) > +static int stream_trace_assert(void *test_state) > { > lua_State *L = test_state; > (void)luaL_dostring(L, > @@ -45,7 +45,7 @@ int main(void) > lua_State *L = utils_lua_init(); > > const struct test_unit tgroup[] = { > - test_unit_def(gh_11185_stream_trace_assert) > + test_unit_def(stream_trace_assert) > }; > const int test_result = test_run_group(tgroup, L); > utils_lua_close(L); > =================================================================== Thanks! >>> + }; >>> + const int test_result = test_run_group(tgroup, L); >>> + utils_lua_close(L); >>> + return test_result; >>> +#endif /* LUAJIT_DISABLE_SYSPROF */ >>> +} --------------sNvO069jCOGV99Hf6dR9jggK Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hi, Sergey,

LGTM

Sergey

On 6/26/25 13:11, Sergey Kaplun wrote:
Hi, Sergey!
Thanks for the review!
Fixed your comments and force-pushed the branch.

On 25.06.25, Sergey Bronnikov wrote:
Hi, Sergey,

thanks for the patch! Please see my comments below.

Sergey

On 6/25/25 13:03, Sergey Kaplun wrote:
If the signal by timer is handled outside the VM, the `g->vmstate`
equals zero. This was interpreted by the sysprof as the trace with the
corresponding number and leads to the assertion failure.

This patch fixes that by checking this case and dumping only the host
stack outside the VM.

Resolves tarantool/tarantool#11185
Resolves tarantool/tarantool#11429
---

Branch:https://github.com/tarantool/luajit/tree/skaplun/gh-11185-stream-trace-assert
Related issues:
*https://github.com/tarantool/tarantool/issues/11185
*https://github.com/tarantool/tarantool/issues/11429

Mentinoned in the test:
*https://github.com/tarantool/tarantool/issues/10803

  src/lj_sysprof.c                              |  4 +-
  .../gh-11185-stream-trace-assert.test.c       | 54 +++++++++++++++++++
  2 files changed, 57 insertions(+), 1 deletion(-)
  create mode 100644 test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c

diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c
index cf6161a5..013df2cd 100644
--- a/src/lj_sysprof.c
+++ b/src/lj_sysprof.c
@@ -297,7 +297,9 @@ static void sysprof_record_sample(struct sysprof *sp, siginfo_t *info)
  {
    global_State *g = sp->g;
    uint32_t _vmstate = ~(uint32_t)(g->vmstate);
-  uint32_t vmstate = _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE;
+  /* `g->vmstate` is 0 outside the VM. Hence, dump only the host stack. */
+  uint32_t vmstate = ~_vmstate == 0 ? LJ_VMST_INTERP :
+		     _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE;
Nested ternary operators is not convenient for reading, I would probably 
convert at least outer condition to

if-else. Feel free to ignore.
Fixed. See the iterative patch below:

===================================================================
diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c
index 013df2cd..4c109074 100644
--- a/src/lj_sysprof.c
+++ b/src/lj_sysprof.c
@@ -297,9 +297,15 @@ static void sysprof_record_sample(struct sysprof *sp, siginfo_t *info)
 {
   global_State *g = sp->g;
   uint32_t _vmstate = ~(uint32_t)(g->vmstate);
+  uint32_t vmstate;
+
   /* `g->vmstate` is 0 outside the VM. Hence, dump only the host stack. */
-  uint32_t vmstate = ~_vmstate == 0 ? LJ_VMST_INTERP :
-                     _vmstate < LJ_VMST_TRACE ? _vmstate : LJ_VMST_TRACE;
+  if (g->vmstate == 0)
+    vmstate = LJ_VMST_INTERP;
+  else if (_vmstate < LJ_VMST_TRACE)
+    vmstate = _vmstate;
+  else
+    vmstate = LJ_VMST_TRACE;
 
   lj_assertX(pthread_self() == sp->thread,
              "bad thread during sysprof record sample");
===================================================================
Thanks!

      

        
  
    lj_assertX(pthread_self() == sp->thread,
  	     "bad thread during sysprof record sample");
diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
new file mode 100644
index 00000000..c4d7ea67
--- /dev/null
+++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
@@ -0,0 +1,54 @@
+#include "lua.h"
+#include "lauxlib.h"
+
+/* Need for skipcond for OS and ARCH. */
+#include "lj_arch.h"
+
+#include "test.h"
+#include "utils.h"
+
+#include <signal.h>
+#include <unistd.h>
+
+/*
+ * Check that there is no assertion failure during the dump of the
+ * sample outside the VM.
+ */
+static int gh_11185_stream_trace_assert(void *test_state)
+{
I got the following warnings produced by compiler:

[ 97%] Building C object 
test/tarantool-c-tests/CMakeFiles/gh-11185-stream-trace-assert.dir/gh-11185-stream-trace-assert.test.c.o
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c:17:12: 
warning: ‘gh_11185_stream_trace_assert’ defined but not used 
[-Wunused-function]
    17 | static int gh_11185_stream_trace_assert(void *test_state)
       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from 
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c:8:
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/utils.h:34:13: 
warning: ‘utils_lua_close’ defined but not used [-Wunused-function]
    34 | static void utils_lua_close(lua_State *L)
       |             ^~~~~~~~~~~~~~~
/home/sergeyb/sources/MRG/tarantool/third_party/luajit/test/tarantool-c-tests/utils.h:17:19: 
warning: ‘utils_lua_init’ defined but not used [-Wunused-function]
    17 | static lua_State *utils_lua_init(void)
       |                   ^~~~~~~~~~~~~~
[100%] Linking C executable gh-11185-stream-trace-assert.c_test
Fixed like the following:

===================================================================
diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
index 78f08cde..69cd4da1 100644
--- a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
+++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
@@ -5,7 +5,10 @@
 #include "lj_arch.h"
 
 #include "test.h"
+
+#if LJ_HASSYSPROF && !defined(LUAJIT_USE_VALGRIND)
 #include "utils.h"
+#endif /* LJ_HASSYSPROF && !defined(LUAJIT_USE_VALGRIND) */
 
 #include <signal.h>
 #include <unistd.h>
@@ -32,8 +35,10 @@ static int stream_trace_assert(void *test_state)
 int main(void)
 {
 #if LUAJIT_USE_VALGRIND
+        UNUSED(stream_trace_assert);
         return skip_all("Disabled due to #10803");
-#elif LUAJIT_DISABLE_SYSPROF
+#elif !LJ_HASSYSPROF
+        UNUSED(stream_trace_assert);
         return skip_all("Sysprof is disabled");
 #else /* LUAJIT_DISABLE_SYSPROF */
         if (LUAJIT_OS != LUAJIT_OS_LINUX)
===================================================================

CMake config string: cmake -S . -B build -DLUAJIT_USE_VALGRIND=ON 
-DLUAJIT_USE_ASAN=OFF -DLUAJIT_USE_SYSMALLOC=ON -DLUAJIT_ENABLE_GC64=ON  
-DLUA_USE_APICHECK=ON -DLUA_USE_ASSERT=ON -DCMAKE_BUILD_TYPE=Debug

+	lua_State *L = test_state;
+	(void)luaL_dostring(L,
+		"misc.sysprof.start({mode = 'C', path = '/dev/null'})");
+
+	pid_t self_pid = getpid();
+	/* Dump the single sample outside the VM. */
+	kill(self_pid, SIGPROF);
+
+	/* No assertion fail -- stop the profiler and exit. */
+	(void)luaL_dostring(L, "misc.sysprof.stop()");
+	return TEST_EXIT_SUCCESS;
+}
+
+int main(void)
+{
+#if LUAJIT_USE_VALGRIND
+	return skip_all("Disabled due to #10803");
+#elif LUAJIT_DISABLE_SYSPROF
+	return skip_all("Sysprof is disabled");
+#else /* LUAJIT_DISABLE_SYSPROF */
+	if (LUAJIT_OS != LUAJIT_OS_LINUX)
+		return skip_all("Sysprof is implemented for Linux only");
+	if (LUAJIT_TARGET != LUAJIT_ARCH_X86
+	    && LUAJIT_TARGET != LUAJIT_ARCH_X64)
+		return skip_all("Sysprof is implemented for x86_64 only");
+
+	lua_State *L = utils_lua_init();
+
+	const struct test_unit tgroup[] = {
+		test_unit_def(gh_11185_stream_trace_assert)
Do we really need a prefix "gh_11185_" when it is already present in the 
filename?

I would omit it.
Removed prefix:

===================================================================
diff --git a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
index c4d7ea67..78f08cde 100644
--- a/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
+++ b/test/tarantool-c-tests/gh-11185-stream-trace-assert.test.c
@@ -14,7 +14,7 @@
  * Check that there is no assertion failure during the dump of the
  * sample outside the VM.
  */
-static int gh_11185_stream_trace_assert(void *test_state)
+static int stream_trace_assert(void *test_state)
 {
         lua_State *L = test_state;
         (void)luaL_dostring(L,
@@ -45,7 +45,7 @@ int main(void)
         lua_State *L = utils_lua_init();
 
         const struct test_unit tgroup[] = {
-                test_unit_def(gh_11185_stream_trace_assert)
+                test_unit_def(stream_trace_assert)
         };
         const int test_result = test_run_group(tgroup, L);
         utils_lua_close(L);
===================================================================
Thanks!

      

        
+	};
+	const int test_result = test_run_group(tgroup, L);
+	utils_lua_close(L);
+	return test_result;
+#endif /* LUAJIT_DISABLE_SYSPROF */
+}

    
--------------sNvO069jCOGV99Hf6dR9jggK--