On Sat, Dec 28 2019, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
> On Sat, Dec 28 2019, Jeremie Courreges-Anglas <jca@wxcvbn.org> wrote:
>
> [...]
>
>> I removed test_fiber.rb and am now running the tests again, trying to
>> sort out why I'm hitting resource exhaustion...
>
> Build restarted with DEBUG=-g.
Back to this test_fiber.rb problem. Looks like sparc register windows
handling has been fragile for some time in ruby land:
https://redmine.ruby-lang.org/issues/5244
The source code mentions a discussion with David Miller:
https://marc.info/?l=linux-sparc&m=131914569320660&w=2
I have tried to use "ta 0x03" instead of "flushw [....%o7]" in
coroutine_flush_register_windows(), it didn't help.
I couldn't find a core dump for test_fiber.rb, pointers for proper
debugging welcome. Instead, here's a simple reproducer.
Let me know if you need more input.
--8<--
billy $ egdb --args ruby27 -e 'Fiber.new{Fiber.yield}.resume'
[...]
Reading symbols from ruby27...done.
(gdb) r
Starting program: /usr/local/bin/ruby27 -e Fiber.new\{Fiber.yield\}.resume
[New thread 126043]
Thread 1 received signal SIGBUS, Bus error.
0x00000018329daa38 in coroutine_save_stack (context=<optimized out>) at coroutine/copy/Context.c:64
64 }
(gdb) bt
#0 0x00000018329daa38 in coroutine_save_stack (context=<optimized out>) at coroutine/copy/Context.c:64
#1 0x515fc14d280fde77 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) l
59 context->used = size;
60 }
61
62 // Save registers / restore point:
63 return _setjmp(context->state);
64 }
65
66 __attribute__((noreturn, noinline))
67 static void coroutine_restore_stack_padded(struct coroutine_context *context, void * buffer) {
68 void *stack_pointer = &stack_pointer;
(gdb) disas
Dump of assembler code for function coroutine_save_stack:
0x00000018329da9a0 <+0>: save %sp, -208, %sp
0x00000018329da9a4 <+4>: sethi %hi(0x17c00), %g1
0x00000018329da9a8 <+8>: ldx [ %i0 ], %g4
0x00000018329da9ac <+12>: add %fp, 0x7df, %g2
0x00000018329da9b0 <+16>: sethi %hi(0x432c00), %l7
0x00000018329da9b4 <+20>: call 0x18329da7b0
0x00000018329da9b8 <+24>: add %l7, 0x2e4, %l7 ! 0x432ee4
0x00000018329da9bc <+28>: or %g1, 0x2f0, %g1
0x00000018329da9c0 <+32>: stx %g2, [ %fp + 0x7df ]
0x00000018329da9c4 <+36>: ldx [ %l7 + %g1 ], %g3
0x00000018329da9c8 <+40>: ldx [ %g3 ], %g1
0x00000018329da9cc <+44>: stx %g1, [ %fp + 0x7e7 ]
0x00000018329da9d0 <+48>: clr %g1
0x00000018329da9d4 <+52>: brz,pn %g4, 0x18329daa8c <coroutine_save_stack+236>
0x00000018329da9d8 <+56>: sethi %hi(0x17800), %g1
0x00000018329da9dc <+60>: ldx [ %i0 + 0x18 ], %g1
0x00000018329da9e0 <+64>: brz,pn %g1, 0x18329daab4 <coroutine_save_stack+276>
0x00000018329da9e4 <+68>: sethi %hi(0x17800), %g1
0x00000018329da9e8 <+72>: call 0x18329da7a0 <coroutine_flush_register_windows>
0x00000018329da9ec <+76>: nop
0x00000018329da9f0 <+80>: ldx [ %i0 + 0x18 ], %o2
0x00000018329da9f4 <+84>: ldx [ %fp + 0x7df ], %o1
0x00000018329da9f8 <+88>: cmp %o2, %o1
0x00000018329da9fc <+92>: bgu %xcc, 0x18329daa5c <coroutine_save_stack+188>
0x00000018329daa00 <+96>: ldx [ %i0 + 8 ], %g1
0x00000018329daa04 <+100>: sub %o1, %o2, %l0
0x00000018329daa08 <+104>: cmp %l0, %g1
0x00000018329daa0c <+108>: bgu,pn %xcc, 0x18329daadc <coroutine_save_stack+316>
0x00000018329daa10 <+112>: mov %o2, %o1
0x00000018329daa14 <+116>: ldx [ %i0 ], %o0
0x00000018329daa18 <+120>: call 0x1832cfdf00 <memcpy@plt>
0x00000018329daa1c <+124>: mov %l0, %o2
0x00000018329daa20 <+128>: stx %l0, [ %i0 + 0x10 ]
0x00000018329daa24 <+132>: call 0x1832d059e0 <_setjmp@plt>
0x00000018329daa28 <+136>: add %i0, 0x20, %o0
0x00000018329daa2c <+140>: sra %o0, 0, %i0
0x00000018329daa30 <+144>: sethi %hi(0x17c00), %g1
0x00000018329daa34 <+148>: or %g1, 0x2f0, %g1 ! 0x17ef0
=> 0x00000018329daa38 <+152>: ldx [ %l7 + %g1 ], %g2
0x00000018329daa3c <+156>: ldx [ %fp + 0x7e7 ], %g3
0x00000018329daa40 <+160>: ldx [ %g2 ], %g1
0x00000018329daa44 <+164>: xor %g3, %g1, %g3
0x00000018329daa48 <+168>: clr %g1
0x00000018329daa4c <+172>: brnz,pn %g3, 0x18329daa80 <coroutine_save_stack+224>
0x00000018329daa50 <+176>: sethi %hi(0x17400), %g1
0x00000018329daa54 <+180>: rett %i7 + 8
0x00000018329daa58 <+184>: nop
0x00000018329daa5c <+188>: sub %o2, %o1, %l0
0x00000018329daa60 <+192>: cmp %l0, %g1
0x00000018329daa64 <+196>: bgu,pn %xcc, 0x18329dab08 <coroutine_save_stack+360>
0x00000018329daa68 <+200>: sethi %hi(0x17800), %g1
0x00000018329daa6c <+204>: ldx [ %i0 ], %o0
0x00000018329daa70 <+208>: call 0x1832cfdf00 <memcpy@plt>
0x00000018329daa74 <+212>: mov %l0, %o2
---Type <return> to continue, or q <return> to quit---
-->8--
--
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
No comments:
Post a Comment