From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: profiler Date: Fri, 21 Jun 2024 10:16:35 +0300 Message-ID: <86tthmlq98.fsf@gnu.org> References: <87v823xvq1.fsf@localhost> <86cyobmmhc.fsf@gnu.org> <87r0crxung.fsf@localhost> <87le2zxsqx.fsf@localhost> <8634p6n7jd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31221"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yantar92@posteo.net, emacs-devel@gnu.org, eller.helmut@gmail.com To: Gerd =?iso-8859-1?Q?M=F6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 21 09:17: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 1sKYWe-0007sb-Fv for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jun 2024 09:17:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKYVk-0001MA-BI; Fri, 21 Jun 2024 03:16:40 -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 1sKYVj-0001Lw-KF for emacs-devel@gnu.org; Fri, 21 Jun 2024 03:16:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKYVi-0007pK-AN; Fri, 21 Jun 2024 03:16:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=KfQYIM4FBE7Nc8EL0WiXR2d3I2RvNB0j3gTkNOSqJ70=; b=ICUdbKj71cuXEdEG1Bt7 E4oCcBxEMxJcTHMVI4NfO4yOWtM2luuzYMzTDY6ylKJ3yaCfDG5GSIv0wQKu5swDiIIgLfhpuZJbd fQJwFNW0WKrzfVi7GyXtKGUizdsVbouqoLAMe3wnn7MU+GygjGkIXq4oBeFiK8FDb6Y/nGK2FxSoc Y265T3dwd47ydwqb/nGGwjQuDhTTwhzeg8RC/M1yu+xIHJxWpxeKQ9CfB0pCxygmYbFiAaBAOQPLo /hWZbtb5f/sYt8G/uAfj1NALFiq3IonXmBLpilATTsZ69cCUUhGNE0A/pJVVt4AVUorqaPpjIhn2Y PgPH8WEKLNbdhw==; In-Reply-To: (message from Gerd =?iso-8859-1?Q?M=F6llmann?= on Fri, 21 Jun 2024 08:54:34 +0200) 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:320364 Archived-At: > From: Gerd Möllmann > Cc: Ihor Radchenko , emacs-devel@gnu.org, > eller.helmut@gmail.com > Date: Fri, 21 Jun 2024 08:54:34 +0200 > > Eli Zaretskii writes: > > > Also, can 'static struct profiler_log cpu', which is being worked on > > by record_backtrace, be affected by MPS in any way? > > I'd guess that just "touching" Lisp objects in the SIGPROF handler can > be problematic because these objects themselves can be behind a barrier, > either the same that MPS is currently working on when it got interrupted > or another one. Which Lisp objects do we touch in record_backtrace? All I see is that we access spec_pdl and its data. Is that supposed to be dangerous while MPS does its thing? Also note that add_sample (called by the SIGPROF handler) does this: if (EQ (backtrace_top_function (), QAutomatic_GC)) /* bug#60237 */ /* Special case the time-count inside GC because the hash-table code is not prepared to be used while the GC is running. More specifically it uses ASIZE at many places where it does not expect the ARRAY_MARK_FLAG to be set. We could try and harden the hash-table code, but it doesn't seem worth the effort. */ plog->gc_count = saturated_add (plog->gc_count, count); else record_backtrace (plog, count); IOW, it avoids recording the backtrace if called during GC. Perhaps we should do the same with igc? Or doe we already set up backtrace_top_function to return QAutomatic_GC in that case? And finally, I see in make_log that we already do something about the log variables that is specific to MPS. Is that not enough to prevent this kind of issues?