unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Gerd Möllmann" <gerd.moellmann@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eller.helmut@gmail.com,  emacs-devel@gnu.org
Subject: Re: MPS: Loaded pdump
Date: Thu, 09 May 2024 13:20:15 +0200	[thread overview]
Message-ID: <m2le4jb5ao.fsf@pro2.fritz.box> (raw)
In-Reply-To: <86wmo35jxb.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 May 2024 14:00:48 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Gerd Möllmann <gerd.moellmann@gmail.com>
>> Cc: Emacs Devel <emacs-devel@gnu.org>
>> Date: Thu, 09 May 2024 12:52:03 +0200
>> 
>> I feel more and more that the handling of the loaded pdump with MPS as
>> it is now is not sustainable, and would like ask you for your ideas.
>> 
>> What we do now is make the hot part of the dump an ambig root.
>
> Is this specific to native-compilation, or is it not?

It's not specific to native comp.

> If it isn't, why does it come up only now?  We've been running
> MPS-built Emacs for a week at least; if that produces problems, can
> you tell what problems and how can that be reproduced?

As I said, I thought we could get away with the root, and that finding
an alternative would be an optimization to be done later. (I think
admin/igc.org has some ideas regarding the loaded pdump from some time
ago.)

What I wrote are fundamental problems, so they can't be reproduced.

> IOW, I'd like to understand better why we need to make the hot part of
> the dump an ambiguous root before we consider solutions.

I think this mail I sent has the answer:

  Helmut Eller <eller.helmut@gmail.com> writes:

  >> @Helmut: Did we already talk about what the problem with the frame in
  >> the loaded pdump could be? Sorry that I don't remember.
  >
  > I never heard of that before.

  As the famous philosopher Manuel Manousakis says: Katastrophe!
  🙂

  Okay, I think one can understand this best when I try to describe what
  the pdumper does. Let's start with generating a pdump. I'll try to leave
  out as much details as a can.

  When we create a pdump, we start by allocating 3 big memory blocks which
  I'll call H (hot), C (cold), and R (relocs).

  We then traverse the graph of live objects like the old GC, starting
  from known roots. Each newly encountered object is copyied to H or C in
  binary form. C is used for leaf objects like strings and floats, H for
  the rest.

  The copying of objects is done by invoking type-specific functions,
  example dump_float, dump_vector, etc.

  We cannot use memcpy for the copying because we need more information
  when the pdump is loaded, namely relocation information, which goes to
  R. Relocation is necessary because both Emacs' DATA segment as well as
  H/C may end up at different addresses in a new process.

  Relocation info is recorded in S, and tells us where in the copied
  objects Lisp_Objects or pointers are that need patching when loaded.

  At the end, we write H, C, S to one big file.

  Good. Now let's load that file. We mmap the whole file and now have H',
  C', R' in the new process. C' and R'are good to go (In C are leaf
  objects). H' is patches according to the reloc info that is in S'.

  At the end of the relocation H' is ready to use. Some additional setup
  and initalizations, and we are good to go. I won't describe these.

  Thing is that H' now contains real Lisp objects of basically all types.
  Lisp objects contain references, so I make H' an ambig root.

  So far so good, but some Lisp objects contain not only references to
  other Lisp objects but also pointers to malloc'd memory. Not initially,
  in the dump, but during their lifetime.

  And finally we have reached face_cache.

  If initial_frame is an object in H', fix_frame won't be called for it.
  It cannot because the dump is not part of the MPS memory, and is instead
  traced ambigously as part of the big blob H'.

  Does that make any sense?






  reply	other threads:[~2024-05-09 11:20 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 10:52 MPS: Loaded pdump Gerd Möllmann
2024-05-09 11:00 ` Eli Zaretskii
2024-05-09 11:20   ` Gerd Möllmann [this message]
2024-05-09 12:28 ` Helmut Eller
2024-05-09 13:37   ` Gerd Möllmann
2024-05-09 16:10     ` Helmut Eller
2024-05-09 16:43       ` Gerd Möllmann
2024-05-09 17:57         ` Helmut Eller
2024-05-09 18:10           ` Gerd Möllmann
2024-05-09 13:38 ` Helmut Eller
2024-05-09 14:18   ` Gerd Möllmann
2024-05-09 15:01     ` Helmut Eller
2024-05-09 15:07       ` Gerd Möllmann
2024-05-10  7:59         ` Gerd Möllmann
2024-05-10  8:09           ` Helmut Eller
2024-05-10  8:35             ` Gerd Möllmann
2024-05-10  8:51               ` Helmut Eller
2024-05-10  8:54                 ` Gerd Möllmann
2024-05-10 10:25             ` Eli Zaretskii
2024-05-10 11:31               ` Gerd Möllmann
2024-05-10 12:52                 ` Gerd Möllmann
2024-05-10 13:37                   ` Helmut Eller
2024-05-10 13:59                     ` Gerd Möllmann
2024-05-10 14:31                       ` Helmut Eller
2024-05-10 14:36                         ` Gerd Möllmann
2024-05-13  9:11                   ` Gerd Möllmann
2024-05-14  8:23                     ` Gerd Möllmann
2024-05-14 14:22                       ` Helmut Eller
2024-05-14 15:46                         ` Gerd Möllmann
2024-05-14 17:49                           ` Eli Zaretskii
2024-05-14 18:10                             ` Gerd Möllmann
2024-05-16  4:25                       ` Gerd Möllmann
2024-05-16  8:36                         ` Helmut Eller
2024-05-16  8:46                           ` Gerd Möllmann
2024-05-16  9:01                           ` Gerd Möllmann
2024-05-16  9:31                             ` Helmut Eller
2024-05-16  9:42                               ` Gerd Möllmann
2024-05-16  9:54                                 ` Gerd Möllmann
2024-05-16 12:43                                   ` Helmut Eller
2024-05-16 12:47                                     ` Gerd Möllmann
2024-05-16 12:08                                 ` Eli Zaretskii
2024-05-16 12:27                                   ` Gerd Möllmann
2024-05-16 12:07                               ` Eli Zaretskii
2024-05-16 12:21                                 ` Gerd Möllmann
2024-05-16 12:27                                   ` Eli Zaretskii
2024-05-16 12:43                                     ` Gerd Möllmann
2024-05-16 14:09                         ` Helmut Eller
2024-05-16 14:24                           ` Gerd Möllmann
2024-05-16 15:48                             ` Eli Zaretskii
2024-05-16 16:56                             ` Andrea Corallo
2024-05-16 17:27                               ` Gerd Möllmann
2024-05-16 17:50                                 ` Andrea Corallo
2024-05-16 20:03                                 ` Helmut Eller
2024-05-17  4:04                                   ` Gerd Möllmann
2024-05-17  6:09                                   ` Eli Zaretskii
2024-05-18 18:55                                     ` Helmut Eller
2024-05-18 20:16                                       ` Andrea Corallo
2024-05-19  5:27                                         ` Eli Zaretskii
2024-05-19  3:48                                       ` Gerd Möllmann
2024-05-19  6:39                                         ` Eli Zaretskii
2024-05-09 18:24       ` Gerd Möllmann
2024-05-09 18:35         ` Gerd Möllmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2le4jb5ao.fsf@pro2.fritz.box \
    --to=gerd.moellmann@gmail.com \
    --cc=eliz@gnu.org \
    --cc=eller.helmut@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).