From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: SIGPROF + SIGCHLD and igc Date: Sat, 28 Dec 2024 11:02:44 +0100 Message-ID: <875xn46s6z.fsf@gmail.com> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19415"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Gerd =?utf-8?Q?M=C3=B6llmann?= , Eli Zaretskii , 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 Sat Dec 28 11:03:36 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 1tRTfU-0004xJ-6o for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 11:03:36 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRTeo-0003Zc-EN; Sat, 28 Dec 2024 05:02:54 -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 1tRTel-0003ZM-5s for emacs-devel@gnu.org; Sat, 28 Dec 2024 05:02:52 -0500 Original-Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRTei-0003J8-FP; Sat, 28 Dec 2024 05:02:49 -0500 Original-Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-aa6997f33e4so1347488566b.3; Sat, 28 Dec 2024 02:02:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735380166; x=1735984966; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=dfAnOgtWYpwxob4eSexbTMyG3ZLlfW0+npNRYHwX8H0=; b=XVb0HJgvuSSqX6KyzbMJVN69/DiaQXvE0UnT0eX6nsky9PdOsqTx2l8/PA0zs1Z6yP vXvOKtuc5a8oAtT9qCNGGs1YWU8+L7UfIMspIdr8pcUB8bDFhIickSabjWTp+KEqsUA8 SWaBM5H/5+eYGNgNX2fOtIoUHbOiZymrVoBGcWgpCkLfSxr7rZFCEen0tbEkkzkWEli3 AyeD8x3g2dGE1I3Mfyb1NQp1aYwg5FAL9ZcY/wbNtotLaO1O/PFoer1xyQOiXlb5PGzT zJwFdeNj4R0ndQMWAFE/lqGeBuYrKmoWvJCyE39jXul4pen0HeYiKC7eMCmqbMoaRtY7 RmaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735380166; x=1735984966; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dfAnOgtWYpwxob4eSexbTMyG3ZLlfW0+npNRYHwX8H0=; b=jQjhtVcZxQMzcBf6ys0rgO5b9hODqzKOFm0Tnh7BwRD1AY8z8F1oqglrUsOPXv/W+b XDpIV0xQiuTHfMurkkIpQqPIQ+Zs9bX5tCHk/7aD71JQ4wo1ii+xpaMqgregJMSkxGXT HOT4a+fXXMnp/W0hSOnv/mFkCLUrlch8j8NWnV0iuo6JIeeyYLa0WIlNGsbYC7y0yb/x ezgxND0wgG0+dh2fScIv0UfP7wNRtVxX1pJI1DX5ZKvEJwBVl4wzydR/CTbWrfi+9mbX OEP7lPf+sau9YBOOXr+urtMbMa8lkViJF5hAVL4xQzj9AgA3fB5WazqqOAYQzOvE8SK0 veFA== X-Forwarded-Encrypted: i=1; AJvYcCVxaA/IgMo021ewNLkfsZiU7j6KzTF9ekd8gK51qUajT/PiR+AVXL9XJAqYMs0yFiF1izd98GOm6lq7Ets=@gnu.org, AJvYcCWABUbKY1HQRb0ijmTb7QAWT8uO6BAtQTTwtF9ZrodqbqRmVI/XA178vbjdHbd18phFJdoqPg==@gnu.org, AJvYcCXqLX8J7dO+bVm/RXoBmgHClCF7o0SA5SGrg5QpO1LPo+FCCRbUcBXzi1A0pLVGiMuvlPzd3U+urA==@gnu.org X-Gm-Message-State: AOJu0YxAHbbzvLUoR/aaKPdzCoMNIo2x/01ANgdoEYsjUjMJB2isi3Ym kQ1t9DFr9MGjeEtDgeCBfx9YcBsEr7Tiv1oJg6Rgujh/eh1SgNanMDGDzCy9 X-Gm-Gg: ASbGnct4N2jlCdGslRj4UDw0DZPl0s6RNZKTYKCsyKL/e0KZg6Q7inMvD088PvJLUV+ EANMLk9MCodp1WhasEdoM8zH7Qj8phEcan2TypmdsZkv3ejkVTVCSrMbHAeQif7AtO9AorzvdhY V8Jv2A/oPzoCuRpZJUTKZDk5mUymyiRi2nIJvzNGD+qj7GXrEL1NA7daVw9fGi4FxuUaFOCJwH1 cmXzleVxDKx6zWSfFXd6RLusWyueZBJCQL4LAE4Dj7hPKmiOb/9lAo= X-Google-Smtp-Source: AGHT+IEtPnL1TYKnoF730GFLYPMoy2UqocLZ05OuMSL0Dz7lMvLaLS/vthEq8Am4V7iT7d3k7obbMg== X-Received: by 2002:a17:907:1c21:b0:aa6:88b3:ba4e with SMTP id a640c23a62f3a-aac33415dd6mr3080115466b.36.1735380165761; Sat, 28 Dec 2024 02:02:45 -0800 (PST) Original-Received: from caladan ([31.177.115.143]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e830af1sm1225768666b.14.2024.12.28.02.02.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 02:02:45 -0800 (PST) In-Reply-To: <87ed1t6r34.fsf@gmail.com> (Helmut Eller's message of "Fri, 27 Dec 2024 17:14:23 +0100") Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x62b.google.com 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_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:327248 Archived-At: On Fri, Dec 27 2024, Helmut Eller wrote: > Pip Cet via wrote: >> ...forever, if the profiler thread has been suspended at this point. > > Hmm. Indeed. So back to the drawing board. It seems that the statement block SIGPROF while MPS holds the lock is logically equivalent to deliver SIGPROF only while MPS does not hold the lock. This variant might be bit easier to implement. The "while MPS does not hold the lock" part can be implemented by claiming the lock in the profiler thread like so: mps_arena_t arena = global_igc->arena; ArenaEnter (arena); ... deliver SIGPROF part goes here ... ArenaLeave (arena); The functions ArenaEnter and ArenaLeave are not part of the public API but they are external symbols, so the linker can find them. The "deliver SIGPROF" part goes like this: 1. The profiler thread calls pthread_kill (SIGPROF, ) and then waits (on a pipe or whatever). 2. The SIGPROF handler gets called and immediately notifies the profiler thread (without waiting for a reply). After that, it continues as usual calling get_backtrace etc. 3. The profiler thread awakes and releases the lock. Regarding deadlocks: the profiler thread holds the lock while it waits. So MPS should not be able to stop the profiler thread there. Helmut