Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

user5673
Posts: 6
Joined: Wed Feb 14, 2018 8:22 pm

Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Wed Nov 14, 2018 6:48 pm

Hello

We have a custom board having SAMA5D21 and 64MB of DDR2 SDRAM. We are experiencing issues with booting Linux, it either fails during zImage decompression stage, or in case of uncompressed uImage prints messages like

Code: Select all

[    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
There are no indications that DRAM is improperly configured or has hardware issues, all memory tests that I've added to at91bootstrap pass and checksum of the kernel image loaded into the DRAM always matched checksum of the kernel image flashed into the board.

Long story short, I've decided to test if kernel fits into the 64M of RAM. I've prepended "mem=64M" to the kernel command line on the devboard SAMA5D2-XULT (by interrupting u-boot and changing command line

Code: Select all

=> setenv bootargs mem=64M console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
=> boot
I observe that kernel fails to boot with mem= values other than mem=512M which equals to boards actual physical DRAM size. Values tested were 64M, 128M, 256M.

I did these tests with following kernel versions, using sama5_defconfig every time: In all 3 cases kernel boots successfully with default command line and fails to boot with mem=64M prepended. Device tree blob was at91-sama5d2_xplained.dtb from each tested version.

This definitely looks like a kernel bug, Linux is known to fit into the smaller RAM sizes (and I've tested that linux 4.14 on amd64 also boots successfully with mem=64M).

If it is not specific to Atmel SoC's, I guess it will be better to report it to the linux-arm-kernel mailing lists.

Last crash output from mainline Linux 4.19.2 with debugging config options added to sama5d_defconfig:

Code: Select all

CONFIG_DEBUG_LL=y
CONFIG_DEBUG_AT91_SAMA5D2_UART1=y
CONFIG_DEBUG_UART_PHYS=0xf8020000
CONFIG_DEBUG_UART_VIRT=0xf7020000
CONFIG_EARLY_PRINTK=y

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.19.2 (user@gentoo) (gcc version 6.4.0 (Buildroot 2018.02-rc1-00043-g06197ed294)) #1 Wed Nov 14 19:39:57 +04 2018
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: Atmel SAMA5D2 Xplained
bootconsole [earlycon0] enabled
Memory policy: Data cache writeback
Unable to handle kernel paging request at virtual address dfb57000
pgd = (ptrval)
[dfb57000] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.2 #1
Hardware name: Atmel SAMA5
PC is at fdt_check_header+0x0/0x74
LR is at __unflatten_device_tree+0x20/0x10c
pc : [<c06eee64>]    lr : [<c052ed9c>]    psr: a00000d3
sp : c0b01f30  ip : 20b5b523  fp : fffff000
r10: 00000000  r9 : 20000000  r8 : c0a1ef54
r7 : 00000000  r6 : dfb57000  r5 : c0b54f90  r4 : c0a1ef54
r3 : c0a1ef54  r2 : c0b54f90  r1 : 00000000  r0 : dfb57000
Flags: NzCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 20004059  DAC: 00000051
Process swapper (pid: 0, stack limit = 0x(ptrval))
Stack: (0xc0b01f30 to 0xc0b02000)
1f20:                                     c0a1ef54 c3ffcf80 c0b06b48 23ffffff
1f40: c0b46ba8 20000000 c0954f20 c0a1fd90 00000000 c011ade4 c0a2d6d4 c0a04698
1f60: ffffffff 10c53c7d c0b03008 c08e5c1c 410fc051 c0b03008 00000000 c01448a8
1f80: c08e4100 00000000 10c03c7d 00000000 c0b3bac0 c0b03000 ffffffff 3fb57000
1fa0: c0b03008 c0b03008 00000000 c0a0096c 00000000 00000000 00000000 00000000
1fc0: 00000000 c0a2ea2c 00000000 00000000 00000000 c0a00330 00000051 10c03c7d
1fe0: 00000000 3fb57000 410fc051 10c53c7d 00000000 00000000 00000000 00000000
[<c06eee64>] (fdt_check_header) from [<c052ed9c>] (__unflatten_device_tree+0x20/0x10c)
[<c052ed9c>] (__unflatten_device_tree) from [<c0a1fd90>] (unflatten_device_tree+0x34/0x44)
[<c0a1fd90>] (unflatten_device_tree) from [<c0a04698>] (setup_arch+0x878/0xacc)
[<c0a04698>] (setup_arch) from [<c0a0096c>] (start_kernel+0x74/0x3e4)
[<c0a0096c>] (start_kernel) from [<00000000>] (  (null))
Code: e1a0000c ebf0f162 e28dd014 e49df004 (e5903000) 
random: get_random_bytes called from print_oops_end_marker+0x40/0x54 with crng_init=0
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---


blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Thu Nov 15, 2018 4:14 am

user5673 wrote: This definitely looks like a kernel bug,
...
I guess it will be better to report it to the linux-arm-kernel mailing lists.
Whoa, slow down, don't rush to claim that you have found a bug.
Suggest that you not report this to any mailing list unless you want to embarrass yourself.
You have not found a kernel bug.
Post the full boot log if you want an explanation of what you overlooked.

Regards
user5673
Posts: 6
Joined: Wed Feb 14, 2018 8:22 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Thu Nov 15, 2018 4:18 pm

ok

Code: Select all

�RomBOOTg... reboot: Restarting system


AT91Bootstrap 3.8.9 (�В�т �и�ю�л 10 20:22:33 +04 2018)

EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
  #0  SAMA5D2-XULT [AB1]      ATMEL-RF0

EEPROM: Board sn: 0xd300000 revision: 0x400000

SD/MMC: Image: Read file u-boot.bin to 0x26f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Jul 10 2018 - 20:22:40 +0400)

CPU: SAMA5D27-CU
Crystal frequency:       12 MHz
CPU clock        :      498 MHz
Master clock     :      166 MHz
DRAM:  512 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
=> printenv
arch=arm
baudrate=115200
board=sama5d2_xplained
board_name=sama5d2_xplained
bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
bootcmd=fatload mmc 1:1 0x21000000 at91-sama5d2_xplained_at86rf230.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000
bootdelay=3
cpu=armv7
ethaddr=fc:c2:3d:02:f6:ea
fdtcontroladdr=3fb63578
fileaddr=22000000
filesize=3a6a80
soc=at91
vendor=atmel

Environment size: 444/16380 bytes
=> setenv bootargs mem=64M console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
=> boot
reading at91-sama5d2_xplained_at86rf230.dtb
29351 bytes read in 22 ms (1.3 MiB/s)
reading zImage
4320368 bytes read in 277 ms (14.9 MiB/s)
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 3fb57000, end 3fb612a6 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.19.2 (user@gentoo) (gcc version 7.3.0 (Buildroot 2018.02-rc1-00043-g06197ed294)) #1 Wed Nov 14 22:29:10 +04 2018
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: Atmel SAMA5D2 Xplained
bootconsole [earlycon0] enabled
Memory policy: Data cache writeback
Unable to handle kernel paging request at virtual address dfb57000
pgd = (ptrval)
[dfb57000] *pgd=00000000
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 4.19.2 #1
Hardware name: Atmel SAMA5
PC is at fdt_check_header+0x0/0x74
LR is at __unflatten_device_tree+0x20/0x10c
pc : [<c06ed600>]    lr : [<c052e6b4>]    psr: a00000d3
sp : c0b01f30  ip : 00000000  fp : fffff000
r10: 00000000  r9 : 20000000  r8 : c0a1ee5c
r7 : 00000000  r6 : dfb57000  r5 : c0b54f10  r4 : c0a1ee5c
r3 : c0a1ee5c  r2 : c0b54f10  r1 : 00000000  r0 : dfb57000
Flags: NzCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 20004059  DAC: 00000051
Process swapper (pid: 0, stack limit = 0x(ptrval))
Stack: (0xc0b01f30 to 0xc0b02000)
1f20:                                     c0a1ee5c c3ffcf80 c0b06b48 23ffffff
1f40: c0b46b28 20000000 c09550b8 c0a1fccc 00000000 c011ae08 c0a2d504 c0a046ac
1f60: ffffffff 10c53c7d c0b03008 c08e5e9c 410fc051 c0b03008 00000000 c0144938
1f80: c08e4380 00000000 c0b03008 00000000 c0b3ba40 c0b03000 ffffffff 3fb57000
1fa0: c0b03008 c0b03008 00000000 c0a0095c 00000000 00000000 00000000 00000000
1fc0: 00000000 c0a2ea2c 00000000 00000000 00000000 c0a00330 00000051 10c03c7d
1fe0: 00000000 3fb57000 410fc051 10c53c7d 00000000 00000000 00000000 00000000
[<c06ed600>] (fdt_check_header) from [<c052e6b4>] (__unflatten_device_tree+0x20/0x10c)
[<c052e6b4>] (__unflatten_device_tree) from [<c0a1fccc>] (unflatten_device_tree+0x34/0x44)
[<c0a1fccc>] (unflatten_device_tree) from [<c0a046ac>] (setup_arch+0x870/0xac0)
[<c0a046ac>] (setup_arch) from [<c0a0095c>] (start_kernel+0x74/0x3dc)
[<c0a0095c>] (start_kernel) from [<00000000>] (  (null))
Code: e1a0000c ebf0f882 e28dd014 e49df004 (e5903000) 
random: get_random_bytes called from print_oops_end_marker+0x40/0x54 with crng_init=0
---[ end trace 0000000000000000 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---
successful boot with mem=512M:

Code: Select all

�RomBOOTKILL to all processesreboot: Restarting system


AT91Bootstrap 3.8.9 (�В�т �и�ю�л 10 20:22:33 +04 2018)

EEPROM: Loading AT24xx information ...
EEPROM: BoardName | [Revid] | VendorName
  #0  SAMA5D2-XULT [AB1]      ATMEL-RF0

EEPROM: Board sn: 0xd300000 revision: 0x400000

SD/MMC: Image: Read file u-boot.bin to 0x26f00000
SD: Card Capacity: High or Extended
SD: Specification Version 3.0X
SD/MMC: Done to load image
<debug_uart> 

U-Boot 2017.03-linux4sam_5.7 (Jul 10 2018 - 20:22:40 +0400)

CPU: SAMA5D27-CU
Crystal frequency:       12 MHz
CPU clock        :      498 MHz
Master clock     :      166 MHz
DRAM:  512 MiB
MMC:   sdio-host@a0000000: 0, sdio-host@b0000000: 1
reading uboot.env
In:    serial
Out:   serial
Err:   serial
Net:   eth0: ethernet@f8008000
Hit any key to stop autoboot:  0 
=> printenv
arch=arm
baudrate=115200
board=sama5d2_xplained
board_name=sama5d2_xplained
bootargs=console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
bootcmd=fatload mmc 1:1 0x21000000 at91-sama5d2_xplained_at86rf230.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000
bootdelay=3
cpu=armv7
ethaddr=fc:c2:3d:02:f6:ea
fdtcontroladdr=3fb63578
fileaddr=22000000
filesize=3a6a80
soc=at91
vendor=atmel

Environment size: 444/16380 bytes
=> setenv bootargs mem=512M console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
=> boot
reading at91-sama5d2_xplained_at86rf230.dtb
29351 bytes read in 21 ms (1.3 MiB/s)
reading zImage
4320368 bytes read in 277 ms (14.9 MiB/s)
## Flattened Device Tree blob at 21000000
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 3fb57000, end 3fb612a6 ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.19.2 (user@gentoo) (gcc version 7.3.0 (Buildroot 2018.02-rc1-00043-g06197ed294)) #1 Wed Nov 14 22:29:10 +04 2018
CPU: ARMv7 Processor [410fc051] revision 1 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt: Machine model: Atmel SAMA5D2 Xplained
bootconsole [earlycon0] enabled
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
random: get_random_bytes called from start_kernel+0x9c/0x3dc with crng_init=0
Built 1 zonelists, mobility grouping on.  Total pages: 130048
Kernel command line: mem=512M console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 509004K/524288K available (7168K kernel code, 238K rwdata, 1604K rodata, 1024K init, 126K bss, 15284K reserved, 0K cma-reserved)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
    lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0x(ptrval) - 0x(ptrval)   (8160 kB)
      .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
      .data : 0x(ptrval) - 0x(ptrval)   ( 239 kB)
       .bss : 0x(ptrval) - 0x(ptrval)   ( 127 kB)
NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
L2C-310 ID prefetch enabled, offset 2 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c9, AUX_CTRL 0x36020000
clocksource: pit: mask: 0x7ffffff max_cycles: 0x7ffffff, max_idle_ns: 11513617062 ns
Console: colour dummy device 80x30
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836475000000ns
Calibrating delay loop... 329.31 BogoMIPS (lpj=1646592)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x20100000 - 0x20100060
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 2 part 30 variant 5 rev 1
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
AT91: PM: standby: standby, suspend: ulp0
No ATAGs?
clocksource: tcb_clksrc: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 184217874325 ns
at_xdmac f0010000.dma-controller: 16 channels, mapped at 0x(ptrval)
at_xdmac f0004000.dma-controller: 16 channels, mapped at 0x(ptrval)
AT91: Detected SoC family: sama5d2
AT91: Detected SoC: sama5d27, revision 1
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
videodev: Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
Advanced Linux Sound Architecture Driver Initialized.
clocksource: Switched to clocksource tcb_clksrc
NET: Registered protocol family 2
tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 2, 16384 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Initialise system trusted keyrings
workingset: timestamp_bits=30 max_order=17 bucket_order=0
Key type asymmetric registered
Asymmetric key parser 'x509' registered
io scheduler noop registered (default)
io scheduler mq-deadline registered
io scheduler kyber registered
pinctrl-at91-pio4 fc038000.pinctrl: atmel pinctrl initialized
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
fc008000.serial: ttyS1 at MMIO 0xfc008000 (irq = 41, base_baud = 5187500) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
at91_i2c fc018600.i2c: can't get DMA channel, continue without DMA support
at91_i2c fc018600.i2c: Using FIFO (16 data)
at91_i2c fc018600.i2c: AT91 i2c bus driver (hw version: 0x704).
atmel_spi f8000000.spi: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA transfers
atmel_spi f8000000.spi: Using FIFO (16 data)
m25p80 spi0.0: at25df321a (4096 Kbytes)
atmel_spi f8000000.spi: Atmel SPI Controller version 0x311 at 0xf8000000 (irq 28)
libphy: Fixed MDIO Bus: probed
CAN device driver interface
m_can f8054000.can: m_can device registered (irq=39, version=31)
m_can fc050000.can: m_can device registered (irq=51, version=31)
libphy: MACB_mii_bus: probed
Micrel KSZ8081 or KSZ8091 f8008000.ethernet-ffffffff:01: attached PHY driver [Micrel KSZ8081 or KSZ8091] (mii_bus:phy_addr=f8008000.ethernet-ffffffff:01, irq=126)
macb f8008000.ethernet eth0: Cadence GEM rev 0x00020203 at 0xf8008000 irq 29 (fc:c2:3d:02:f6:ea)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-atmel: EHCI Atmel driver
atmel-ehci 500000.ehci: EHCI Host Controller
atmel-ehci 500000.ehci: new USB bus registered, assigned bus number 1
atmel-ehci 500000.ehci: irq 19, io mem 0x00500000
atmel-ehci 500000.ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: EHCI Host Controller
usb usb1: Manufacturer: Linux 4.19.2 ehci_hcd
usb usb1: SerialNumber: 500000.ehci
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ohci-atmel: OHCI Atmel driver
at91_ohci 400000.ohci: USB Host Controller
at91_ohci 400000.ohci: new USB bus registered, assigned bus number 2
at91_ohci 400000.ohci: irq 19, io mem 0x00400000
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001, bcdDevice= 4.19
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: USB Host Controller
usb usb2: Manufacturer: Linux 4.19.2 ohci_hcd
usb usb2: SerialNumber: at91
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
usbcore: registered new interface driver pl2303
usbserial: USB Serial support registered for pl2303
atmel_usba_udc 300000.gadget: MMIO registers at [mem 0xfc02c000-0xfc02c3ff] mapped at (ptrval)
atmel_usba_udc 300000.gadget: FIFO at [mem 0x00300000-0x003fffff] mapped at (ptrval)
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
at91_rtc f80480b0.rtc: registered as rtc0
at91_rtc f80480b0.rtc: AT91 Real Time Clock driver.
i2c /dev entries driver
at91-reset f8048000.rstc: Starting after software reset
sama5d4_wdt f8048040.watchdog: unable to set timeout value
sama5d4_wdt: probe of f8048040.watchdog failed with error -22
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-at91 a0000000.sdio-host: update clk mul to 39 as gck rate is 480000000 Hz
mmc0: SDHCI controller on a0000000.sdio-host [a0000000.sdio-host] using ADMA
sdhci-at91 b0000000.sdio-host: update clk mul to 39 as gck rate is 480000000 Hz
atmel_aes f002c000.aes: version: 0x500
atmel_aes f002c000.aes: Atmel AES - Using dma0chan2, dma0chan3 for DMA transfers
atmel_sha f0028000.sha: version: 0x510
atmel_sha f0028000.sha: using dma0chan4 for DMA transfers
atmel_sha f0028000.sha: Atmel SHA1/SHA256/SHA224/SHA384/SHA512
atmel_tdes fc044000.tdes: version: 0x703
atmel_tdes fc044000.tdes: using dma0chan5, dma0chan6 for DMA transfers
atmel_tdes fc044000.tdes: Atmel DES/TDES
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
atmel-pdmic f8018000.pdmic: ASoC: Failed to create component debugfs directory
atmel-pdmic f8018000.pdmic: atmel-pdmic-hifi <-> f8018000.pdmic mapping ok
NET: Registered protocol family 10
Segment Routing with IPv6
sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
NET: Registered protocol family 17
can: controller area network core (rev 20170425 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20170425)
can: broadcast manager protocol (rev 20170425 t)
can: netlink gateway (rev 20170425) max_hops=1
Loading compiled-in X.509 certificates
at91_i2c f8028000.i2c: can't get DMA channel, continue without DMA support
at91_i2c f8028000.i2c: Using FIFO (16 data)
DCDC_REG1: supplied by regulator-dummy
DCDC_REG2: supplied by regulator-dummy
mmc0: new DDR MMC card at address 0001
mmcblk0: mmc0:0001 MMC04G 3.66 GiB 
mmcblk0boot0: mmc0:0001 MMC04G partition 1 1.00 MiB
mmcblk0boot1: mmc0:0001 MMC04G partition 2 1.00 MiB
mmcblk0rpmb: mmc0:0001 MMC04G partition 3 128 KiB, chardev (247:0)
DCDC_REG3: supplied by regulator-dummy
 mmcblk0: p1 p2
LDO_REG1: supplied by regulator-dummy
LDO_REG2: supplied by regulator-dummy
LDO_REG3: supplied by regulator-dummy
VDD_LED: Bringing 2500000uV into 3300000-3300000uV
random: fast init done
LDO_REG4: supplied by regulator-dummy
act8945a-charger act8945a-charger: DMA mask not set
act8945a-charger act8945a-charger: have been suspended
at91_i2c f8028000.i2c: AT91 i2c bus driver (hw version: 0x704).
at91_i2c fc028000.i2c: can't get DMA channel, continue without DMA support
at91_i2c fc028000.i2c: Using FIFO (16 data)
at24 2-0054: 256 byte 24c02 EEPROM, writable, 16 bytes/write
at91_i2c fc028000.i2c: AT91 i2c bus driver (hw version: 0x704).
sdhci-at91 b0000000.sdio-host: Linked as a consumer to regulator.3
mmc1: SDHCI controller on b0000000.sdio-host [b0000000.sdio-host] using ADMA
at91-sama5d2_adc fc030000.adc: Linked as a consumer to regulator.5
at91-sama5d2_adc fc030000.adc: setting up trigger as external_rising
at91-sama5d2_adc fc030000.adc: version: 800
input: gpio_keys as /devices/platform/gpio_keys/input/input0
at91_rtc f80480b0.rtc: setting system clock to 2018-02-22 09:32:29 UTC (1519291949)
cfg80211: Loading compiled-in X.509 certificates for regulatory database
cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
ALSA device list:
  #0: PDMIC @ sama5d2_xplained
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
cfg80211: failed to load regulatory.db
atmel_usart f8020000.serial: using dma0chan8 for rx DMA transfers
atmel_usart f8020000.serial: using dma0chan9 for tx DMA transfers
Waiting for root device /dev/mmcblk1p2...
mmc1: new high speed SDHC card at address 1234
mmcblk1: mmc1:1234 SA08G 7.29 GiB 
 mmcblk1: p1 p2
EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:26.
devtmpfs: mounted
Freeing unused kernel memory: 1024K
Run /sbin/init as init process
EXT4-fs (mmcblk1p2): re-mounted. Opts: (null)
Starting logging: OK
user5673
Posts: 6
Joined: Wed Feb 14, 2018 8:22 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Thu Nov 15, 2018 4:59 pm

Same happens with demo archive

linux4sam/bin/view/Linux4SAM/Sama5d2Xpl ... o_archives

This one
ftp://www.at91.com/pub/demo/linux4sam_6 ... .0.img.bz2
is not compiled by me and also does not boot with mem= other than 512M
blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Fri Nov 16, 2018 9:06 pm

user5673 wrote:

Code: Select all

=> setenv bootargs mem=64M console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait
To be clear, by adding the "mem=64M" parameter to the kernel command line, you have directed the kernel to only use physical memory from the addresses 0x20000000 through 0x23ffffff inclusive.

As part of the preparation for starting the Linux kernel, U-Boot relocates the Flattened Device Tree blob from its loaded location, 0x21000000, to the highest possible memory area, 0x3fb57000, which is just below U-Boot itself and its heap. This relocation is reported by the messages:
user5673 wrote:

Code: Select all

=> boot
  ...  
   Booting using the fdt blob at 0x21000000
   Loading Device Tree to 3fb57000, end 3fb612a6 ... OK
Note that this data is now stored well beyond the memory limit that you have imposed on the kernel.

So U-Boot proceeds to boot the Linux kernel with your "mem=64M" parameter to "force usage of a specific amount of memory".
However the FDT blob is located outside this valid physical memory space.
Eventually the kernel realizes that it cannot properly map a virtual address to an invalid physical address:
user5673 wrote:

Code: Select all

Unable to handle kernel paging request at virtual address dfb57000
Note that all but the top three bits of this virtual address match the physical address of the relocated blob.

This oops occurs while in routine fdt_check_header():
user5673 wrote:

Code: Select all

PC is at fdt_check_header+0x0/0x74
Note that the physical address of the relocated blob, 0x3fb57000, appears in the stack trace twice.

So simply looking at this boot log and without bothering to inspect code, it seems reasonable to assume that this oops is caused by accessing the FDT blob in restricted physical memory.


Bottom line:

The ARM booting requirements as presented in Kernel documentation have been violated.
The dtb must be placed in a region of memory where the kernel decompressor will not overwrite it,
whilst remaining within the region which will be covered by the kernel's low-memory mapping.

The kernel oops/panic are prescribed consequences for presenting the kernel with an unresolvable conflict, i.e. fetch the FDT blob from inaccessible memory.
This is not a kernel bug.

Regards
user5673
Posts: 6
Joined: Wed Feb 14, 2018 8:22 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Fri Nov 16, 2018 10:58 pm

Ok, cool, thanks
The dtb must be placed in a region of memory where the kernel decompressor will not overwrite it,
So how can I know if kernel decompressor is going to overwrite it or not?
I suspect this could be the reason of boot failures on custom board with 64MB RAM.
By default at91bootstrap configuration compressed kernel is placed at 0x22000000, device tree blob is placed at 0x21000000.
So if I don't use u-boot and configure at91bootstrap to boot Linux directly, device tree is not relocated to the end of RAM.
0x20008000 where kernel is uncompressed to + approximately 11MB of uncompressed size is still less than 0x21000000 so
it seems device tree should not be overwritten, but now I'm not sure
user5673
Posts: 6
Joined: Wed Feb 14, 2018 8:22 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Fri Nov 16, 2018 11:46 pm

hmm, more likely no, devboard boots successfully with mem=64M and device tree not relocated by u-boot, from 0x21000000...
blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Command line parameter mem=64M makes kernel crash on sama5d2_xplained board

Sat Nov 17, 2018 1:35 am

user5673 wrote: So how can I know if kernel decompressor is going to overwrite it or not?
You can use the System.map file of the kernel to look up the virtual address of _end, and then subtract 0xA0000000 for its SAMA5 physical address. The dtb obviously needs to be located higher than that address.

user5673 wrote: I suspect this could be the reason of boot failures on custom board with 64MB RAM.
Suspect what you like, but it's not reasonable. (You'd be better off describing the problem's symptoms, than making guesses.)
If the dtb was overwritten, then you would be seeing completely different failure messages than what you mentioned.
IOW a clobbered dtb on boot is a condition that the kernel can/does usually detect and reports.

BTW you're headed off-topic from your subject title.

Regards

Return to “LINUX”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests