[ppc] Default stack size on ppc64

Richard W.M. Jones rjones at redhat.com
Wed Mar 25 22:22:09 UTC 2015


On Wed, Mar 25, 2015 at 08:03:31PM +0000, David Woodhouse wrote:
> On Wed, 2015-03-25 at 19:45 +0000, Richard W.M. Jones wrote:
> > On Wed, Mar 25, 2015 at 06:30:25PM +0000, David Woodhouse wrote:
> > > If the compiler is single-threaded, and increasing the stack ulimit 
> > > fixes the problem, that implies that the default stack ulimit is less 
> > > than the 8MiB-64KiB that it takes to reach the guard page...
> > 
> > Just so I'm clear, is the stack supposed to grow down automatically
> > (ie. does the stack automatically use MAP_GROWSDOWN), or is OCaml
> > supposed to do something when the stack hits the guard page?
> > 
> > I guess it's also possible that an OCaml stack frame is so big that it
> > skips the guard page, or that GCC does some kind of stack "filling" to
> > trigger the guard page which OCaml does not do.
> 
> This is easy to trigger, right? Can you catch it in gdb and 't a a bt'

I won't bore you with the full stack trace, but the top and bottom
and some interesting registers are below.

It confirms a few things:

 - Stack is overflowing because of a highly recursive function (which
   does eventually bottom-out, if you give it a big enough stack).

 - Compiler is single threaded.

 - %r1 (at top) - %r1 (at bottom) is approximately 8 MB

 - Avg. size of each stack frame is ~ 168 bytes.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW
-------------- next part --------------
GNU gdb (GDB) Fedora 7.7.1-17.fc20
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "ppc64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/rjones/local/bin/ocamlopt.opt...(no debugging symbols found)...done.
[?1034h(gdb) run
Starting program: /home/rjones/local/bin/ocamlopt.opt -c -g -w a -I camlp4/import -warn-error A-3 -I camlp4/config -I camlp4/boot -o camlp4/boot/camlp4boot.cmx camlp4/boot/camlp4boot.ml

Program received signal SIGSEGV, Segmentation fault.
0x00000000100587cc in .camlCSEgen__compare_1011 ()
Missing separate debuginfos, use: debuginfo-install glibc-2.18-12.fc20.ppc64p7
(gdb) t a a bt

Thread 1 (process 48132):
#0  0x00000000100587cc in .camlCSEgen__compare_1011 ()
#1  0x0000000010007b48 in .caml_apply2 ()
#2  0x0000000010263e44 in .camlMap__find_1091 ()
#3  0x0000000010058d4c in .camlCSEgen__find_equation_1124 ()
#4  0x0000000010057624 in .camlCSEgen__fun_1397 ()
#5  0x0000000010007a84 in .caml_apply3 ()
#6  0x0000000010057c5c in .camlCSEgen__fun_1397 ()
#7  0x0000000010007a84 in .caml_apply3 ()
#8  0x0000000010057c5c in .camlCSEgen__fun_1397 ()
#9  0x0000000010007a84 in .caml_apply3 ()
#10 0x000000001005799c in .camlCSEgen__fun_1397 ()

[these two stack frames are repeated over and over]

#49873 0x0000000010007a85 in .caml_apply3 ()
#49874 0x0000000010057d51 in .camlCSEgen__fun_1397 ()
#49875 0x0000000010007a85 in .caml_apply3 ()
#49876 0x0000000010057d51 in .camlCSEgen__fun_1397 ()
#49877 0x0000000010007a85 in .caml_apply3 ()
#49878 0x0000000010057315 in .camlCSEgen__fun_1406 ()
#49879 0x0000000010006a41 in .caml_send1 ()
#49880 0x0000000010059ea9 in .camlCSE__fundecl_1029 ()
#49881 0x000000001007c59d in .camlAsmgen__compile_fundecl_1050 ()
#49882 0x000000001007c895 in .camlAsmgen__compile_phrase_1053 ()
#49883 0x000000001007bbe9 in .camlAsmgen__fun_1285 ()
#49884 0x0000000010258a01 in .camlList__iter_1061 ()
#49885 0x000000001007bc2d in .camlAsmgen__fun_1290 ()
#49886 0x000000001007cc49 in .camlAsmgen__compile_implementation_1063 ()
#49887 0x0000000010082da9 in .camlOptcompile__fun_1274 ()
#49888 0x0000000010083525 in .camlOptcompile__comp_1048 ()
#49889 0x0000000010083de1 in .camlOptcompile__implementation_1040 ()
#49890 0x0000000010007cd9 in .camlOptmain__process_implementation_file_1011 ()
#49891 0x0000000010008445 in .camlOptmain__process_file_1016 ()
#49892 0x00000000100084c5 in .camlOptmain__anonymous_1022 ()
#49893 0x0000000010283ec5 in .camlArg__parse_argv_dynamic_1078 ()
#49894 0x0000000010284161 in .camlArg__parse_1140 ()
#49895 0x00000000100092bd in .camlOptmain__main_1474 ()
#49896 0x000000001000a785 in .camlOptmain__entry ()
#49897 0x0000000010003439 in caml_startup.code_begin ()
#49898 0x00000000102b633d in .caml_start_program ()
#49899 0x00000000102b6a30 in .caml_main ()
#49900 0x000000001029da60 in .main ()
(gdb) info registers
r0             0x10007b48	268467016
r1             0x3fffff800030	70368735789104
r2             0x1048c4e0	273204448
r3             0x3fffb7fa8fc0	70367535861696
r4             0x3fffb7fa9810	70367535863824
r5             0x103a5f34	272260916
r6             0x5	5
r7             0x3fffb7d0f750	70367533135696
r8             0x1	1
r9             0x3fffb7fa8fd8	70367535861720
r10            0xc00	3072
r11            0x10007b18	268466968
r12            0x0	0
r13            0x803935c3e0	550715638752
r14            0x100587c4	268797892
r15            0x3fffb7fa8fc0	70367535861696
r16            0x800	2048
r17            0x1005737c	268792700
r18            0xc00	3072
r19            0x9	9
r20            0x3fffb7fa9268	70367535862376
r21            0x3fffb7fa9158	70367535862104
r22            0x3fffb7fa9120	70367535862048
r23            0x13	19
r24            0x13	19
r25            0x4c	76
r26            0x9	9
r27            0x3fffa63f3f18	70367238373144
r28            0x3fffb7fa9048	70367535861832
r29            0x3fffff8001e0	70368735789536
r30            0x3fffb7dd1000	70367533928448
r31            0x3fffb7fa8fb8	70367535861688
pc             0x100587cc	0x100587cc <.camlCSEgen__compare_1011+8>
msr            0x900000000000d032	10376293541461676082
cr             0x22000824	570427428
lr             0x10007b48	0x10007b48 <.caml_apply2+48>
ctr            0x100587c4	268797892
xer            0x20000000	536870912
orig_r3        0x10007b44	268467012
trap           0x300	768
(gdb) frame 49878
#49878 0x0000000010057315 in .camlCSEgen__fun_1406 ()
(gdb) info registers
r0             0x10007b48	268467016
r1             0x3fffffffdbd0	70368744168400
r2             0x1048c4e0	273204448
r3             0x3fffb7fa8fc0	70367535861696
r4             0x3fffb7fa9810	70367535863824
r5             0x103a5f34	272260916
r6             0x5	5
r7             0x3fffb7d0f750	70367533135696
r8             0x1	1
r9             0x3fffb7fa8fd8	70367535861720
r10            0xc00	3072
r11            0x10007b18	268466968
r12            0x0	0
r13            0x803935c3e0	550715638752
r14            0x100587c4	268797892
r15            0x3fffb7fa8fc0	70367535861696
r16            0x800	2048
r17            0x1005737c	268792700
r18            0xc00	3072
r19            0x9	9
r20            0x3fffb7fa9268	70367535862376
r21            0x3fffb7fa9158	70367535862104
r22            0x3fffb7fa9120	70367535862048
r23            0x13	19
r24            0x13	19
r25            0x4c	76
r26            0x9	9
r27            0x3fffa63f3f18	70367238373144
r28            0x3fffb7fa9048	70367535861832
r29            0x3fffff8001e0	70368735789536
r30            0x3fffb7dd1000	70367533928448
r31            0x3fffb7fa8fb8	70367535861688
pc             0x10057315	0x10057315 <.camlCSEgen__fun_1406+69>
msr            0x900000000000d032	10376293541461676082
cr             0x22000824	570427428
lr             0x10057315	0x10057315 <.camlCSEgen__fun_1406+69>
ctr            0x100587c4	268797892
xer            0x20000000	536870912
orig_r3        0x10007b44	268467012
trap           0x300	768
(gdb) frame 49900
#49900 0x000000001029da60 in .main ()
(gdb) info registers
r0             0x10007b48	268467016
r1             0x3fffffffed10	70368744172816
r2             0x1048c4e0	273204448
r3             0x3fffb7fa8fc0	70367535861696
r4             0x3fffb7fa9810	70367535863824
r5             0x103a5f34	272260916
r6             0x5	5
r7             0x3fffb7d0f750	70367533135696
r8             0x1	1
r9             0x3fffb7fa8fd8	70367535861720
r10            0xc00	3072
r11            0x10007b18	268466968
r12            0x0	0
r13            0x803935c3e0	550715638752
r14            0x100587c4	268797892
r15            0x3fffb7fa8fc0	70367535861696
r16            0x800	2048
r17            0x1005737c	268792700
r18            0xc00	3072
r19            0x9	9
r20            0x3fffb7fa9268	70367535862376
r21            0x3fffb7fa9158	70367535862104
r22            0x3fffb7fa9120	70367535862048
r23            0x0	0
r24            0x0	0
r25            0x0	0
r26            0x0	0
r27            0x803934fe00	550715588096
r28            0x8039350d18	550715591960
r29            0x803934f930	550715586864
r30            0x0	0
r31            0x0	0
pc             0x1029da60	0x1029da60 <.main+20>
msr            0x900000000000d032	10376293541461676082
cr             0x22000824	570427428
lr             0x1029da60	0x1029da60 <.main+20>
ctr            0x100587c4	268797892
xer            0x20000000	536870912
orig_r3        0x10007b44	268467012
trap           0x300	768
(gdb) quit
A debugging session is active.

	Inferior 1 [process 48132] will be killed.

Quit anyway? (y or n) 


More information about the ppc mailing list