<div dir="ltr"><div><div>Hi Russel,<br><br></div>I have the debug log with MMU faults and the logs you requested. I tried to obtain the stacktrace with backtrace, I have included -rdynamic flag to the compiler, but got no luck...<br></div>The debug code is like this:<br>void etnaviv_accel_CopyNtoN(DrawablePtr pSrc, DrawablePtr pDst,<br>    GCPtr pGC, BoxPtr pBox, int nBox, int dx, int dy, Bool reverse,<br>    Bool upsidedown, Pixel bitPlane, void *closure)<br>{<br>...<br>    extent.y2 = min_t(short, pDst->y + pDst->height,<br>                 pSrc->y + pSrc->height - dy);<br><br>    if (etna_bo_size(<a href="http://op.dst.bo">op.dst.bo</a>) == 98304) {<br>        int nptrs;<br>        syslog(LOG_ERR, "dx: %d, op.dst.offset.x:%d\n", dx, op.dst.offset.x);<br>        syslog(LOG_ERR, "dy: %d, op.dst.offset.y:%d\n", dy, op.dst.offset.y);<br>        syslog(LOG_ERR, "final op.src.offset.x=%d, op.src.offset.y=%d\n",<br>            op.dst.offset.x, op.dst.offset.y);<br>        syslog(LOG_ERR, "pDst->x=%d, pSrc->x=%d\n", pDst->x, pSrc->x);<br>        syslog(LOG_ERR, "pDst->y=%d, pSrc->y=%d\n", pDst->y, pSrc->y);<br>        syslog(LOG_ERR, "pDst->width=%d, pSrc->width=%d\n", pDst->width, pSrc->width);<br>        syslog(LOG_ERR, "pDst->height=%d, pSrc->height=%d\n", pDst->height, pSrc->height);<br>        syslog(LOG_ERR, "extent(x1=%d, y1=%d, x2=%d, y2=%d)\n", extent.x1, extent.y1,<br>            extent.x2, extent.y2);<br>        if (pGC) {<br>            syslog(LOG_ERR, "pGC is not NULL\n");<br>        } else {<br>            syslog(LOG_ERR, "pGC is NULL\n");<br>        }<br>        nptrs = backtrace(buffer, 100);    <br>        strings = backtrace_symbols(buffer, nptrs);<br>        if (strings == NULL) {<br>            syslog(LOG_ERR, "Error getting stacktrace\n");<br>        } else {<br>            for (j = 0; j < nptrs; j++) {<br>                syslog(LOG_ERR, "[%d] %s\n", j, strings[j]);<br>            }<br>            free(strings);<br>        }<br>    }<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 2, 2017 at 8:16 PM, Luís Mendes <span dir="ltr"><<a href="mailto:luis.p.mendes@gmail.com" target="_blank">luis.p.mendes@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><br></div>I will do that. The strange thing is that I don't think etnaviv_accel_CopyNtoN(...) is the culprit of the MMU faults, because if I switch from hardware accelerated copyNtoN to software unaccelerated copyNtoN<br></div> the MMU faults still occur, if I remember... However the corruption in the menus and dialog windows can be fixed by switching to unaccelerated copyNtoN.<br><br></div>I will include the debug log when I have it.<br><br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 2, 2017 at 4:18 PM, Russell King - ARM Linux <span dir="ltr"><<a href="mailto:linux@armlinux.org.uk" target="_blank">linux@armlinux.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Thu, Nov 02, 2017 at 03:33:19PM +0000, Luís Mendes wrote:<br>
> Hi Russel,<br>
><br>
> The requested file follows in attachment.<br>
<br>
</span>Thanks - see below.<br>
<span><br>
> On Thu, Nov 2, 2017 at 3:20 PM, Russell King - ARM Linux <<br>
> <a href="mailto:linux@armlinux.org.uk" target="_blank">linux@armlinux.org.uk</a>> wrote:<br>
><br>
> > On Thu, Nov 02, 2017 at 03:05:38PM +0000, Luís Mendes wrote:<br>
</span>> > > [   56.173613] etnaviv-gpu 134000.gpu: MMU fault status 0x00000002<br>
<span>> > > [   56.179955] etnaviv-gpu 134000.gpu: MMU 0 fault addr 0x0803ffc0<br>
> > > [   56.185905] etnaviv-gpu 134000.gpu: MMU 1 fault addr 0x00000000<br>
> > > [   56.191843] etnaviv-gpu 134000.gpu: MMU 2 fault addr 0x00000000<br>
> > > [   56.197778] etnaviv-gpu 134000.gpu: MMU 3 fault addr 0x00000000<br>
> > > [   59.258367] etnaviv-gpu 134000.gpu: hangcheck detected gpu lockup!<br>
> > > [   59.265910] etnaviv-gpu 134000.gpu:      completed fence: 378<br>
> > > [   59.271737] etnaviv-gpu 134000.gpu:      active fence: 383<br>
> > > [   59.277930] etnaviv-gpu 134000.gpu: hangcheck recover!<br>
> > ><br>
</span><div><div class="m_-7945870202994557392h5">> > > === Register dump<br>
> > > 0000000c = 000000df<br>
> > > 00000000 = 00040900<br>
> > > 00000004 = 7ffffff8 Idle: FE- DE- PE- SH+ PA+ SE+ RA+ TX+ VG+ IM+ FP+ TS+<br>
> > > 00000008 = 00002200<br>
> > > 00000014 = ffffffff<br>
> > > 00000018 = 14010000<br>
> > > 0000001c = e02c7eca<br>
> > > 00000020 = 00000320<br>
> > > 00000024 = 00005303<br>
> > > 00000028 = 20140510<br>
> > > 0000002c = 20353900<br>
> > > 00000034 = e9399eff<br>
> > > 00000038 = e9399eff<br>
> > > 00000070 = 00000000<br>
> > > 00000100 = 00140021<br>
> > > 00000104 = 00000000<br>
> > > 00000108 = 000000fa<br>
> > > 0000010c = 00000000<br>
> > > 00000400 = 00000000<br>
> > > 00000404 = 00000000<br>
> > > 00000408 = 00000000<br>
> > > 0000040c = 00000000<br>
> > > 00000410 = 00000000<br>
> > > 00000414 = 3c000000<br>
> > > 00000418 = 00000000<br>
> > > 0000041c = 00000000<br>
> > > 00000420 = 00000000<br>
> > > 00000424 = 00000000<br>
> > > 00000428 = 00000000<br>
> > > 0000042c = 00030000<br>
> > > 00000480 = 000000a8<br>
> > > 0000065c = 00000001<br>
> > > 00000660 = 00000803 Cmd: [load0 DMA: idle Fetch: valid] Req idle Cal idle<br>
> > > 00000664 = 00001230 Command DMA address<br>
> > > 00000668 = 00000040 FE fetched word 0<br>
> > > 0000066c = 00000000 FE fetched word 1<br>
> > > 00000670 = 00000000<br>
> ><br>
> > Okay, so we stopped at 0x1230.<br>
> ><br>
> > > ===<br>
> > > Buffers<br>
> > ><br>
> > >  Num Name  IOVA     Size<br>
> > >    0 reg   00000000 00000128      296<br>
> > >    1 mmu   00000000 00401000  4198400<br>
> > >    2 ring  00000000 00001000     4096<br>
> > > *  3 cmd   00001000 00000320      800<br>
> > >    4 cmd   00002000 00000190      400<br>
> > >    5 cmd   00003000 00000320      800<br>
> > >    6 cmd   00004000 00000190      400<br>
> > >    7 cmd   00005000 00000188      392<br>
> > >    8 bomap 00000000 000018f0     6384<br>
> > >    9 bo    00040000 00300000  3145728<br>
> > >   10 bo    00340000 00001000     4096<br>
> > >   11 bo    00341000 00002000     8192<br>
> > >   12 bo    02e60000 00001000     4096<br>
> > >   13 bo    030c3000 00001000     4096<br>
> > >   14 bo    030c4000 00001000     4096<br>
> > >   15 bo    030c5000 00018000    98304<br>
> > > Checking MMU entries... ok<br>
> ><br>
> > So, buffer 3 is the command buffer we were processing, it's only 800<br>
> > bytes long.  You should find that along side the log file, called<br>
> > "cmd-00001000.bin".  Please send me this file.  Thanks.<br>
<br>
</div></div>Here's the decoded command buffer.  My decoding includes the buffer<br>
addresses, and the ranges that the GPU would access based on the draw<br>
commands.  We have from the table above, the addresses and sizes of<br>
the bos currently mapped into the GPU's IOVA space.<br>
<br>
00000: 08050480 00341000  LDST 0x1200=0x00341000<br>
                000000a0  LDST 0x1204=0x000000a0<br>
                00000000  LDST 0x1208=0x00000000<br>
                06000046  LDST 0x120c=0x06000046<br>
                fe48fd53  LDST 0x1210=0xfe48fd53<br>
00018: 0804048a 00040000  LDST 0x1228=0x00040000<br>
                00001000  LDST 0x122c=0x00001000<br>
                00000000  LDST 0x1230=0x00000000<br>
                00002006  LDST 0x1234=0x00002006<br>
00030: 0801049f 00000000  LDST 0x127c=0x00000000<br>
00038: 08030497 0030cccc  LDST 0x125c=0x0030cccc<br>
                01b802ad  LDST 0x1260=0x01b802ad<br>
                01e002d5  LDST 0x1264=0x01e002d5<br>
00048: 20000100 00000000<br>
                            01b802ad 01e002d5  0,0,40,40 -> 685,440,725,480<br>
        Blit: Dst:00040000 Src:00341000 Clip 685,440,725,480<br>
        Src: 0x00341000-0x003429a0 (40,40)<br>
        Dst: 0x00040000-0x00220b54 (725,480)<br>
<br>
  Looks fine - source bo 11, destination bo 9.<br>
<br>
00058: 08010001 00000000  LDST 0x0004=0x00000000<br>
00060: 08010001 00000000  LDST 0x0004=0x00000000<br>
00068: 08010001 00000000  LDST 0x0004=0x00000000<br>
<br>
  This is the GC320 "workaround":<br>
<br>
00070: 08050480 00340000  LDST 0x1200=0x00340000<br>
                00000040  LDST 0x1204=0x00000040<br>
                00000000  LDST 0x1208=0x00000000<br>
                03000043  LDST 0x120c=0x03000043<br>
                ffff0000  LDST 0x1210=0xffff0000<br>
00088: 0804048a 00340000  LDST 0x1228=0x00340000<br>
                00000040  LDST 0x122c=0x00000040<br>
                00000000  LDST 0x1230=0x00000000<br>
                00002003  LDST 0x1234=0x00002003<br>
000a0: 0801049f 00000000  LDST 0x127c=0x00000000<br>
000a8: 08030497 0030cccc  LDST 0x125c=0x0030cccc<br>
                00010000  LDST 0x1260=0x00010000<br>
                00020001  LDST 0x1264=0x00020001<br>
000b8: 20000100 00000000<br>
                            00010000 00020001  0,0,1,1 -> 0,1,1,2<br>
        Blit: Dst:00340000 Src:00340000 Clip 0,1,1,2<br>
        Src: 0x00340000-0x00340044 (1,1)<br>
        Dst: 0x00340000-0x00340084 (1,2)<br>
<br>
  Looks fine, source and destination bo 10.<br>
<br>
000c8: 08010e03 00000008  LDST 0x380c=0x00000008 Flush PE2D<br>
000d0: 08010e02 00000701  LDST 0x3808=0x00000701 SEM FE -> PE<br>
000d8: 48000000 00000701  STALL FE -> PE<br>
000e0: 18000000(00000008)  NOP<br>
000e8: 18000000(00000701)  NOP<br>
000f0: 18000000(00000701)  NOP<br>
000f8: 18000000(00000701)  NOP<br>
00100: 18000000(000b0022)  NOP<br>
00108: 18000000(00000000)  NOP<br>
00110: 18000000(00000000)  NOP<br>
00118: 18000000(00000000)  NOP<br>
00120: 18000000(00100020)  NOP<br>
00128: 18000000(00000000)  NOP<br>
00130: 18000000(000b002a)  NOP<br>
00138: 18000000(00000000)  NOP<br>
00140: 18000000(00000000)  NOP<br>
00148: 18000000(00000000)  NOP<br>
00150: 18000000(00000018)  NOP<br>
00158: 18000000(00000000)  NOP<br>
00160: 18000000(000b0032)  NOP<br>
00168: 18000000(00000000)  NOP<br>
00170: 18000000(00000000)  NOP<br>
00178: 18000000(00000000)  NOP<br>
00180: 08050480 00040000  LDST 0x1200=0x00040000<br>
                00001000  LDST 0x1204=0x00001000<br>
                00000000  LDST 0x1208=0x00000000<br>
                06000046  LDST 0x120c=0x06000046<br>
                ffe80000  LDST 0x1210=0xffe80000<br>
00198: 0804048a 030c5000  LDST 0x1228=0x030c5000<br>
                00001000  LDST 0x122c=0x00001000<br>
                00000000  LDST 0x1230=0x00000000<br>
                00002006  LDST 0x1234=0x00002006<br>
001b0: 0802049f 00ff0001  LDST 0x127c=0x00ff0001<br>
                01000100  LDST 0x1280=0x01000100<br>
001c0: 080304b2 ff000000  LDST 0x12c8=0xff000000<br>
                00000000  LDST 0x12cc=0x00000000<br>
                00000000  LDST 0x12d0=0x00000000<br>
001d0: 08030497 0030cccc  LDST 0x125c=0x0030cccc<br>
                00000000  LDST 0x1260=0x00000000<br>
                00180400  LDST 0x1264=0x00180400<br>
001e0: 20000100 00000000<br>
                            00000000 00180400  0,-24,1024,0 -> 0,0,1024,24<br>
        Blit: Dst:030c5000 Src:00040000 Clip 0,0,1024,24<br>
        Src: 0x00040000-0x00041000 (1024,0)<br>
        Dst: 0x030c5000-0x030de000 (1024,24)<br>
<br>
  Source bo 9, which looks fine.<br>
  Destination bo 15, which is:<br>
<span><br>
    15 bo    030c5000 00018000    98304<br>
<br>
</span>  It's final IOVA is the sum of those two, which is 0x030dd000.<br>
<br>
  The destination stride is from state 0x122c, which is 4096.<br>
  Destination start address was 0x030c5000 in state 0x1228, and the<br>
  bottom y in the draw command is 24.  That gives 98304 bytes, but<br>
  there's also the right x as well, which is another 1024 pixels on<br>
  top, giving an extra 4096 bytes on top of that.<br>
<br>
  So, it looks like this bo was too small for the draw command<br>
  being requested.<br>
<br>
  It's interesting to note that the MMU fault addresses don't seem to<br>
  correspond - my GC320 is a MMUv1 GPU, and doesn't have MMU faults,<br>
  so I don't know how to interpret these.<br>
<br>
001f0: 08010001 00000000  LDST 0x0004=0x00000000<br>
001f8: 08010001 00000000  LDST 0x0004=0x00000000<br>
00200: 08010001 00000000  LDST 0x0004=0x00000000<br>
00208: 08050480 00340000  LDST 0x1200=0x00340000<br>
                00000040  LDST 0x1204=0x00000040<br>
                00000000  LDST 0x1208=0x00000000<br>
                03000043  LDST 0x120c=0x03000043<br>
                ffff0000  LDST 0x1210=0xffff0000<br>
00220: 0804048a 00340000  LDST 0x1228=0x00340000<br>
                00000040  LDST 0x122c=0x00000040<br>
                00000000  LDST 0x1230=0x00000000<br>
                00002003  LDST 0x1234=0x00002003<br>
<br>
<============stalled mid-loading above states=============><br>
<br>
(rest of dump truncated as nor relevant.)<br>
<br>
The obvious question is - why did we end up with a 1024x24 blit copy<br>
into a buffer that was actually too small.  This also happens to be<br>
the hardware clip window size as well (which should be bounded by the<br>
source and destination drawable sizes and the copy position.)<br>
<br>
I suspect if we set extent.y2 one less, we'll get problems with the<br>
last line being corrupted on other copies.<br>
<br>
Any chance of adding some debug to etnaviv_accel_CopyNtoN() to trace<br>
which copy this is?  We know that the destination bo is 98304 in<br>
size, so use that to avoid printing out too much.  The destination<br>
bo should be in <a href="http://op.dst.bo" rel="noreferrer" target="_blank">op.dst.bo</a>, and its size can be found via<br>
etna_bo_size(<a href="http://op.dst.bo" rel="noreferrer" target="_blank">op.dst.bo</a>).<br>
<div class="m_-7945870202994557392HOEnZb"><div class="m_-7945870202994557392h5"><br>
Thanks.<br>
<br>
--<br>
RMK's Patch system: <a href="http://www.armlinux.org.uk/developer/patches/" rel="noreferrer" target="_blank">http://www.armlinux.org.uk/dev<wbr>eloper/patches/</a><br>
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up<br>
According to <a href="http://speedtest.net" rel="noreferrer" target="_blank">speedtest.net</a>: 8.21Mbps down 510kbps up<br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>