Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to start on powerpc with 64KB pages #302

Open
weinholt opened this issue May 10, 2018 · 3 comments
Open

Fails to start on powerpc with 64KB pages #302

weinholt opened this issue May 10, 2018 · 3 comments

Comments

@weinholt
Copy link
Contributor

Chez Scheme does not start on ppc32le when running on a powerpc with 64KB pages:

cp -p -f ../boot/ppc32le/petite.boot ../boot/ppc32le/sbb
cp -p -f ../boot/ppc32le/scheme.boot ../boot/ppc32le/scb
make all
echo '(reset-handler abort)'\
             '(base-exception-handler (lambda (c) (fresh-line) (display-condition c) (newline) (reset)))'\
             '(keyboard-interrupt-handler (lambda () (display "interrupted---aborting\n") (reset)))'\
             '(optimize-level 3)'\
             '(debug-level 0)'\
             '(generate-inspector-information #f)'\
             '(subset-mode (quote system))'\
             '(compile-file "cmacros.ss" "cmacros.so")'\
             | ../bin/ppc32le/scheme -q
bytes_per_segment (2000) < S_pagesize (10000)
make[4]: *** [Mf-base:328: cmacros.so] Error 1
make[3]: *** [Mf-base:160: allx] Error 2
make[2]: *** [Mf-base:173: bootstrap] Error 2
make[1]: *** [Makefile:21: build] Error 2
make: *** [Makefile:19: build] Error 2
$ getconf PAGESIZE                                
65536
@dybvig
Copy link
Member

dybvig commented May 10, 2018

I'm not sure we actually count on segments being at least as big as pages. At one point we did, since we enabled or disabled execution of code from within a segment or segments as they switched to or from holding code objects, and memory protection works at the page level. I don't remember any other reason for the requirement. So I would first try simply removing the failing test from scheme.c.

If this doesn't work, it would be nice to figure out why and try to fix the problem, but an easier solution would be to change the segment size from 8k to 64k bytes by fiddling with the segment offset constants in cmacros.ss. This will lead to greater memory fragmentation, so it's not an ideal solution.

@weinholt
Copy link
Contributor Author

Removing the failing test did not go well:

Starting program: /home/weinholt/chezscheme-9.5+dfsg/build/bin/ppc32le/scheme 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/powerpc-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x2002eab8 in add_trigger_ephemerons_to_repending (pe=0x3e8017) at gc.c:2058
2058	  ptr last_pe = pe, next_pe = EPHEMERONTRIGGERNEXT(pe);
(gdb) p pe
$1 = (ptr) 0x3e8017

Upping the bytes-per-segment to 64K gives something that appears to work.

@weinholt
Copy link
Contributor Author

It doesn't crash when running under valgrind. Here's a log produced with commit 5bdf715 and the "bytes_per_segment < S_pagesize" check commented out.

ppc32-valgrind.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants