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 codegen Date: Sat, 15 Jun 2024 09:10:42 +0200 Message-ID: References: <86r0d21tqj.fsf@gnu.org> <877cetgqiz.fsf_-_@gmail.com> <87wmmsg2e4.fsf@gmail.com> <878qz8ezn4.fsf@gmail.com> <8734pfgb51.fsf@gmail.com> <86ikybyd2h.fsf@gnu.org> <87v82bebc6.fsf@gmail.com> <86wmmrwf86.fsf@gnu.org> <86r0czwdmc.fsf@gnu.org> <87jzire36a.fsf@gmail.com> <86o782wwl4.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="29464"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eller.helmut@gmail.com, acorallo@gnu.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Jun 15 09:11:37 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 1sINZZ-0007Vs-Gj for ged-emacs-devel@m.gmane-mx.org; Sat, 15 Jun 2024 09:11:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sINYo-00070C-AU; Sat, 15 Jun 2024 03:10:50 -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 1sINYm-0006zj-7J for emacs-devel@gnu.org; Sat, 15 Jun 2024 03:10:48 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sINYk-0007bt-In; Sat, 15 Jun 2024 03:10:47 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a6efae34c83so370963166b.0; Sat, 15 Jun 2024 00:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718435444; x=1719040244; 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=Pg2Jg/ZZJo8HFXJeMy9bj7FXQ/PbVaLsg5ihuhwWXhU=; b=JeiU/NTGRkSf9V/YJC3gTQ8ZMjZHVTsJlGpGSl2pz6i3q3u4NFFo2hX+LGr91J96ZT ppSwTl+3itmlTW/UhdhGf4FFyRlUBx6+I095AZfb0rfupEX9kcwgwMbTFmV4oCgomFKP g4LngM0hXcWc5B8YADsb4/pyPZ70TkTMAhshLhln/oPJGXB0NyLYDOQ+25DPr3wtaKs/ NV0TTysJRCvdqRBFQ34/8ACARcFClQz31QQVWjCf4t1h5/uWmpuBIa8cF5eXm2x0Gsm2 WaL+sN2eE6XG9jNyTg20PYB9g+MES6aoZzgG5wKjaN+N3MrDrz103jnG5gs91YBI/hoP Vvtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718435444; x=1719040244; 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=Pg2Jg/ZZJo8HFXJeMy9bj7FXQ/PbVaLsg5ihuhwWXhU=; b=glt8+UN+w17tHWqWaHcKrL8wdofRliyn8iI6CAmA35xp/lQPn9TUnIgqVuAOVG9MkF +YvgQ57aCdODVEFN9O6f6TLvDDP4E0vj90Jikv7ayYN8d26KdIQ7Z8LMF/aoBZKlm34Z ou7TtHHVaUjbE3xO9e4X5FTk8wTWSvoRik/EiMzIanSJAGyuEIrVoPPviQs7gIJhFGbg aOH7kWn4eq/+dZIuDmp7HjWW5xoiBsRpcOqhghmkLfdh8ScSdOUZbvKPc0MJjkDkVGkm 8ngi/4A+2ZfBxM7JYpGNaVfhMTO64AnKwxmy+xWUGqZj/gUfXWfRfnNe9n//Y6mzr1nP Ujjg== X-Forwarded-Encrypted: i=1; AJvYcCWL1SdQLouG6XTAOmjdmpxgA+CAP9daHZeBB1P6MdDUAzZRp+lyxU7IO+z0lffTaFJX/0bQtfN68HLyASF3C4IwmUyJXAKlyNanhDBXvBUV65KdGyrr X-Gm-Message-State: AOJu0YzaRKYljeFcL/+eEq9iTm/+Dbg2Sd2MDjXtK5wm9IwrP8sWAVBP uQ78VSV+xYhUReNotBDEHfWcUkrAb2pmYARgRgla1TzKGtILhIHwt9FdHg== X-Google-Smtp-Source: AGHT+IEbPwdDJ/cvdGt2lGIa55B1iwCTSKBiuXX+Ko1+LlolHMsUeSXiXsX8TCZodMfRgPb0eF0GpQ== X-Received: by 2002:a17:906:a447:b0:a6e:372c:cc5e with SMTP id a640c23a62f3a-a6f60dc7faamr265118966b.61.1718435443456; Sat, 15 Jun 2024 00:10:43 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36be1.dip0.t-ipconnect.de. [217.227.107.225]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed3679sm264930066b.122.2024.06.15.00.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 00:10:43 -0700 (PDT) In-Reply-To: <86o782wwl4.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Jun 2024 09:26:15 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x634.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:320103 Archived-At: Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: Eli Zaretskii , acorallo@gnu.org, emacs-devel@gnu.org >> Date: Fri, 14 Jun 2024 21:50:26 +0200 >>=20 >> Helmut Eller writes: >>=20 >> > My hypothesis is that discard_dump is the problem. The hot section >> > probably contains something that isn't properly copied and >> > dump_discard_mem seems to be a bit different on Windows. Why it even >> > works on Linux is a mystery to me :-). >>=20 >> Pdumper can use, among other methods, mmap'd files. In that case >> munmap'ing could write changes back to disk. So pdumper rather marks the >> region as not needed. At least that's how I understand it. > > But it doesn't protect the region from being accessed, AFAIU. By > contrast, on MS-Windows we do this: > > (void) VirtualProtect (mem, size, PAGE_NOACCESS, &old_prot); > > which will then cause an access violation if any address within the > region is accessed in any way (read or write). If you do the same > with mmap and PROT_NONE, does the build still work and does the built > Emacs succeed to start? I'd rather if you comment out the discard_dump in igc.c, in mirror_dump and see if that's the problem. The GDB output you showed give me no hint to it. The fwd causing the problem should point to Emacs' data segment, not the dump. The variable is a DEFVAR_BOOL. > Note that originally pdumper.c called dump_discard_mem only for > sections considered discardable: > > sections[DS_DISCARDABLE].spec =3D (struct dump_memory_map_spec) > { > .fd =3D dump_fd, > .size =3D header->cold_start - adj_discardable_start, > .offset =3D adj_discardable_start, > .protection =3D DUMP_MEMORY_ACCESS_READWRITE, > }; > [...] > dump_mmap_discard_contents (§ions[DS_DISCARDABLE]); > > Whereas the code in igc.c seems to discard all of the memory loaded > from the pdumper file, or am I missing something? It's the hot section that igc discards. The pdumper can only discard the relocs which are not longer needed once they have been processed. The theory is that it's no longer needed since we have made a copy.