From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: profiler Date: Fri, 21 Jun 2024 08:23:16 +0000 Message-ID: References: <87v823xvq1.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23305"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, =?utf-8?Q?Gerd_M=C3=B6llmann?= , Eli Zaretskii , eller.helmut@gmail.com To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 21 12:33:37 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sKbaL-0005mn-1o for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jun 2024 12:33:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKbZX-0000ax-KL; Fri, 21 Jun 2024 06:32:47 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKZYT-0008HE-VO for emacs-devel@gnu.org; Fri, 21 Jun 2024 04:23:34 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKZYS-0002xw-0B for emacs-devel@gnu.org; Fri, 21 Jun 2024 04:23:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1718958202; x=1719217402; bh=4mBJFilCGUEsa66z8+UrSizap0gxLhJxEM+JJ5n0SEQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=kVkofcULnLcWZZOrihYEVzPwtg6G4eFTra9lEMBtjqfKSnxIAtytD0r2QwejsvKip 2mLX+MvRNvWlLoNfpgagwsYBsB57OTHMKhoE8ptIt7FN3+dQ76f/dSwK+HYL0AYtpx 0XeHd50HbvQshOYwXUKx24Pvc92L5KSYP0T8HgUSTGMaO0YUiV5kVnjCyQRbVAaHDN XC7FSV04sTKiKuM2e8s6aEC3A3Ld4IRrbI/YziiH0YZCHL08iyLEYCGNKJ0oxC+pwf j9u3IPUHtsiMXYlPR0b2v6Ol+b0GwqBgN/9+vRyKus41NvpjEPXJqEOocRTweIkBQ0 oor8i8zJTfFWw== In-Reply-To: <87v823xvq1.fsf@localhost> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 302d7099f15eb23e19224296991fc6145c1dc4bf Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 21 Jun 2024 06:32:44 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320379 Archived-At: On Thursday, June 20th, 2024 at 19:24, Ihor Radchenko = wrote: > I am playing around with scratch/igc branch for fun, and there is one > crash that I can reproduce quite consistently. >=20 > All it takes is (1) compile Emacs without native-compilation support; > (2) open Emacs; (3) M-x profiler-start; (4) run a complex operation. >=20 > Steps to reproduce: >=20 > 1. emacs -Q doc/misc/org.org > 2. M-x profiler-start RET cpu RET > 3. M-: (org-element-parse-buffer) RET >=20 > Without step 2, no crash. Just sharing some information from a private discussion with Ihor: I can reproduce this locally. I can also "fix" it locally, but the problem = seems more complicated since Ihor reports the fix isn't working for him. 1. MPS uses SIGSEGV internally, usually transparently to the client program= . 2. The profiler uses SIGPROF, then runs complicated code in the handler. My= understanding is it's carefully tuned not to trigger traditional GC, but i= t can and will cause (handled) SIGSEGV. 3. MPS isn't reentrant enough to handle a SIGSEGV while it's handling a SIG= SEGV, and will die with one of a number of errors. The right thing to do, IMHO, is to let MPS know that it should block SIGPRO= F (and any other signals that might use managed memory) while handling SIGS= EGV. Unfortunately, the MPS code in current git doesn't have facilities to = do that, so I've applied this patch to MPS, which works here but doesn't fo= r Ihor: diff --git a/code/protsgix.c b/code/protsgix.c index 966569c92..7c60d4fa2 100644 --- a/code/protsgix.c +++ b/code/protsgix.c @@ -143,7 +143,7 @@ void ProtSetup(void) int result; =20 sa.sa_sigaction =3D sigHandle; - result =3D sigemptyset(&sa.sa_mask); + result =3D sigfillset(&sa.sa_mask); AVER(result =3D=3D 0); sa.sa_flags =3D SA_SIGINFO | SA_RESTART; =20 Hope any of this helps, Pip