From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: profiler Date: Fri, 21 Jun 2024 10:50:21 +0200 Message-ID: References: <87v823xvq1.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36482"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ihor Radchenko , emacs-devel@gnu.org, Eli Zaretskii , eller.helmut@gmail.com To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 21 10:51:15 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 1sKZzG-0009Ie-7c for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jun 2024 10:51:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKZyX-0005rA-I3; Fri, 21 Jun 2024 04:50:29 -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 1sKZyU-0005ql-HN for emacs-devel@gnu.org; Fri, 21 Jun 2024 04:50:27 -0400 Original-Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKZyS-00088e-Hn; Fri, 21 Jun 2024 04:50:26 -0400 Original-Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57d07f07a27so1859380a12.3; Fri, 21 Jun 2024 01:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718959822; x=1719564622; 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=RrYK+UNEw6Ig6MNETytQEryIA96esn0sXME4ULmti7M=; b=dNKWF04Nw///P+HqMWFNmLNE3jq+8N9+eZnd5gSddsWSTTkvTAH69wzcZ2NsQ2XfTI 7TaE52YkY+DI3nP1UN0d5/Sy3DnsSj2EFX+qN6d4ksHd9kObkbEbdEHzo38/m6N8Dny7 ruKQLY+HiA3nuce0Vc9AGCBNVK/12C6ZaY9z4OBC0DRv0OzlF2ZUjyw+AWZPdGRr/cBk AUoPnfnitNVfp0BaWhcV9YF096AmFlYS1fjEQqxaZ4zgklC7S3GEbOMuf/5jV6KSger6 P70WXlMm1BSImM4B+TJnyz13jenBC1ALMVxEx5mqn/ssvQKXysQIQGPukNmrOX+tW5bo rT0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718959822; x=1719564622; 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=RrYK+UNEw6Ig6MNETytQEryIA96esn0sXME4ULmti7M=; b=fu6Xl/6uGc45tMdzGI/GAGnZ4mjE6LWNNdEy6PKFqjH8EU905pMJBRfviVtHWOpWEv wdQxJcf+f6bLB8NojpfM7CB+UjFEoGmFuLcmg5isFjxYbySSTYK3Bicy5s2o32YYgi7x JrTEFqwkJdcFPfiTzCiWi1rm4oDgjkol0Q2nY2fG75SSlA5W6j8fJbd7KtFdZcJd6SOg gKIYZDmUmvK3PwXz78yG5XtLUAtwJ8WZ8ncmnWV7Wn6fgfKa2KAe5D8CuvFhirHqqa9O falDrqxvGUl475zL2v1rAHIpyC/sDwG91ptQHQtu1EFIbjr3tmJKfC7aj59h2dnmdTSg /PHg== X-Forwarded-Encrypted: i=1; AJvYcCW+N7LGAAzmLIP4QPTVBC4oXBwlPc2cFVbJKgtd0A2baPvfUpVI64hHTxvO0bmhapAufaRX5H10KYLGH/ulCtsizyjdgL1cDMGkqVF9kUe6RpM= X-Gm-Message-State: AOJu0Yx8QoRXAoZ9N0+2mzmDkwhuK2Pz91OgEXiDXopPmMjrubA7xOja cQ/FNf8+PoxW1k8jk3yeld470Dt+PXxQgEYpG9GqtoQNhbSXTKrh X-Google-Smtp-Source: AGHT+IHH9Dqm4I5Hee0TQb2wrWmTOnc00ieUzXZEMbmikbA5QDtaJLhgJU6TmQHTzJshvpPdOiwiJw== X-Received: by 2002:a17:906:9c16:b0:a6f:10d0:f3e0 with SMTP id a640c23a62f3a-a6fab6187e7mr392003766b.21.1718959822361; Fri, 21 Jun 2024 01:50:22 -0700 (PDT) Original-Received: from pro2.fritz.box (p4fe3a72a.dip0.t-ipconnect.de. [79.227.167.42]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6fcf48b527sm59055666b.65.2024.06.21.01.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 01:50:22 -0700 (PDT) In-Reply-To: (Pip Cet's message of "Fri, 21 Jun 2024 08:23:16 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x533.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, T_SCC_BODY_TEXT_LINE=-0.01 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:320376 Archived-At: Pip Cet writes: > Just sharing some information from a private discussion with Ihor: > > I can reproduce this locally. I can also "fix" it locally, but the > problem seems more complicated since Ihor reports the fix isn't > working for him. > > 1. MPS uses SIGSEGV internally, usually transparently to the client > program. > > 2. The profiler uses SIGPROF, then runs complicated code in the > handler. My understanding is it's carefully tuned not to trigger > traditional GC, but it can and will cause (handled) SIGSEGV. > > 3. MPS isn't reentrant enough to handle a SIGSEGV while it's handling > a SIGSEGV, and will die with one of a number of errors. That's basically it, I agree. A signal handler is not supposed to do things like that, from the POV of MPS (and others :-)). > > The right thing to do, IMHO, is to let MPS know that it should block > SIGPROF (and any other signals that might use managed memory) while > handling SIGSEGV. Unfortunately, the MPS code in current git doesn't > have facilities to do that, so I've applied this patch to MPS, which > works here but doesn't for Ihor: > > diff --git a/code/protsgix.c b/code/protsgix.c > index 966569c92..7c60d4fa2 100644 > --- a/code/protsgix.c > +++ b/code/protsgix.c > @@ -143,7 +143,7 @@ void ProtSetup(void) > int result; > > sa.sa_sigaction = sigHandle; > - result = sigemptyset(&sa.sa_mask); > + result = sigfillset(&sa.sa_mask); > AVER(result == 0); > sa.sa_flags = SA_SIGINFO | SA_RESTART; > Hm, sigfillset is a bit much maybe. What about only adding PROF, like in https://www.gnu.org/software/libc/manual/html_node/Blocking-for-Handler.html But I'll better leave that to the experts.