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: MPS: a random backtrace while toying with gdb Date: Sun, 30 Jun 2024 12:24:58 +0200 Message-ID: <875xtqramd.fsf@gmail.com> References: <87bk3jh8bt.fsf@localhost> <87wmm6rcv1.fsf@gmail.com> <86le2mhhsj.fsf@gnu.org> 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="29642"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gerd.moellmann@gmail.com, pipcet@protonmail.com, yantar92@posteo.net, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 30 12:26:03 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 1sNrkw-0007Nj-U1 for ged-emacs-devel@m.gmane-mx.org; Sun, 30 Jun 2024 12:26:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNrkG-0008E4-Jk; Sun, 30 Jun 2024 06:25:20 -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 1sNrk5-0008Bn-VQ for emacs-devel@gnu.org; Sun, 30 Jun 2024 06:25:13 -0400 Original-Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNrk1-000167-Gt; Sun, 30 Jun 2024 06:25:08 -0400 Original-Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a7245453319so321787266b.1; Sun, 30 Jun 2024 03:25:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719743100; x=1720347900; darn=gnu.org; h=content-transfer-encoding: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=OzRlsIVHssJVCyk0+HQJbTu5qGrneCZdOBt8i5/PNTA=; b=dirWQGakjvllFJfpe/4Xdp918GOnMYdyt/1BYtuZoWPp8J5elSYg0X+LeFkFBzMksF QhVImtZ8fuQfO8uYkGKutvprUIBU9P8WkNR3JzcEG+Cr0Gs9HHZfcg70/c5X63RN22rR mbKEB7Er9Hn3+pJQKJD7AsE1qMOj3S7bxvg/ohiHIwHqPkJ78Tvroh0fL9mcCBmqhwLd 8TCcppWFWhhQueBI88/gnWY0fxgFMXvOhUzeddPTbdofdjDQI3HVzrUU5km/7EOzciV1 5OC1yeVsknk9gcVxPnEZ1HLBiytefH/1AW3iUb0WPUaiXNMH/RaYZ8N2i2hHzIfYo3Xy tToQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719743100; x=1720347900; h=content-transfer-encoding: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=OzRlsIVHssJVCyk0+HQJbTu5qGrneCZdOBt8i5/PNTA=; b=HwIG1kIwqlOWlnNBFQsBLRLGuhNPPFooB3DnXNxdrwTOr7BTpaOaP2xK+zxkS0Vd3n tUKBCbBeMqDfFSGojCPW5Vy0vVE9rCqJBffiPqU2ZVVW3ePQVB+h7j7zjhHtQx0QADaP hgUVuNEvIti4eS/RCtZaAxn90bNYjSf/1vz+zStb/jOfOcYzIVNkOIbtnXCzZRgzgGlU 5M2/H0vTuMxNvOCYXZL5IzDdxtPaWxt1rmYL3vif387PhB9pEzK8ZQLp83lxa5Qu9/hc 5wOBJ+zPfnj9t1L0y9Ti/if4+ja8v9Hng+QZvl3gszI3eKfcd69tvOQwwy72rotSveve SM3Q== X-Forwarded-Encrypted: i=1; AJvYcCV2CrNbAceJoRBfcdhyc89fo6r7y31G9iuG9gQW9Iwe3xSuZobFOAj+3b6osakpo1SCxugwlDqspHP84YXu/rb08Mpa X-Gm-Message-State: AOJu0YyrfTarw21AawOwrTx3s0+WLW4/N2KW1uoZf6W/ubgAokGauhQl ITU0xb2l1+Otucigt9uL9bNLc/o6/NDJZqN6FB4QAQVGg33y86V8vqc0gg== X-Google-Smtp-Source: AGHT+IGjnfucyrxH5wctpyBtdfqEoC5G/7pGMggLuMav6EtlEFpjTREX5KzqbuRg5sKmME13fPOhIw== X-Received: by 2002:a17:907:2d86:b0:a72:5760:1424 with SMTP id a640c23a62f3a-a7513773b0dmr328312166b.0.1719743100484; Sun, 30 Jun 2024 03:25:00 -0700 (PDT) Original-Received: from caladan (dial-187254.pool.broadband44.net. [212.46.187.254]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a72ab06521esm230284666b.110.2024.06.30.03.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Jun 2024 03:25:00 -0700 (PDT) In-Reply-To: <86le2mhhsj.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 30 Jun 2024 13:00:12 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x636.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:320936 Archived-At: On Sun, Jun 30 2024, Eli Zaretskii wrote: >> I would move most of the work out of signal handlers. The signal >> handler could put the work in a "async work queue" and then return. The >> actual work is then processed by maybe_quit. > > But in this case we hit the barrier just by accessing the process > object. How can you do anything useful in a SIGCHLD handler if you > cannot even find out which process exited and how did it exit? You don't do anything useful other than packing up the arguments that the signal handler receives and put them in the queue. > Surely, something like that is needed in order to put any work on some > queue? And I'm not even talking about the effects of deferring this > job "for later" on the speed of working with sub-processes in Emacs. The queue is not in MPS-managed memory; so we can access it. > IMO, we must find a way of touching MPS-managed memory safely from a > signal handler, otherwise writing signal handlers will become an > impossible job. The MPS documentation says quite clearly that a scanner must not access MPS-managed memory other than the block it receives as argument: https://memory-pool-system.readthedocs.io/en/latest/topic/format.html#cau= tions 5. Format methods must not: a. call library code; b. access MPS-managed memory in pools that protect their contents; c. perform a non-local exit (for example, by throwing an exception, or calling longjmp()); d. call any functions or macros in the MPS other than MPS_SCAN_BEGIN, MPS_SCAN_END, MPS_FIX1(), MPS_FIX12(), MPS_FIX2(), and MPS_FIX_CALL. It=E2=80=99s permissible to call other functions in the client program, = but see MPS_FIX_CALL for a restriction on passing the scan state. 6. Subject to the above constraints, format methods can freely access: a. memory inside the object or block that they have been asked to look at; b. MPS-managed memory in pools that do not protect their contents; c. memory not managed by the MPS.