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: Forwording symbols Date: Tue, 18 Jun 2024 21:27:41 +0200 Message-ID: <87tthq830y.fsf@gmail.com> References: <87jziod6yc.fsf@gmail.com> <874j9rcuf6.fsf@gmail.com> <87y173bda9.fsf@gmail.com> <87plsfbcd5.fsf@gmail.com> <86cyoeqvfc.fsf@gnu.org> <87frta9pgf.fsf@gmail.com> <86v826p346.fsf@gnu.org> <86r0cup24x.fsf@gnu.org> <874j9q9l37.fsf@gmail.com> <86msnip0ul.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2706"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jun 18 21:28:08 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 1sJeUy-0000Yz-28 for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Jun 2024 21:28:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJeUd-0005w7-IX; Tue, 18 Jun 2024 15:27:47 -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 1sJeUc-0005vy-CL for emacs-devel@gnu.org; Tue, 18 Jun 2024 15:27:46 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJeUa-0008OH-Lh; Tue, 18 Jun 2024 15:27:46 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-36279cf6414so663356f8f.3; Tue, 18 Jun 2024 12:27:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718738863; x=1719343663; 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=M7ZRVQqSKz542qLlNk0wA3zWYEwDsgvQ0fT9DW0BX3c=; b=V8TFT7sD7CeZaxTZPUG0csQxeCIfgFswjC0xCTCRG3shQCuFCvS2OUvwwG97d0KkxL bFRYurEnuFkXMXZ8d4wiiYuOrrQ5J4B8H0orsjQ5EAkcAYPrjA0G9eKpMxqE/wbPaEya ch7VkRYC5B2DKlOPd0TGe8tBhcJxbtK+asnraTZ6ceArZ3CxIEq/avcejs0HGQaEhGzE M6KbZeXqFZ202drhGKZCL+FCTkJirDQTNaT2HotoTiPz2IYMv8ZAHLu0BHELDQ2THCRm nxkXQyRFzLTObCLab4qWGdZeoO8ZdR85Cf874gG6Nc7TbTfH0i8OgQTgf9MgH4wcpc2t 8llA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718738863; x=1719343663; 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=M7ZRVQqSKz542qLlNk0wA3zWYEwDsgvQ0fT9DW0BX3c=; b=b8bAM9LFWlL4SxBJDIzpYa0toZW3Q8ockCbjJ/jHKMoHZwB+mn9R0D5aOLDjvfIoPL G0UPePGmRFZ7mT9leSo9COsQ07ubu3yKzYU9sjhCscF+b0yTjhEI+Q6NnuXZfqkFvO7O Z4WWlCZerO6GiEir8Mx3EWdky123Q2pX0jlfn4TRLzLWeM2fNPVp6l+USVrA78K0bx+P xiS5OxRF81NWFw+Icm8wRKSPNO+ED6bO6kj9eQMzhCCJabhP6BlkkdVKpzOaGMnjK57h EfBZrErFmJCovzKVIN0AZ5jHHckIM6YTWWLQKOJDAYMaiujg4MtgAZMnRduJjSCDG8/y S9OA== X-Forwarded-Encrypted: i=1; AJvYcCU4NYEgfbp0lrxW+qx0MQMdJlyZdCERG8Z76IHJ9PC+upxpX8FyYV0md9g4hZZt5oxkUs9j/6ILuMCyy03u8KWLkY2P X-Gm-Message-State: AOJu0YzOFtbUVd4s7wpKlzXMGDV2463TKTn4E1DBquUb9lrtTlJVbBRY JkVz6rQZ96moFDvM8koilep0CDaqUl+zsk5qIWv4F384RZwir3M9nfhGuQ== X-Google-Smtp-Source: AGHT+IFHbAlaGrM8EOFMJdUxuaciiswX0TphBmNI33Mj1os/dzaRaknaBMnkD477QAajhZzdSgIixw== X-Received: by 2002:a05:6000:d88:b0:360:79a2:af1 with SMTP id ffacd0b85a97d-363175b83abmr383898f8f.25.1718738862451; Tue, 18 Jun 2024 12:27:42 -0700 (PDT) Original-Received: from caladan (dial-189091.pool.broadband44.net. [212.46.189.91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36075114e09sm14854951f8f.117.2024.06.18.12.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jun 2024 12:27:41 -0700 (PDT) In-Reply-To: <86msnip0ul.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 18 Jun 2024 21:22:42 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=eller.helmut@gmail.com; helo=mail-wr1-x431.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:320264 Archived-At: --=-=-= Content-Type: text/plain On Tue, Jun 18 2024, Eli Zaretskii wrote: >> Could this be our old friend dump_discard_mem that is too lazy to check >> error codes? What happens if you remove the call to >> dump_mmap_discard_contents in pdumper_load? > > Then the build succeeds. With the patch below, dump_mmap_discard_contents calls the map->release callback. I think that was the original reason for having this callback. It also adds stricter error checking to dump_discard_mem, but that function is now unused. It's not clear to me, when it should be used instead of dump_unmap_file. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-More-strict-error-checking-in-pdump_mmap_discard.patch >From 018e0b1f6b0f3c2e53d7a99b3f29e968470e3ef1 Mon Sep 17 00:00:00 2001 From: Helmut Eller Date: Tue, 18 Jun 2024 21:15:32 +0200 Subject: [PATCH] More strict error checking in pdump_mmap_discard * src/dumper.c (dump_discard_mem): Abort on error. (dump_mmap_discard_contents): Call dump_mmap_release instead of dump_discard_mem, which invokes the map specific callback. --- src/pdumper.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/pdumper.c b/src/pdumper.c index 9147be38294..9800652da5f 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -4951,24 +4951,22 @@ dump_discard_mem (void *mem, size_t size) DWORD old_prot; (void) VirtualProtect (mem, size, PAGE_NOACCESS, &old_prot); #elif VM_SUPPORTED == VM_POSIX + int err = 0; # ifdef HAVE_POSIX_MADVISE /* Discard COWed pages. */ - (void) posix_madvise (mem, size, POSIX_MADV_DONTNEED); + err = posix_madvise (mem, size, POSIX_MADV_DONTNEED); # elif defined HAVE_MADVISE - (void) madvise (mem, size, MADV_DONTNEED); + err = madvise (mem, size, MADV_DONTNEED); #endif + if (err) + emacs_abort (); /* Release the commit charge for the mapping. */ - (void) mprotect (mem, size, PROT_NONE); + err = mprotect (mem, size, PROT_NONE); + if (err) + emacs_abort (); #endif } -static void -dump_mmap_discard_contents (struct dump_memory_map *map) -{ - if (map->mapping) - dump_discard_mem (map->mapping, map->spec.size); -} - static void dump_mmap_reset (struct dump_memory_map *map) { @@ -4985,6 +4983,13 @@ dump_mmap_release (struct dump_memory_map *map) dump_mmap_reset (map); } +static void +dump_mmap_discard_contents (struct dump_memory_map *map) +{ + if (map->mapping) + dump_mmap_release (map); +} + /* Allows heap-allocated dump_mmap to "free" maps individually. */ struct dump_memory_map_heap_control_block { @@ -5072,7 +5077,9 @@ dump_mmap_contiguous_heap (struct dump_memory_map *maps, int nr_maps, static void dump_mmap_release_mps (struct dump_memory_map *map) { - emacs_abort (); + /* FIXME: igc_on_pdump_loaded "knows" that DS_DISCARDABLE is unused. + Maybe come up with a nicer API. + */ } /* Implement dump_mmap using mps_reserve and read. */ -- 2.39.2 --=-=-=--