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 A51476ECE3; Thu, 16 Jun 2022 09:58:34 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org A51476ECE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1655362714; bh=W7CtBIbEmFekm8XE8IwJ5tiZc7ioIz8iBKMo26crfC0=; 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=vJNbSPsU1EU/Q4jMiUA78M44HrCGLsH4eZqTqWQzLTr6+dnR44vf1l6fFLXm7fRUQ d299l839a0nHjCxNCSFh6R8YCkkxZ5KV42A3NJWqkSS01FXPE4qw773HJyQraLVoX/ HEToYAClAz3drLthEHk/zcU4QqRi+mQQWlD+q57A= 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 542326ECE3 for ; Thu, 16 Jun 2022 09:58:33 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 542326ECE3 Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1o1jSa-0005rE-9c; Thu, 16 Jun 2022 09:58:32 +0300 Date: Thu, 16 Jun 2022 09:56:14 +0300 To: Maxim Kokryashkin Message-ID: References: <20220612185220.502537-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220612185220.502537-1-m.kokryashkin@tarantool.org> X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD97D44297578DBEB86125514212DDDA19BA119F021AE23A1F9182A05F538085040CE3BB0712D61A62BC85441377C1C6A39C8A2220C30E1C62FDAF1D94CD3D169B1 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7952C4D7BD0BF3359EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CF20B9B7F5DD35A68638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84D56F4BC75FE1E6EB9AA5A22728E8816117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCF1175FABE1C0F9B6A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18C26CFBAC0749D213D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 9604B64F49C60606AD91A466A1DEF99B296C473AB1E14218C6CDE5D1141D2B1C75C161F62970F818ECE5D23C44B8DBBDF0FF04133C29993AAD91A466A1DEF99B296C473AB1E14218B936CB490224F2464EEA7BD89490CAC0EDDA962BC3F61961 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348D68DCC07DD06FF55ACA4154BA112355444C4552A0E17CB344F8E86EDCA4759D949C3A1C9BF3DBF21D7E09C32AA3244CDC808006791C663F586EDBFEF48B621AA8CE788DE6831205927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojCCvLuneITNpNL5rsxcM5+g== X-Mailru-Sender: 689FA8AB762F7393CC2E0F076E87284EBC20DB2146F454127341FAB03483386E0FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED55FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] sysprof: disable proto and trace dumps in default 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 patch! LGTM, except a few nits below. On 12.06.22, Maxim Kokryashkin wrote: > There is no need to dump proto or trace information for sysprof > in the default mode. Moreover, attempts to do so will lead to > segmentation fault due to uninitialized buffer. This commit > disables proto and trace dumps in the default mode. > > Resolves tarantool/tarantool#7264 > --- > PR: https://github.com/tarantool/tarantool/pull/7265 > Branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-7264-dump-proto-default-mode > > src/lj_sysprof.c | 4 +- > ...4-add-proto-trace-sysprof-default.test.lua | 58 +++++++++++++++++++ > 2 files changed, 60 insertions(+), 2 deletions(-) > create mode 100644 test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > > diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c > index a4a70146..2e9ed9b3 100644 > --- a/src/lj_sysprof.c > +++ b/src/lj_sysprof.c > diff --git a/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua b/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > new file mode 100644 > index 00000000..2d2a756a > --- /dev/null > +++ b/test/tarantool-tests/gh-7264-add-proto-trace-sysprof-default.test.lua > @@ -0,0 +1,58 @@ > +-- Sysprof is implemented for x86 and x64 architectures only. > +local ffi = require("ffi") > +require("utils").skipcond( > + jit.arch ~= "x86" and jit.arch ~= "x64" or jit.os ~= "Linux" > + or ffi.abi("gc64"), > + jit.arch.." architecture or "..jit.os.. > + " OS is NIY for sysprof" > +) > + > +local tap = require("tap") > +local jit = require("jit") > + > +local test = tap.test("gh-7264-add-proto-trace-sysprof-default.test.lua") > +test:plan(2) > + > +jit.off() > +jit.flush() > + > +local function allocate() > + local a = {} > + for _ = 1, 1e4 do table.insert(a, "teststring") end Why do we need so many iterations? We can manipulate JIT behaviour by using `jit.opt.start('hotloop=1')`. > + return a > +end > + > +local chunk = [[ > +function lua_global_f() > + local a = 'teststring' Nit: I suggest to use one type of quotes in the whole test. (Also, it is better to use single quotes everywhere (its offline agreement with Igor). > +end > +]] > + > +-- Trace creation during the sysprof runtime. > +jit.on() > + > +local _ = nil Why do we need this variable? (If for the `res, _ =` below, we can just use the single `res = `). > +local res, err = misc.sysprof.start({ mode = "D" }) > +assert(res, err) > +allocate() > +res, _ = misc.sysprof.stop() > +test:ok(res) Nit: please add name for the test. > + > +jit.off() > + > +-- Proto creation during the sysprof runtime. > +res, err = misc.sysprof.start({ mode = "D" }) > +assert(res, err) > + > +res, err = loadstring(chunk) > +assert(res, err) > +res() > + > +-- luacheck: globals lua_global_f > +lua_global_f() > +collectgarbage() > +res, _ = misc.sysprof.stop() > +test:ok(res) Ditto. > + > +jit.on() > +os.exit(test:check() and 0 or 1) > -- > 2.36.1 > -- Best regards, Sergey Kaplun