Page MenuHomeFreeBSD

system can hang when large FDT is in use
ClosedPublic

Authored by int0dster_gmail.com on Aug 23 2016, 3:10 AM.

Details

Summary

kernel maps only one page of FDT. When FDT is more than one page in size, data TLB miss occurs on memmove()
when FDT is moved to kernel storage (sys/powerpc/booke/booke_machdep.c, booke_init())

Test Plan
  1. Build kernel, create uImage

mkimage -A ppc -O linux -e 0x4001000 -a 0x3ffffc0 -C none -d /tftpboot/fbsd /tftpboot/fbsd.uImage

  1. Boot uImage on the QorIQ system

> tftpboot 0x3ffffc0 k1

Using FM1@DTSEC3 device
TFTP from server 192.168.2.23; our IP address is 192.168.2.22
Filename 'k1'.
Load address: 0x3ffffc0
Loading: #############

  1. ############# ############# ############# ############# ############# ############# ############# ##############
	 3.1 MiB/s

done
Bytes transferred = 9380388 (8f2224 hex)

  1. Boot the image, ensure that kernel successfully reaches mi_startup() (you shall see greeting

when it does)

Bytes transferred = 9380388 (8f2224 hex)

> bootm 0x3ffffc0 - 0xec800000

WARNING: adjusting available memory to 30000000 Booting kernel from Legacy Image at 03ffffc0 ... Image Name: Image Type: PowerPC Linux Kernel Image (uncompressed) Data Size: 9380324 Bytes = 8.9 MiB Load Address: 03ffffc0 Entry Point: 04001000 Verifying Checksum ... OK Flattened Device Tree blob at ec800000 Booting using the fdt blob at 0xec800000 XIP Kernel Image ... OK Loading Device Tree to 03fe0000, end 03fff10b ... OK HELLO FROM t2080 FREEBSD!! Copyright (c) 1992-2016 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-CURRENT #40 9d6a66c(master)-dirty: Sun Aug 21 12:15:46 PDT 2016 root@int0dh-home:/usr/obj/powerpc.powerpc/usr/home/int0dh/WORK/freebsd.original/sys/AMIGAX5000 powerpc gcc version 4.2.1 20070831 patched [FreeBSD] WARNING: WITNESS option enabled, expect reduced performance. ...

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

int0dster_gmail.com retitled this revision from to system can hang when large FDT is in use.
int0dster_gmail.com updated this object.
int0dster_gmail.com edited the test plan for this revision. (Show Details)
int0dster_gmail.com set the repository for this revision to rS FreeBSD src repository - subversion.
int0dster_gmail.com added a project: PowerPC.

Overall, good work. Just a couple nits and it'll be fine. This should definitely fix the hang problem I've seen booting from ubldr on one of my boards, so I'm excited about it.

sys/powerpc/booke/pmap.c
3416 ↗(On Diff #19566)

This probably belongs with D7604, and should be conditional on EARLY_PRINTF. Also, if this line does go in, the PA argument should be a compile-time value, settable in the conf file. I can help you with that, but will comment on it in the D7604 review.

3431 ↗(On Diff #19566)

This will only work right if the mapping completely encloses the region, it won't work if the region spans multiple TLB mappings, which is possible to do in pmap_early_io_map(). Since it's only used in one location right now, I guess it's okay, but just add a comment here that it should be fixed in the future.

int0dster_gmail.com edited edge metadata.

Revision 2 of the initial patch. Addresses reviewer comments.

jhibbits edited edge metadata.

Looks good, I'll see if I can commit it tonight.

I put a few minutes of thought into the pmap_early_io_unmap() problem, and I think it'll be pretty easy to address, but it'll need either a new function (good idea) or some inline asm, to search for each TLB entry by VA. It's more complicated, and not needed right now, but something to think about for later on.

This revision is now accepted and ready to land.Aug 23 2016, 2:24 PM
This revision was automatically updated to reflect the committed changes.