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 07:57:45 +0200 Message-ID: References: <87v823xvq1.fsf@localhost> <86cyobmmhc.fsf@gnu.org> <87r0crxung.fsf@localhost> <87le2zxsqx.fsf@localhost> 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="38117"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , emacs-devel@gnu.org, eller.helmut@gmail.com To: Ihor Radchenko Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Jun 21 07:58:01 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 1sKXHc-0009el-OV for ged-emacs-devel@m.gmane-mx.org; Fri, 21 Jun 2024 07:58:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKXHV-0000Wd-Ce; Fri, 21 Jun 2024 01:57:53 -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 1sKXHS-0000Vn-W5 for emacs-devel@gnu.org; Fri, 21 Jun 2024 01:57:51 -0400 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKXHQ-00018d-Ol; Fri, 21 Jun 2024 01:57:50 -0400 Original-Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-57d20d89748so1515151a12.0; Thu, 20 Jun 2024 22:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718949467; x=1719554267; 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=BtoCFiA7+P0Qm9U6ASyWsBJ77srS4yilYTHVcvcPOYI=; b=QUhIkF52TXPU0KQPaYnNr8CIBDSd2YeiPBGMupoVgbn1FygsG1IgxZqE0N81rrN0Pz S7CCDOI1AITRfZxFZMiYev5y1fCwajpmpg1302g+tV201Q/lk179Y6v5AV5qwgZAys0a dtPH2Bz7eP68DCkH57pO5wZUQ+ld/jEHff2+crLKlEMtCE5jqiyvzSEVFfPKd0HORiR/ VCZlKWqTAHWvEr58WjQIsuBUf0L4t3djOGJOumGUvlvZBze6ryEZDhYVmUDiaDiZ5inv yIWgkRoOxs1tqUIt/FI6vAVuFFu/8+oJKemdeDrHZey2X/HsDz2EbFVsBnm31WemZEDv GBeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718949467; x=1719554267; 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=BtoCFiA7+P0Qm9U6ASyWsBJ77srS4yilYTHVcvcPOYI=; b=E+VPrMS7VtfgTvOB15WoYNXnQEpdQnUdmV53eGQp3MGLh/TqF4TVNmdkMMkbfEM0OE /xX3jjJKoq6NgSAZiNtLwU5UNYbU5if71syZWUpU689w4EiL0krvKB1hCPp+Ip8+2pkQ laPLIvNGMUblu+I72H5zEn23XLZSoLTLCd3fwFOQ/vl4aY3qzfavw+QWElwyWPnpQEpv K2dotFjp8oadyLSAFD/18d1A5ee6jDRPF/8TbNZJcrk2gtqvOz0KLeEfakoN+bfxI0fx Ji9EuwZeLGVJRof7FolBKZ9SKmQmTWxQr62RhPlrdZBkOcHBm9NV9o5nxhy+u9lXmZfp 9TmA== X-Forwarded-Encrypted: i=1; AJvYcCU7cfPlN/1K4+8bBr8KbKlUSIDrdQ+6HEPGwOQmV9nHxtVbVUVGtqdGnlwC53xkx+ClFMNdUgs/cDh0gieLSvk/cQa9 X-Gm-Message-State: AOJu0YwdGWQu0CdbFAm0T7nEM8kko7FQqw4ybtgs0tdhVQ4kdvI3VVDH l6JRukmaTR0caIPkmxPzjbc2W7QuRX5Z9Do0F2CNx7fn9Gc6WJEvsnSYTA== X-Google-Smtp-Source: AGHT+IEL4mjCjE1s/cmpxUIuqioKs+zn5vpsE7w63FVHyfbDa+RlEEzK6TBZ2Q9qqfXH8pItB2ZsWQ== X-Received: by 2002:a17:906:3793:b0:a6c:7181:4ffe with SMTP id a640c23a62f3a-a6fab7cd5admr370003466b.66.1718949466433; Thu, 20 Jun 2024 22:57:46 -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-a6fcf560cc0sm44747266b.178.2024.06.20.22.57.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 22:57:46 -0700 (PDT) In-Reply-To: <87le2zxsqx.fsf@localhost> (Ihor Radchenko's message of "Thu, 20 Jun 2024 20:29:42 +0000") Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52f.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:320356 Archived-At: Ihor Radchenko writes: > Gerd M=C3=B6llmann writes: > >>>>> Steps to reproduce: >>>>>=20 >>>>> 1. emacs -Q doc/misc/org.org >>>>> 2. M-x profiler-start RET cpu RET >>>>> 3. M-: (org-element-parse-buffer) RET >> ... >> Thanks, that's the latest and greatest. I'm afraid that means it's time >> to get out the debugger :-). > Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. > 0x00005555558b53d6 in PSEUDOVECTORP (a=3D0x7fffe6dde715, code=3D32) at /h= ome/yantar92/Git/emacs/src/lisp.h:1104 > 1104 && ((XUNTAG (a, Lisp_Vectorlike, union vectorlike_header)->size > (gdb) bt > #0 0x00005555558b53d6 in PSEUDOVECTORP (a=3D0x7fffe6dde715, code=3D32) a= t /home/yantar92/Git/emacs/src/lisp.h:1104 > #1 0x00005555558b567f in CLOSUREP (a=3D0x7fffe6dde715) at /home/yantar92= /Git/emacs/src/lisp.h:3368 > #2 0x00005555558b5b80 in trace_hash (trace=3D0x555556329400, depth=3D16)= at profiler.c:189 > #3 0x00005555558b5eab in record_backtrace (plog=3D0x555555fd0960 , = count=3D2) at profiler.c:291 > #4 0x00005555558b60fd in add_sample (plog=3D0x555555fd0960 , count= =3D2) at profiler.c:353 > #5 0x00005555558b6153 in handle_profiler_signal (signal=3D27) at profile= r.c:396 > #6 0x0000555555777704 in deliver_process_signal (sig=3D27, handler=3D0x5= 555558b6104 ) at sysdep.c:1758 > #7 0x00005555558b6175 in deliver_profiler_signal (signal=3D27) at profil= er.c:402 > #8 0x00007ffff5855470 in () at /lib64/libc.so.6 > #9 0x00007ffff5922d07 in mprotect () at /lib64/libc.so.6 4. MPS tries to un-mprotect something and receives a signal. From the the profiler.c frames, I'd say it's a SIGPROF. And while handling the signal, we are doing Lisp stuff. All while MPS is currently trying to scan. Hm, I must admit that I don't know how that's supposed to work ATM. Very strictly speaking, a signal handler is not allowed to do very much... Or maybe the problem is that the signal gets delivered to Emacs in the first place? (AFAIK, MPS doesn't use signals on macOS, but Mach exceptions, so things probably work pretty different here, like on Windows.) I guess we need some Linux expert here. > #10 0x000055555595c498 in ProtSet (base=3D0x7fffe2d86000, limit=3D, mode=3D0) at protix.c:105 > #11 0x000055555594f7dd in shieldProtLower (shield=3Dshield@entry=3D0x7fff= f7fc2700, seg=3Dseg@entry=3D0x7fffe8001988, mode=3Dmode@entry=3D3) at shiel= d.c:305 > #12 0x0000555555950417 in ShieldExpose (arena=3Darena@entry=3D0x7ffff7fc2= 000, seg=3Dseg@entry=3D0x7fffe8001988) at shield.c:737 > #13 0x000055555595f045 in amcSegFix (seg=3D0x7fffe8001988, ss=3D0x7ffffff= fa690, refIO=3D0x7fffffffa0f8) at poolamc.c:1594 > #14 0x0000555555948d31 in SegFix (seg=3D0x7fffe8001988, ss=3D0x7fffffffa6= 90, refIO=3D0x7fffffffa0f8) at seg.c:793 > #15 0x00005555559550c0 in _mps_fix2 (mps_ss=3D0x7fffffffa698, mps_ref_io= =3D0x7fffffffa160) at trace.c:1433 > #16 0x00005555558b83af in fix_lisp_obj (ss=3D0x7fffffffa698, pobj=3D0x7ff= feb08b038) at igc.c:675 3. We are trying to "fix" a single Lisp_Object. > #17 0x00005555558b86b5 in fix_array (ss=3D0x7fffffffa698, array=3D0x7fffe= b08b038, n=3D4) at igc.c:801 > #18 0x00005555558babf6 in fix_vectorlike (ss=3D0x7fffffffa698, v=3D0x7fff= eb08b030) at igc.c:1554 > #19 0x00005555558bc692 in fix_vector (ss=3D0x7fffffffa698, v=3D0x7fffeb08= b030) at igc.c:2086 > #20 0x00005555558ba757 in dflt_scan_obj (ss=3D0x7fffffffa698, base_start= =3D0x7fffeb08b028, base_limit=3D0x7fffeb08c608, closure=3D0x0) at igc.c:1481 > #21 0x00005555558baac4 in dflt_scanx (ss=3D0x7fffffffa698, base_start=3D0= x7fffeb08b000, base_limit=3D0x7fffeb08c608, closure=3D0x0) at igc.c:1531 > #22 0x00005555558bab63 in dflt_scan (ss=3D0x7fffffffa698, base_start=3D0x= 7fffeb08b000, base_limit=3D0x7fffeb08c608) at igc.c:1542 > #23 0x000055555595568f in TraceScanFormat (ss=3Dss@entry=3D0x7fffffffa690= , base=3Dbase@entry=3D0x7fffeb08b000, limit=3Dlimit@entry=3D0x7fffeb08c608)= at trace.c:1539 > #24 0x000055555595f609 in amcSegScan (totalReturn=3D0x7fffffffa68c, > seg=3D0x7fffe8289870, ss=3D0x7fffffffa690) at poolamc.c:1427 2. MPS starts scanning the default pool and invokes our dflt_scan function. > #25 0x0000555555948c6f in SegScan (totalReturn=3DtotalReturn@entry=3D0x7f= ffffffa68c, seg=3Dseg@entry=3D0x7fffe8289870, ss=3Dss@entry=3D0x7fffffffa69= 0) at seg.c:775 > #26 0x0000555555954ae1 in traceScanSegRes (ts=3Dts@entry=3D1, rank=3Drank= @entry=3D1, arena=3Darena@entry=3D0x7ffff7fc2000, seg=3Dseg@entry=3D0x7fffe= 8289870) at trace.c:1205 > #27 0x0000555555954beb in traceScanSeg (ts=3Dts@entry=3D1, rank=3D1, aren= a=3Darena@entry=3D0x7ffff7fc2000, seg=3Dseg@entry=3D0x7fffe8289870) at trac= e.c:1267 > #28 0x0000555555954d63 in TraceSegAccess (arena=3Darena@entry=3D0x7ffff7f= c2000, seg=3Dseg@entry=3D0x7fffe8289870, mode=3Dmode@entry=3D1) at trace.c:= 1320 > #29 0x000055555594959b in SegWholeAccess (seg=3D0x7fffe8289870, arena=3D0= x7ffff7fc2000, addr=3D0x7fffeb08c590, mode=3D1, context=3D0x7fffffffa8d0) a= t seg.c:1262 > #30 0x0000555555948309 in SegAccess > (seg=3D0x7fffe8289870, arena=3Darena@entry=3D0x7ffff7fc2000, addr=3Da= ddr@entry=3D0x7fffeb08c590, mode=3D1, context=3Dcontext@entry=3D0x7fffffffa= 8d0) at seg.c:723 > #31 0x0000555555928f51 in ArenaAccess (addr=3D0x7fffeb08c590, mode=3D, mode@entry=3D3, context=3Dcontext@entry=3D0x7fffffffa8d0) at g= lobal.c:671 > #32 0x000055555595c6e2 in sigHandle (sig=3D, info=3D0x7fff= ffffabf0, uap=3D0x7fffffffaac0) at protsgix.c:97 > #33 0x00007ffff5855470 in () at /lib64/libc.so.6 1. So here in copy_intervals happens something that invokes MPS. Not 100% sure but it looks to me that it is because we hit an MPS barrier (mprotected area). > #34 0x00005555558a1dd8 in copy_intervals (tree=3D0x7fffe651f500, start=3D= 587977, length=3D11) at intervals.c:2247 > #35 0x00005555558a1ee6 in copy_intervals_to_string (string=3D0x7fffeae8df= b4, buffer=3D0x7fffe4275e90, position=3D587977, length=3D11) at intervals.c= :2272 > #36 0x0000555555800168 in make_buffer_string_both (start=3D587977, start_= byte=3D588047, end=3D587988, end_byte=3D588058, props=3Dtrue) at editfns.c:= 1615 > #37 0x00005555557ffe53 in make_buffer_string (start=3D587977, end=3D58798= 8, props=3Dtrue) at editfns.c:1554 > #38 0x0000555555800302 in Fbuffer_substring (start=3D0x23e326, end=3D0x23= e352) at editfns.c:1666 > #39 0x0000555555870a1d in exec_byte_code (fun=3D0x7fffe446a465, args_temp= late=3D771, nargs=3D3, args=3D0x7fffe2200928) at bytecode.c:1516 > --Type for more, q to quit, c to continue without paging--c > #40 0x00005555558158df in funcall_lambda (fun=3D0x7fffe5b0842d, nargs=3D0= , arg_vector=3D0x7fffffffb880) at eval.c:3270 > #41 0x0000555555815762 in apply_lambda (fun=3D0x7fffe5b0842d, args=3D0x0,= count=3D...) at eval.c:3233 > #42 0x0000555555813c6d in eval_sub (form=3D0x7fffe6dde54b) at eval.c:2663 > #43 0x0000555555813170 in Feval (form=3D0x7fffe6dde54b, lexical=3D0x30) a= t eval.c:2475 > #44 0x0000555555815303 in funcall_subr (subr=3D0x555555f2d380 , nu= margs=3D2, args=3D0x7fffe22001b0) at eval.c:3181 > #45 0x000055555586d392 in exec_byte_code (fun=3D0x7fffe3170b85, args_temp= late=3D513, nargs=3D2, args=3D0x7fffe2200320) at bytecode.c:827 > #46 0x00005555558158df in funcall_lambda (fun=3D0x7fffe6dde75d, nargs=3D0= , arg_vector=3D0x7fffffffc110) at eval.c:3270 > #47 0x0000555555814d61 in funcall_general (fun=3D0x7fffe6dde75d, numargs= =3D0, args=3D0x7fffffffc110) at eval.c:3062 > #48 0x0000555555814fc6 in Ffuncall (nargs=3D1, args=3D0x7fffffffc108) at = eval.c:3111 > #49 0x000055555580da20 in call0 (fn=3D0x7fffe6dde75d) at /home/yantar92/G= it/emacs/src/lisp.h:3559 > #50 0x0000555555810cc9 in Fhandler_bind_1 (nargs=3D3, args=3D0x7fffe22001= 28) at eval.c:1487 > #51 0x000055555581552d in funcall_subr (subr=3D0x555555f2d240 , numargs=3D3, args=3D0x7fffe2200128) at eval.c:3202 > #52 0x000055555586d392 in exec_byte_code (fun=3D0x7fffe31696c5, args_temp= late=3D1025, nargs=3D4, args=3D0x7fffffffc990) at bytecode.c:827 > #53 0x00005555558158df in funcall_lambda (fun=3D0x7fffe31696c5, nargs=3D4= , arg_vector=3D0x7fffffffc970) at eval.c:3270 > #54 0x0000555555814d61 in funcall_general (fun=3D0x7fffe31696c5, numargs= =3D4, args=3D0x7fffffffc970) at eval.c:3062 > #55 0x0000555555814fc6 in Ffuncall (nargs=3D5, args=3D0x7fffffffc968) at = eval.c:3111 > #56 0x000055555580a532 in Ffuncall_interactively (nargs=3D5, args=3D0x7ff= fffffc968) at callint.c:250 > #57 0x000055555581552d in funcall_subr (subr=3D0x555555f2ca80 , numargs=3D5, args=3D0x7fffffffc968) at eval.c:3202 > #58 0x0000555555814d15 in funcall_general (fun=3D0x555555f2ca85 , numargs=3D5, args=3D0x7fffffffc968) at eval.c:3058 > #59 0x0000555555814fc6 in Ffuncall (nargs=3D6, args=3D0x7fffffffc960) at = eval.c:3111 > #60 0x000055555581446d in Fapply (nargs=3D3, args=3D0x7fffffffcbf0) at ev= al.c:2783 > #61 0x000055555580a92c in Fcall_interactively (function=3D0x2aaa8d1c2b08,= record_flag=3D0x0, keys=3D0x7fffe6d46865) at callint.c:342 > #62 0x0000555555815339 in funcall_subr (subr=3D0x555555f2cac0 , numargs=3D3, args=3D0x7fffe2200070) at eval.c:3183 > #63 0x000055555586d392 in exec_byte_code (fun=3D0x7fffe36e5c7d, args_temp= late=3D1025, nargs=3D1, args=3D0x7fffffffd350) at bytecode.c:827 > #64 0x00005555558158df in funcall_lambda (fun=3D0x7fffe36e5c7d, nargs=3D1= , arg_vector=3D0x7fffffffd348) at eval.c:3270 > #65 0x0000555555814d61 in funcall_general (fun=3D0x7fffe36e5c7d, numargs= =3D1, args=3D0x7fffffffd348) at eval.c:3062 > #66 0x0000555555814fc6 in Ffuncall (nargs=3D2, args=3D0x7fffffffd340) at = eval.c:3111 > #67 0x000055555574d687 in command_loop_1 () at keyboard.c:1551 > #68 0x00005555558113c9 in internal_condition_case (bfun=3D0x55555574ce24 = , handlers=3D0x90, hfun=3D0x55555574c355 ) at ev= al.c:1622 > #69 0x000055555574ca71 in command_loop_2 (handlers=3D0x90) at keyboard.c:= 1169 > #70 0x0000555555810872 in internal_catch (tag=3D0x12300, func=3D0x5555557= 4ca47 , arg=3D0x90) at eval.c:1301 > #71 0x000055555574ca03 in command_loop () at keyboard.c:1147 > #72 0x000055555574bef7 in recursive_edit_1 () at keyboard.c:755 > #73 0x000055555574c0a3 in Frecursive_edit () at keyboard.c:838 > #74 0x00005555557482fc in main (argc=3D2, argv=3D0x7fffffffd838) at emacs= .c:2643