ibm-capi/pslse

command size getting changed to 0

Closed this issue · 1 comments

Howdy,

I'm getting an issue where the ah_csize of my AFU output is getting dropped to 0 in PSLSE. Here's some of the debug output that shows this issue.

DEBUG:afu0.0:JOB code=0x90 ea=0x0000000001e77080
DEBUG:afu0.0:JOB running
DEBUG:afu0.0:COMMAND tag=0xff code=0x0a00 size=0x80 abt=0 cch=0x0000
DEBUG:afu0.0:COMMAND tag=0xff addr=0x0000000001e77080
WARNING:AFU issued command with invalid size 0!
DEBUG:afu0.0:RESPONSE tag=0xff code=0x8

I run into this on on both the memcopy example from ibm developerworks and my test repo at https://github.com/KennethWilke/capi-tinker

Sometimes this bug doesn't occur, it seems to happen less often with the debug build.

I'll try to find out more if I can

Here are some backtraces from watching pslse in gdb, looks like the size variable is getting dropped to 0 in _add_read() before the call to _aligned()

Starting program: /home/kwilke/workprojects/pslse/pslse/pslse 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
INFO:PSLSE version 1.002 compiled @ Jan 25 2016 19:13:41
INFO:PSLSE parm values:
    Seed     = 13
    Timeout  = 10 seconds
    Response = 16%
    Paged    = 3%
    Reorder  = 86%
    Buffer   = 82%
INFO:Attempting to connect AFU: afu0.0 @ localhost:32768
PSL_SOCKET: Using PSL protocol level : 0.9908.0
[New Thread 0xf7de1b40 (LWP 4293)]
DEBUG:afu0.0:JOB code=0x80 ea=0x0000000000000000
INFO:Clocking afu0.0
DEBUG:afu0.0:JOB done
DEBUG:afu0.0:DESC READ64 word=0x00000
DEBUG:afu0.0:DESC ACK data=0x0000000100010010
DEBUG:afu0.0:DESC READ64 word=0x00008
DEBUG:afu0.0:DESC ACK data=0x0000000000000001
DEBUG:afu0.0:DESC READ64 word=0x0000a
DEBUG:afu0.0:DESC ACK data=0x0000000000000100
DEBUG:afu0.0:DESC READ64 word=0x0000c
DEBUG:afu0.0:DESC ACK data=0x0000000000000000
DEBUG:afu0.0:DESC READ64 word=0x0000e
DEBUG:afu0.0:DESC ACK data=0x0100000000000000
DEBUG:afu0.0:DESC READ64 word=0x00010
DEBUG:afu0.0:DESC ACK data=0x0000000000000000
DEBUG:afu0.0:DESC READ64 word=0x00012
DEBUG:afu0.0:DESC ACK data=0x0000000000000000
INFO:Started PSLSE server, listening on kbawx:16384
INFO:Connection from 127.0.0.1
DEBUG:SOCKET IN:0x50534c5345
DEBUG:SOCKET IN:0x0102
DEBUG:SOCKET OUT:0x018000
INFO:127.0.0.1 connected
[New Thread 0xf73ffb40 (LWP 4296)]
DEBUG:SOCKET IN:0x02
DEBUG:SOCKET IN:0x00
DEBUG:SOCKET OUT:0x020000f507
DEBUG:SOCKET IN:0x04
DEBUG:SOCKET IN:0x0064
DEBUG:SOCKET OUT:0x0400
DEBUG:afu0.0:JOB code=0x80 ea=0x0000000000000000
[Thread 0xf73ffb40 (LWP 4296) exited]
DEBUG:afu0.0:JOB done
DEBUG:SOCKET IN:0x05
DEBUG:SOCKET IN:0x0000000001f5a080
DEBUG:SOCKET OUT:0x05
DEBUG:afu0.0:JOB code=0x90 ea=0x0000000001f5a080
DEBUG:afu0.0:JOB running
DEBUG:afu0.0:COMMAND tag=0xff code=0x0a00 size=0x80 abt=0 cch=0x0000
DEBUG:afu0.0:COMMAND tag=0xff addr=0x0000000001f5a080
[Switching to Thread 0xf7de1b40 (LWP 4293)]

Breakpoint 3, _parse_cmd (cmd=0x806bad0, command=2560, tag=255, addr=32874624, 
    size=128, abort=0, handle=0, latency=1) at cmd.c:329
329     uint16_t irq = (uint16_t) (addr & IRQ_MASK);
(gdb) backtrace
#0  _parse_cmd (cmd=0x806bad0, command=2560, tag=255, addr=32874624, size=128, abort=0, handle=0, latency=1) at cmd.c:329
#1  0x0804d47b in handle_cmd (cmd=0x806bad0, parity_enabled=1, latency=1) at cmd.c:516
#2  0x0804a9eb in _handle_afu (psl=0x806aa08) at psl.c:138
#3  0x0804ae00 in _psl_loop (ptr=0x806aa08) at psl.c:247
#4  0xf7fa51aa in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#5  0xf7ecdfde in clone () from /lib/i386-linux-gnu/libc.so.6
(gdb) c
Continuing.

Breakpoint 4, _add_read (cmd=0x806bad0, handle=0, tag=255, command=2560, abort=0, addr=32874624, size=128) at cmd.c:296
296     if (!_aligned(addr, size)) {
(gdb) backtrace
#0  _add_read (cmd=0x806bad0, handle=0, tag=255, command=2560, abort=0, addr=32874624, size=128) at cmd.c:296
#1  0x0804cf6f in _parse_cmd (cmd=0x806bad0, command=2560, tag=255, addr=32874624, size=128, abort=0, handle=0, latency=1) at cmd.c:365
#2  0x0804d47b in handle_cmd (cmd=0x806bad0, parity_enabled=1, latency=1) at cmd.c:516
#3  0x0804a9eb in _handle_afu (psl=0x806aa08) at psl.c:138
#4  0x0804ae00 in _psl_loop (ptr=0x806aa08) at psl.c:247
#5  0xf7fa51aa in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#6  0xf7ecdfde in clone () from /lib/i386-linux-gnu/libc.so.6
(gdb) c
Continuing.

Breakpoint 5, _aligned (addr=32874624, size=0) at cmd.c:253
253     if ((size == 0) || (size & (size - 1))) {
(gdb) backtrace
#0  _aligned (addr=32874624, size=0) at cmd.c:253
#1  0x0804cb9d in _add_read (cmd=0x806bad0, handle=0, tag=255, command=2560, abort=0, addr=32874624, size=128) at cmd.c:296
#2  0x0804cf6f in _parse_cmd (cmd=0x806bad0, command=2560, tag=255, addr=32874624, size=128, abort=0, handle=0, latency=1) at cmd.c:365
#3  0x0804d47b in handle_cmd (cmd=0x806bad0, parity_enabled=1, latency=1) at cmd.c:516
#4  0x0804a9eb in _handle_afu (psl=0x806aa08) at psl.c:138
#5  0x0804ae00 in _psl_loop (ptr=0x806aa08) at psl.c:247
#6  0xf7fa51aa in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#7  0xf7ecdfde in clone () from /lib/i386-linux-gnu/libc.so.6