I do believe that this is a pmap issue.

I just got hands on an Allwinner A20 and suffered the same issues:
pool_setlowat crashing randomly, same for ahci and so on.

I believe we are not syncing the PTEs correctly.

Here’s the snippet from PTE_SYNC(), but PTE_SYNC_RANGE() has
the same issue:

#define PTE_SYNC(pte)                                                   \
do {                                                                    \
        if (PMAP_NEEDS_PTE_SYNC) {                                      \
                paddr_t pa;                                             \
                cpu_drain_writebuf();                                   \
                cpu_dcache_wb_range((vaddr_t)(pte), sizeof(pt_entry_t));\
                if (cpu_sdcache_enabled()) {                            \
                (void)pmap_extract(pmap_kernel(), (vaddr_t)(pte), &pa); \
                cpu_sdcache_wb_range((vaddr_t)(pte), (paddr_t)(pa),     \
                    sizeof(pt_entry_t));                                \
                };                                                      \
                cpu_drain_writebuf();                                   \
        }                                                               \
} while (/*CONSTCOND*/0)

I believe that when we change things in the pagetables, we need to make
sure the tables are synced before we’re going to use them.  In our case
we believe that we are using uncached pagetables, which means that
every write will directly hit the tables.

But that does not have an affect on the write buffer.  The write buffer is still
there and has to be cleared manually.  If it isn’t, and something accesses
an area which was just mapped, then we’re fucked.

Therefore I firmly believe that the cpu_drain_writebuf() call has to be made
regardless of PMAP_NEEDS_PTE_SYNC and that it has to be called before
that if-clause.

Doing that fixes my issues.

\Patrick

> Am 09.10.2014 um 22:55 schrieb SASANO Takayoshi <u...@mx5.nisiq.net>:
> 
> Hello,
> 
> Here is the log of new image.
> Booting with "-c" option, UKC still hangs up.
> 
> I hope the log helps debugging.
> 
> Regards,
> 
> -- 
> SASANO Takayoshi <u...@mx5.nisiq.net>
> 
> U-Boot SPL 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04)
> Board: Bananapi
> DRAM: 1024 MiB
> CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
> spl: not an uImage at 1600
> 
> 
> U-Boot 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04) Allwinner 
> Technology
> 
> CPU:   Allwinner A20 (SUN7I)
> Board: Bananapi
> I2C:   ready
> DRAM:  1 GiB
> MMC:   SUNXI SD/MMC: 0
> *** Warning - bad CRC, using default environment
> 
> In:    serial
> Out:   serial
> Err:   serial
> Net:   dwmac.1c50000
> Hit any key to stop autoboot:  0 
> reading uEnv.txt
> 118 bytes read in 16 ms (6.8 KiB/s)
> Loaded environment from uEnv.txt
> Running uenvcmd ...
> reading bsd.umg
> 7386560 bytes read in 364 ms (19.4 MiB/s)
> ## Booting kernel from Legacy Image at 60000000 ...
>   Image Name:   boot
>   Image Type:   ARM Linux Kernel Image (uncompressed)
>   Data Size:    7386496 Bytes = 7 MiB
>   Load Address: 40800000
>   Entry Point:  40800000
>   Verifying Checksum ... OK
>   Loading Kernel Image ... OK
> 
> Starting kernel ...
> 
> 
> OpenBSD/sunxi booting ...
> arg0 0x0 arg1 0x10bb arg2 0x40000100
> atag core flags 0 pagesize 0 rootdev 0
> atag cmdline [sd0i:/bsd -c]
> atag mem start 0x40000000 size 0x40000000
> bootfile: sd0i:/bsd
> bootargs: -c
> memory size derived from u-boot
> bootconf.mem[0].address = 40000000 pages 262144/0x40000000
> Allocating page tables
> freestart = 0x40f0c000, free_pages = 258292 (0x0003f0f4)
> IRQ stack: p0x40f3a000 v0xc0f3a000
> ABT stack: p0x40f3b000 v0xc0f3b000
> UND stack: p0x40f3c000 v0xc0f3c000
> SVC stack: p0x40f3d000 v0xc0f3d000
> Creating L1 page table at 0x40f0c000
> Mapping kernel
> Constructing L2 page tables
> undefined page pmap [ using 170728 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
>       The Regents of the University of California.  All rights reserved.
> Copyright (c) 1995-2014 OpenBSD. All rights reserved.  http://www.OpenBSD.org
> 
> kernel does not support -c; continuing..
> OpenBSD 5.6-current (RAMDISK-SUNXI) #1: Thu Oct  9 21:03:32 AEDT 2014
>    r...@armv7.jsg.id.au:/usr/src/sys/arch/armv7/compile/RAMDISK-SUNXI
> real mem  = 1073741824 (1024MB)
> avail mem = 1036165120 (988MB)
> warning: no entropy supplied by boot loader
> mainbus0 at root
> cortex0 at mainbus0
> ampintc0 at cortex0 nirq 160
> cpu0 at mainbus0: ARM Cortex A7 rev 4 (ARMv7 core)
> cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
> cpu0: 32KB(32b/l,2way) I-cache, 32KB(64b/l,4way) wr-back D-cache
> sunxi0 at mainbus0: A20
> sxipio0 at sunxi0
> sxiccmu0 at sunxi0
> sxitimer0 at sunxi0: ticktimer 100hz @ 32KHz
> sxitimer1 at sunxi0: stattimer 128hz @ 32KHz
> sxitimer2 at sunxi0: cntrtimer @ 32KHz
> sxidog0 at sunxi0
> sxirtc0 at sunxi0
> sxiuart0 at sunxi0: console
> sxiuart1 at sunxi0
> sxiuart2 at sunxi0
> sxiuart3 at sunxi0
> sxiuart4 at sunxi0
> sxiuart5 at sunxi0
> sxiuart6 at sunxi0
> sxiuart7 at sunxi0
> sxie0 at sunxi0, address 02:99:03:c2:d2:6e
> ukphy0 at sxie0 phy 0: Generic IEEE 802.3u media interface, rev. 5: OUI 
> 0x000732, model 0x0011
> ukphy1 at sxie0 phy 1: Generic IEEE 802.3u media interface, rev. 5: OUI 
> 0x000732, model 0x0011
> ahci0 at sunxi0 AHCI 1.1
> pmap_fault_fixup: va c5544000 ftype 2 s pte 7ff9301e
> panic: uvm_fault: fault on non-pageable map (0xc0e7f28c, 0xc5544000)
> Stopped at      Debugger+0x4:   ldrb    r15, [r15, r15, ror r15]!
> panic+0x18
>        scp=0xc083a39c rlv=0xc08c2f54 (uvm_fault+0xca8)
>        rsp=0xc0f3eaec rfp=0xc0f3ec0c
> uvm_fault+0xc
>        scp=0xc08c22b8 rlv=0xc08fe588 (data_abort_handler+0x248)
>        rsp=0xc0f3ec10 rfp=0xc0f3ec64
>        r10=0xc0f3ec68 r9=0xc0f3d000 r8=0x00000000 r7=0xc0e9f764
>        r6=0x00000002 r5=0xc0ebc7b4 r4=0xc5544000
> data_abort_handler+0xc
>        scp=0xc08fe34c rlv=0xc08fdd54 (address_exception_entry+0x50)
>        rsp=0xc0f3ec68 rfp=0xc0f3eccc
>        r10=0xc0ebd1b4 r9=0x00000200 r8=0x0000014c r7=0x0000000a
>        r6=0x00000009 r5=0xc5544e00 r4=0x00000010
> poison_mem+0xc
>        scp=0xc0835bb8 rlv=0xc081df20 (malloc+0x2ec)
>        rsp=0xc0f3ecd0 rfp=0xc0f3ed38
>        r5=0xc5544000 r4=0xc5544e00
> malloc+0x10
>        scp=0xc081dc44 rlv=0xc08fcee8 (_bus_dmamap_create+0x40)
>        rsp=0xc0f3ed3c rfp=0xc0f3ed5c
>        r10=0x00000000 r9=0x7ff97000 r8=0x00000000 r7=0x00000003
>        r6=0x00010000 r5=0x00400000 r4=0x00000018
> _bus_dmamap_create+0x10
>        scp=0xc08fceb8 rlv=0xc0804384 (ahci_port_alloc+0x34c)
>        rsp=0xc0f3ed60 rfp=0xc0f3edb0
>        r7=0xc553b300 r6=0xc548a200 r5=0xc5542000 r4=0x00000000
> ahci_port_alloc+0x10
>        scp=0xc0804048 rlv=0xc0804814 (ahci_attach+0x80)
>        rsp=0xc0f3edb4 rfp=0xc0f3ede8
>        r10=0xc0f3ee5c r9=0xc0f3ee5c r8=0x00000000 r7=0xc553b300
>        r6=0xc553b300 r5=0x00000001 r4=0x00000000
> ahci_attach+0xc
>        scp=0xc08047a0 rlv=0xc0931fb0 (sxiahci_attach+0x480)
>        rsp=0xc0f3edec rfp=0xc0f3ee18
>        r6=0xc0904420 r5=0x00000000 r4=0xd1135000
> sxiahci_attach+0x10
>        scp=0xc0931b40 rlv=0xc08309e0 (config_attach+0x1d4)
>        rsp=0xc0f3ee1c rfp=0xc0f3ee54
>        r10=0x00000000 r8=0xc0ec0290 r7=0xc553d0c0 r6=0xc0970750
>        r5=0xc553b314 r4=0xc553b300
> config_attach+0xc
>        scp=0xc0830818 rlv=0xc0906d9c (armv7_attach+0x144)
>        rsp=0xc0f3ee58 rfp=0xc0f3ee90
>        r10=0x00000000 r9=0xc0f3eed0 r8=0xc0e74534 r7=0xc553d0c0
>        r6=0xc0e79a6c r5=0xc0e76b24 r4=0xc0e76628
> RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
> DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!
> ddb> trace
> panic+0x18
>        scp=0xc083a39c rlv=0xc08c2f54 (uvm_fault+0xca8)
>        rsp=0xc0f3eaec rfp=0xc0f3ec0c
> uvm_fault+0xc
>        scp=0xc08c22b8 rlv=0xc08fe588 (data_abort_handler+0x248)
>        rsp=0xc0f3ec10 rfp=0xc0f3ec64
>        r10=0xc0f3ec68 r9=0xc0f3d000 r8=0x00000000 r7=0xc0e9f764
>        r6=0x00000002 r5=0xc0ebc7b4 r4=0xc5544000
> data_abort_handler+0xc
>        scp=0xc08fe34c rlv=0xc08fdd54 (address_exception_entry+0x50)
>        rsp=0xc0f3ec68 rfp=0xc0f3eccc
>        r10=0xc0ebd1b4 r9=0x00000200 r8=0x0000014c r7=0x0000000a
>        r6=0x00000009 r5=0xc5544e00 r4=0x00000010
> poison_mem+0xc
>        scp=0xc0835bb8 rlv=0xc081df20 (malloc+0x2ec)
>        rsp=0xc0f3ecd0 rfp=0xc0f3ed38
>        r5=0xc5544000 r4=0xc5544e00
> malloc+0x10
>        scp=0xc081dc44 rlv=0xc08fcee8 (_bus_dmamap_create+0x40)
>        rsp=0xc0f3ed3c rfp=0xc0f3ed5c
>        r10=0x00000000 r9=0x7ff97000 r8=0x00000000 r7=0x00000003
>        r6=0x00010000 r5=0x00400000 r4=0x00000018
> _bus_dmamap_create+0x10
>        scp=0xc08fceb8 rlv=0xc0804384 (ahci_port_alloc+0x34c)
>        rsp=0xc0f3ed60 rfp=0xc0f3edb0
>        r7=0xc553b300 r6=0xc548a200 r5=0xc5542000 r4=0x00000000
> ahci_port_alloc+0x10
>        scp=0xc0804048 rlv=0xc0804814 (ahci_attach+0x80)
>        rsp=0xc0f3edb4 rfp=0xc0f3ede8
>        r10=0xc0f3ee5c r9=0xc0f3ee5c r8=0x00000000 r7=0xc553b300
>        r6=0xc553b300 r5=0x00000001 r4=0x00000000
> ahci_attach+0xc
>        scp=0xc08047a0 rlv=0xc0931fb0 (sxiahci_attach+0x480)
>        rsp=0xc0f3edec rfp=0xc0f3ee18
>        r6=0xc0904420 r5=0x00000000 r4=0xd1135000
> sxiahci_attach+0x10
>        scp=0xc0931b40 rlv=0xc08309e0 (config_attach+0x1d4)
>        rsp=0xc0f3ee1c rfp=0xc0f3ee54
>        r10=0x00000000 r8=0xc0ec0290 r7=0xc553d0c0 r6=0xc0970750
>        r5=0xc553b314 r4=0xc553b300
> config_attach+0xc
>        scp=0xc0830818 rlv=0xc0906d9c (armv7_attach+0x144)
>        rsp=0xc0f3ee58 rfp=0xc0f3ee90
>        r10=0x00000000 r9=0xc0f3eed0 r8=0xc0e74534 r7=0xc553d0c0
>        r6=0xc0e79a6c r5=0xc0e76b24 r4=0xc0e76628
> armv7_attach+0x10
>        scp=0xc0906c68 rlv=0xc08309e0 (config_attach+0x1d4)
>        rsp=0xc0f3ee94 rfp=0xc0f3eecc
>        r8=0xc0ec0290 r7=0xc553d000 r6=0xc0e78c40 r5=0xc553d0d4
>        r4=0xc553d0c0
> config_attach+0xc
>        scp=0xc0830818 rlv=0xc08f83fc (mainbussearch+0x54)
>        rsp=0xc0f3eed0 rfp=0xc0f3eef4
>        r10=0x00000000 r9=0x00000000 r8=0xc0e727e4 r7=0xc0f3eed0
>        r6=0xc553d000 r5=0xc0970468 r4=0xc0e78c2c
> mainbussearch+0xc
>        scp=0xc08f83b4 rlv=0xc08305cc (config_scan+0x13c)
>        rsp=0xc0f3eef8 rfp=0xc0f3ef1c
>        r7=0xc0970468 r6=0xc0970468 r5=0xc553d000 r4=0xc0f3ef20
> config_scan+0xf4
>        scp=0xc0830584 rlv=0xc08307ec (config_search+0x11c)
>        rsp=0xc0f3ef20 rfp=0xc0f3ef58
>        r8=0xc0ec0290 r7=0xc0970168 r6=0xc0970468 r5=0xc553d000
>        r4=0xc0970154
> config_search+0x10
>        scp=0xc08306e0 rlv=0xc08309e0 (config_attach+0x1d4)
>        rsp=0xc0f3ef5c rfp=0xc0f3ef94
>        r7=0x00000000 r6=0xc0e74388 r5=0xc553d014 r4=0xc553d000
> config_attach+0xc
>        scp=0xc0830818 rlv=0xc0907e1c (cpu_configure+0x20)
>        rsp=0xc0f3ef98 rfp=0xc0f3efa8
>        r10=0xc0ebc7b4 r9=0xc0ebd6cc r8=0xc0ebc94c r7=0xc0ebc638
>        r6=0x00000000 r5=0xc0ebc5b4 r4=0xc0edfe9c
> cpu_configure+0xc
>        scp=0xc0907e08 rlv=0xc081548c (main+0x340)
>        rsp=0xc0f3efac rfp=0xc0f3efec
> main+0x10
>        scp=0xc081515c rlv=0xc080017c (kernel_text+0x4c)
>        rsp=0xc0f3eff0 rfp=0xc0f3effc
>        r10=0x7ffb9eac r9=0x7fb65f0c r8=0x40000100 r7=0x000010bb
>        r6=0x40000100 r5=0x000010bb r4=0x40800120
> kernel_text+0x48
>        scp=0xc0800178 rlv=0xc09079f0 (initarm+0x820)
>        rsp=0xc0f3f000 rfp=0x00000000
> ddb> ps
>   PID   PPID   PGRP    UID  S       FLAGS  WAIT          COMMAND
> *    0     -1      0      0  7     0x10200                swapper
> ddb> 
> 
> 
> --------
> U-Boot SPL 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04)
> Board: Bananapi
> DRAM: 1024 MiB
> CPU: 960000000Hz, AXI/AHB/APB: 3/2/2
> spl: not an uImage at 1600
> 
> 
> U-Boot 2014.04-10694-g2ae8b32-dirty (Oct 01 2014 - 17:40:04) Allwinner 
> Technology
> 
> CPU:   Allwinner A20 (SUN7I)
> Board: Bananapi
> I2C:   ready
> DRAM:  1 GiB
> MMC:   SUNXI SD/MMC: 0
> *** Warning - bad CRC, using default environment
> 
> In:    serial
> Out:   serial
> Err:   serial
> Net:   dwmac.1c50000
> Hit any key to stop autoboot:  0 
> reading uEnv.txt
> 118 bytes read in 16 ms (6.8 KiB/s)
> Loaded environment from uEnv.txt
> Running uenvcmd ...
> reading bsd.umg
> 3772616 bytes read in 203 ms (17.7 MiB/s)
> ## Booting kernel from Legacy Image at 60000000 ...
>   Image Name:   boot
>   Image Type:   ARM Linux Kernel Image (uncompressed)
>   Data Size:    3772552 Bytes = 3.6 MiB
>   Load Address: 40800000
>   Entry Point:  40800000
>   Verifying Checksum ... OK
>   Loading Kernel Image ... OK
> 
> Starting kernel ...
> 
> 
> OpenBSD/sunxi booting ...
> arg0 0x0 arg1 0x10bb arg2 0x40000100
> atag core flags 0 pagesize 0 rootdev 0
> atag cmdline [sd0i:/bsd -c]
> atag mem start 0x40000000 size 0x40000000
> bootfile: sd0i:/bsd
> bootargs: -c
> memory size derived from u-boot
> bootconf.mem[0].address = 40000000 pages 262144/0x40000000
> Allocating page tables
> freestart = 0x40b9a000, free_pages = 259174 (0x0003f466)
> IRQ stack: p0x40bc8000 v0xc0bc8000
> ABT stack: p0x40bc9000 v0xc0bc9000
> UND stack: p0x40bca000 v0xc0bca000
> SVC stack: p0x40bcb000 v0xc0bcb000
> Creating L1 page table at 0x40b9c000
> Mapping kernel
> Constructing L2 page tables
> undefined page pmap [ using 300260 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
>       The Regents of the University of California.  All rights reserved.
> Copyright (c) 1995-2014 OpenBSD. All rights reserved.  http://www.OpenBSD.org
> 
> User Kernel Config
> UKC> 
> (hang-up here)
> 


Reply via email to