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: Sat, 28 Dec 2024 19:35:54 +0200 Message-ID: <867c7jsoat.fsf@gnu.org> References: <87o713wwsi.fsf@telefonica.net> <87ttaucub8.fsf@protonmail.com> <87pllicrpi.fsf@protonmail.com> <864j2u442i.fsf@gnu.org> <87a5ch5z1b.fsf@gmail.com> <87plld5pev.fsf@protonmail.com> <87ed1t6r34.fsf@gmail.com> <875xn46s6z.fsf@gmail.com> <86bjwwulnc.fsf@gnu.org> <877c7jlxsu.fsf@gmail.com> <86frm7sx4d.fsf@gnu.org> <87a5cfoivh.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17736"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 28 18:36:31 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 1tRajn-0004R0-3P for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 18:36:31 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRajI-0005kZ-MY; Sat, 28 Dec 2024 12:36:00 -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 1tRajG-0005kK-Ez for emacs-devel@gnu.org; Sat, 28 Dec 2024 12:35:58 -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 1tRajF-0000gJ-Gf; Sat, 28 Dec 2024 12:35:57 -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=std5UnMqq29bpM+x3KQG3l2hmS44kFJuPNlBxnMRpsI=; b=SDhqbMAh4mD0 XI1YJV5l5FWOjEi5XPuFi2Pf9tm0hWmCQCpC11Goc4tJObQey7ok/vXk2H0UlRMI3VASHjQm+Up5w UDHdWi5Vm6ulVmWBuQ8+kJvLT+l/iiBkhA+BDFJ/ZwTO1tX51lyLqNdm/iWjGSS/h3DWHHdtq6+pB GPxFCuO/9ObMmj2tqgQripamyY95I/3MISl7DlX5xd30Gs0LjWZNo84iuhm+umB6kzckEJ/She0Pb M2Gzxj+ATlejuLhEd2egWBIv8VwW7mWFGn+3JF+cgHyDLbbJQVe/kFaFbLsJcOfktxHVa9t/lmkws ac1PixlRklQeskGIcJkdYA==; In-Reply-To: <87a5cfoivh.fsf@gmail.com> (message from Helmut Eller on Sat, 28 Dec 2024 17:46:42 +0100) 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:327280 Archived-At: > From: Helmut Eller > Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, > emacs-devel@gnu.org, acorallo@gnu.org > Date: Sat, 28 Dec 2024 17:46:42 +0100 > > On Sat, Dec 28 2024, Eli Zaretskii wrote: > > > Hm... if ArenaEnter uses non-recursive locks, how come we get aborts > > if some code tries to lock the arena when it is already locked? IOW, > > how is this situation different from what we already saw several times > > in the crashes related to having SIGPROF delivered while MPS holds the > > arena lock? > > I'm not sure what you expect instead. It's an error to claim a > non-recursive lock twice in the same thread. The fault handler claims > the lock. If the SIGPROF handler interrupts MPS while it's holding the > lock and then triggers a fault, then it claims the lock a second time. > It's no surprise to see crashes here. > > >> During that time window, the lock is held by the profiler thread. The > >> SIGPROF handler runs in the main thread. If the main thread tries to > >> claim the lock, it will block until the profiler thread releases it. > > > > See above: I thought that such a situation triggers crashes. I'm > > probably missing something. > > If two threads are claiming a the same non-recursive lock concurrently, > then it's not an error. Oh, so you are saying that taking the lock twice is a fatal error only if that is done from the same thread? Is that known for certain? > >> >> Regarding deadlocks: the profiler thread holds the lock while it waits. > >> >> So MPS should not be able to stop the profiler thread there. > >> > > >> > Which means we don't register the profiler thread with MPS, right? > >> > >> I'm not sure. It may not be safe to call ArenaEnter in non-registered > >> threads. > > > > But if we do register the thread, then MPS _will_ stop it, no? > > Good point. But I think we are safe: to access the list of threads to > stop, MPS must first hold the arena lock. Are we sure MPS must take the lock before it can stop registered threads?