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: Sun, 29 Dec 2024 20:34:11 +0100 Message-ID: <87ed1qb7ws.fsf@gmail.com> References: <87o713wwsi.fsf@telefonica.net> <87ldw7fwet.fsf@protonmail.com> <87a5cnfj8t.fsf@protonmail.com> <86seqe4j4f.fsf@gnu.org> <87ttaucub8.fsf@protonmail.com> <87pllicrpi.fsf@protonmail.com> <864j2u442i.fsf@gnu.org> <87a5ch5z1b.fsf@gmail.com> <86y101wlsr.fsf@gnu.org> <87msgeb9y6.fsf@gmail.com> <86ttampax7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27893"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gerd.moellmann@gmail.com, pipcet@protonmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 29 20:34:40 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 1tRz3g-0007Az-5a for ged-emacs-devel@m.gmane-mx.org; Sun, 29 Dec 2024 20:34:40 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRz3N-0000Rt-Mc; Sun, 29 Dec 2024 14:34:21 -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 1tRz3I-0000R5-OT for emacs-devel@gnu.org; Sun, 29 Dec 2024 14:34:19 -0500 Original-Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRz3H-0002tn-3u; Sun, 29 Dec 2024 14:34:16 -0500 Original-Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aa68b513abcso1639437366b.0; Sun, 29 Dec 2024 11:34:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735500852; x=1736105652; 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=TXUBpoC9CI83jOGdFjpVOGN+7SBrQLaara4X/ZGHIhM=; b=jVFNXYFpukrz5qGuQ5T4JBqQSxSEfKXHDqEeVlQqXS5OngziRdJR2XZmP5zE4BhNEO sh1jeaKgDgNL+hdE34h1njksvvKv1kggtmbduLRiDo9kis8nsU1A0V3H630a+RnTIVXv O53CiGiDzY5oj77GekuO6+JO8eCYEYrfdldEaIfmQ20DeZJ4xJ9KZFYxYEyJpdzoaEyA +gnhVkUxBLowLA/PAwFWZiKHGwz6pSvYJPOgQ3qs/EgTtdm2F4x9kiWHVzmU7AFrSOMe v9aCuMdYmhfBPTfzWFGSTrj70Em72U9iSdRDkJJYhNZ+oGZ41idjUlqKIB0iacLbuB01 vTfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735500852; x=1736105652; 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=TXUBpoC9CI83jOGdFjpVOGN+7SBrQLaara4X/ZGHIhM=; b=AIyBcAp9ov2OutKbhNTzbfGGbDKo3xbZoSoHWj52QisY49Zk4ThJkoqlegnGFN2eSt r+FA7DdgQCF04l3fwDBw8ZZ59oHqbVpEl2KezOE0Ua+MJNSZVSNhvuXq2+xDsSG3MnrS tv07ikYGHyvLqS33dit1dmAEFbsgdEXfvH6qXB+VP6k3xJDJMiBGwlfE3s7jq1HJqbtt Jh92LBYujCuvN24EuVjJvI6dYEDhBjbQHYRUUGsp9vilJo2Xmsw6Nn8jj8MncI7glWAq 8gxjQrGeiAYQs3CY+bo1fFRCU/F/MUJeQehmtX3NJ7WDMuCsg3GHM9gLFU2ZM8KLqFPy iLzA== X-Forwarded-Encrypted: i=1; AJvYcCVoz0rK9R5il/1MdTypNGcLT0UK3wyjT9lnIObaJsjtJ88O40xyLZD8kWPDyvigFxyA3ZXXbqRRF0Nn0yE=@gnu.org, AJvYcCWe+CTyZBbGCxFyVg7vNHXhHjojfLSXSKVxer5Ueap42fQM0APhjNbQABXK/T8LHgXOiEGZpZ5KEg==@gnu.org X-Gm-Message-State: AOJu0YxifSC5+QQN2LaafS2lwW/ZGmq4gQ0trhO7dxmOFsyPejUXwfhM V2zPdlPCzE6jVSC4+DS1oP4xWti6cN6ek+i48k6dfPLtShFhx7ucC1/7mDw8 X-Gm-Gg: ASbGncs1gMPCs3zJWp6EILxDFuexRfluUJ7OlDYjCbVa9/PRp9R4jb4lJn47H40rnya JYEsQ+nGGd7j8gdCAxrNy8LViTUcLBo+FeOX5e789tkf6dDSZ+mJJgK6zkxqjFFOUbA3s1hYe9S u5uYn0mJ+ifF60nPRFOj8HzO2K3llyFPkze094FpXl8H07qO12S5ttp6HU8NxhcVZ8fzYh4XEY6 Z/8TG2cS5sQXh/xWldm+DSaXpkKj7FjpVNLwfOwi9uNib9TykPPqPA= X-Google-Smtp-Source: AGHT+IE4M0+DwMXIYcj9Gs1IrXk0jUNMWxnVPX1HWwjYboHk5OpHBK6PiuFWwcoym/18qCgtgAyUJw== X-Received: by 2002:a17:907:97d2:b0:aa6:af4b:7c95 with SMTP id a640c23a62f3a-aac33690754mr3475363366b.56.1735500852115; Sun, 29 Dec 2024 11:34:12 -0800 (PST) Original-Received: from caladan ([31.177.115.143]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aaf5d1b602bsm55844666b.178.2024.12.29.11.34.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Dec 2024 11:34:11 -0800 (PST) In-Reply-To: <86ttampax7.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 Dec 2024 21:05:24 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x635.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:327364 Archived-At: On Sun, Dec 29 2024, Eli Zaretskii wrote: >> Here another observation: Let's assume that we can emulate SuspendThread >> and ResumeThread on POSIX and MacOS (much like MPS does it). In the >> profiler thread we can then simply do: >> >> SuspendThread () >> get_backtrace () >> ResumeThread () >> >> without invoking any SIGPROF handler or the need for >> ArenaEnter/ArenaLeave. > > Yes, we can. But that means changing what the SIGPROF handler does > will have no effect, which is bad for maintenance. By contrast, the > current MS-Windows implementation does basically the same, but it > calls the handler, not its body. > > Also, I don't quite see why you thing calling get_backtrace directly > will have any effect on the need to lock the arena. I'm probably > missing something. Ok. The arena lock is a problem. Is that also a problem for the Windows implementation? How does it avoid deadlocks when the thread holds the arena lock? >> The only complication seems to be, that we must avoid deadlocks when MPS >> tries to suspend a thread is already suspended by our emulation. > > If MPS always runs from the main thread, it doesn't (and cannot) > suspend the thread. Or maybe I misunderstand which thread do you mean > here? I may interpret "MPS runs in a thread" differently than you do. Maybe I should say a "thread is inside MPS" whenever a thread holds the arena lock. With this meaning, every thread can be inside MPS. Helmut