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: SIGPROF + SIGCHLD and igc Date: Sun, 29 Dec 2024 07:44:06 +0200 Message-ID: <86ttanqc0p.fsf@gnu.org> References: <87o713wwsi.fsf@telefonica.net> <87ed1t6r34.fsf@gmail.com> <875xn46s6z.fsf@gmail.com> <86bjwwulnc.fsf@gnu.org> <877c7jlxsu.fsf@gmail.com> <86frm7sx4d.fsf@gnu.org> <87a5cfoivh.fsf@gmail.com> <87r05reh9t.fsf@protonmail.com> <87msgfmvrp.fsf@gmail.com> <87bjwvedzn.fsf@protonmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7400"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 29 06:44:27 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 1tRm6F-0001lz-B9 for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Dec 2024 06:44:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRm61-0006ls-EC; Sun, 29 Dec 2024 00:44:13 -0500 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 1tRm5y-0006lb-AL for emacs-devel@gnu.org; Sun, 29 Dec 2024 00:44:11 -0500 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 1tRm5w-0005o1-Tl; Sun, 29 Dec 2024 00:44:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=8ASmbiyp5Anm+hyzDvUtb4TfaeoO30OgT9iBFA775e4=; b=akTr/ju2ymHu E4ZyyL2j9zggOen7F8VyKL3FopBnMWfp7ymAXBprpU/wX0QwNYwjVk3QMLA3Y6G5x2q4WVbYceeTu yIiFdrmCvMbv7QSyCM1f+avbjeusGufMU/7GCIsc6ehdUrORK4xQAhSDY+2stW52FdK7Tpg8gM+Yx B8L5cvr3ds5q4gCxAEHufWokBFcLTZIwecoUcFIflBCk7yhQnOGZWxvSvQLtMhkkZ2gaWJoTM3Mtg Xe6P3SeFVQ7S1E8f5gWjAeeuD61ze1MSVPpxADEf37AMAqxbF64Eks09RHeBaYsaUkJb4Ns2fdAyi QB/gLnTk6ROGipIeQwVwEg==; In-Reply-To: <87bjwvedzn.fsf@protonmail.com> (message from Pip Cet on Sat, 28 Dec 2024 20:43:18 +0000) 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:327310 Archived-At: > Date: Sat, 28 Dec 2024 20:43:18 +0000 > From: Pip Cet > Cc: Eli Zaretskii , gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org > > "Helmut Eller" writes: > > > On Sat, Dec 28 2024, Pip Cet wrote: > > > >>> I think I see what you mean. I imagine the profiler thread to be a loop > >>> like > >>> > >>> while (true) { > >>> sleep () > >>> ArenaEnter () > >>> pthread_kill (SIGPROF, ) > >>> wait () > >>> ArenaLeave () > >>> } > >> > >> I'm not really following. Did you mean to include a call to a "clear > >> all memory barriers" function after the ArenaEnter call? If not, the > >> SIGPROF handler (and all handlers interrupting the SIGPROF handler which > >> aren't being delayed) would not be able to access MPS memory, which I > >> thought was the goal. > > > > In my mind it works like this: when the SIGPROF handler tries to access > > MPS memory, the SIGSEGV handler kicks in as it usually would in a > > non-signal handler context. This should work because at the beginning > > of the SIGPROF handler we guarantee that MPS doesn't hold the arena > > lock. > > Sorry, still not following. The SIGPROF-sending thread holds the arena > lock. So we can't take it in the SIGSEGV handler. It's still a > deadlock, right? But the SIGPROF handler doesn't take the arena lock, it starts by writing to the pipe, which then causes the SIGPROF-sending thread to release the lock, thus letting the SIGPROF handler touch memory which could trigger MPS into taking the lock.