Kernel Level Optimization O1

I¹m using V3.15.10-bone8 kernel with Debian Image 2014-10-08.

I trying to debug a device driver which is built into the kernel to
simplify debugging. Building the kernel with O2 optimization makes single
stepping difficult so I changed the compiler optimization to O1 in
Makefile, but now Debian won¹t boot properly. Anyone have an idea why
changing the compiler optimization breaks OS startup? BTW, building the
kernel with O2 optimization boots just fine. Here is the bootlog:

Starting kernel ...

[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 3.15.10-bone8 (john@DX58SO) (gcc version
4.8.3 20140401 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.04 -
Linaro GCC 4.8-2014.04) ) #2 Fri Nov 14 17:32:17 PST 2014
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7),
cr=50c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing
instruction cache
[ 0.000000] Machine model: TI AM335x BeagleBone
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.0 (sgx neon )
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 129792
[ 0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/nfs
rw rootfstype=ext4 rootwait fixrtc
nfsroot=10.100.116.73:/home/john/targetNFS,vers=3
ip=10.100.116.105:10.100.116.73:10.100.f
[ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144
bytes)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072
bytes)
[ 0.000000] allocated 1048576 bytes of page_cgroup
[ 0.000000] please try 'cgroup_disable=memory' option if you don't want
memory cgroups
[ 0.000000] Memory: 506528K/523264K available (5866K kernel code, 605K
rwdata, 3216K rodata, 330K init, 982K bss, 16736K reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
[ 0.000000] vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf800000 - 0xbfe00000 ( 6 MB)
[ 0.000000] .text : 0xc0008000 - 0xc08e6a70 (9083 kB)
[ 0.000000] .init : 0xc08e7000 - 0xc0939b80 ( 331 kB)
[ 0.000000] .data : 0xc093a000 - 0xc09d1488 ( 606 kB)
[ 0.000000] .bss : 0xc09d1488 - 0xc0ac706c ( 983 kB)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:16 nr_irqs:16 16
[ 0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128
interrupts
[ 0.000000] Total of 128 interrupts on 1 active controller
[ 0.000000] OMAP clockevent source: timer2 at 24000000 Hz
[ 0.000010] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every
178956969942ns
[ 0.000028] OMAP clocksource: timer1 at 24000000 Hz
[ 0.000186] Console: colour dummy device 80x30
[ 0.000209] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[ 0.089539] pid_max: default: 32768 minimum: 301
[ 0.089607] Security Framework initialized
[ 0.089682] AppArmor: AppArmor disabled by boot time parameter
[ 0.089689] Yama: becoming mindful.
[ 0.089858] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.089869] Mountpoint-cache hash table entries: 1024 (order: 0, 4096
bytes)
[ 0.090357] Initializing cgroup subsys memory
[ 0.090385] Initializing cgroup subsys devices
[ 0.090395] Initializing cgroup subsys freezer
[ 0.090405] Initializing cgroup subsys net_cls
[ 0.090413] Initializing cgroup subsys blkio
[ 0.090420] Initializing cgroup subsys perf_event
[ 0.090464] CPU: Testing write buffer coherency: ok
[ 0.090753] Setting up static identity map for 0x80574140 - 0x8057418c
[ 0.093825] devtmpfs: initialized
[ 0.095462] VFP support v0.3: implementor 41 architecture 3 part 30
variant c rev 3
[ 0.100956] omap_hwmod: tptc0 using broken dt data from edma
[ 0.101025] omap_hwmod: tptc1 using broken dt data from edma
[ 0.101084] omap_hwmod: tptc2 using broken dt data from edma
[ 0.157535] xor: measuring software checksum speed
[ 0.249512] arm4regs : 1247.200 MB/sec
[ 0.349512] 8regs : 867.600 MB/sec
[ 0.449510] 32regs : 890.800 MB/sec
[ 0.549509] neon : 1697.200 MB/sec
[ 0.549517] xor: using function: neon (1697.200 MB/sec)
[ 0.549533] pinctrl core: initialized pinctrl subsystem
[ 0.549882] regulator-dummy: no parameters
[ 0.557028] NET: Registered protocol family 16
[ 0.557603] DMA: preallocated 256 KiB pool for atomic coherent
allocations
[ 0.558242] cpuidle: using governor ladder
[ 0.558254] cpuidle: using governor menu
[ 0.564201] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800
size 568
[ 0.564941] platform 49000000.edma: alias fck already exists
[ 0.564960] platform 49000000.edma: alias fck already exists
[ 0.564972] platform 49000000.edma: alias fck already exists
[ 0.565487] OMAP GPIO hardware version 0.1
[ 0.571260] No ATAGs?
[ 0.571277] hw-breakpoint: debug architecture 0x4 unsupported.
[ 0.572133] omap_init_mbox: hwmod doesn't have valid attrs
[ 0.749559] raid6: int32x1 172 MB/s
[ 0.919602] raid6: int32x2 252 MB/s
[ 1.089653] raid6: int32x4 222 MB/s
[ 1.259677] raid6: int32x8 189 MB/s
[ 1.429553] raid6: neonx1 1335 MB/s
[ 1.599520] raid6: neonx2 1494 MB/s
[ 1.769541] raid6: neonx4 1189 MB/s
[ 1.939611] raid6: neonx8 386 MB/s
[ 1.939619] raid6: using algorithm neonx2 (1494 MB/s)
[ 1.939625] raid6: using intx1 recovery algorithm
[ 1.946017] edma-dma-engine edma-dma-engine.0: TI EDMA DMA engine driver
[ 1.946505] vbat: 5000 mV
[ 1.946716] vmmcsd_fixed: 3300 mV
[ 1.948524] SCSI subsystem initialized
[ 1.949169] usbcore: registered new interface driver usbfs
[ 1.949229] usbcore: registered new interface driver hub
[ 1.949352] usbcore: registered new device driver usb
[ 1.951156] input: tps65217_pwr_but as
/devices/ocp.3/44e0b000.i2c/i2c-0/0-0024/input/input0
[ 1.952344] DCDC1: at 1500 mV
[ 1.953150] vdd_mpu: 925 <--> 1325 mV at 1325 mV
[ 1.953914] vdd_core: 925 <--> 1150 mV at 1125 mV
[ 1.954677] LDO1: at 1800 mV
[ 1.955440] LDO2: at 3300 mV
[ 1.956697] LDO3: 1800 mV
[ 1.957453] LDO4: at 3300 mV
[ 1.958156] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[ 1.958730] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 1.960776] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 1.960929] media: Linux media interface: v0.10
[ 1.960989] Linux video capture interface: v2.00
[ 1.961081] pps_core: LinuxPPS API ver. 1 registered
[ 1.961088] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo
Giometti <giometti@linux.it>
[ 1.961111] PTP clock support registered
[ 1.961784] Advanced Linux Sound Architecture Driver Initialized.
[ 1.962313] NetLabel: Initializing
[ 1.962324] NetLabel: domain hash size = 128
[ 1.962329] NetLabel: protocols = UNLABELED CIPSOv4
[ 1.962385] NetLabel: unlabeled traffic allowed by default
[ 1.962598] Switched to clocksource timer1
[ 2.000188] NET: Registered protocol family 2
[ 2.000940] TCP established hash table entries: 4096 (order: 2, 16384
bytes)
[ 2.000985] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[ 2.001023] TCP: Hash tables configured (established 4096 bind 4096)
[ 2.001077] TCP: reno registered
[ 2.001089] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 2.001105] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 2.001246] NET: Registered protocol family 1
[ 2.001598] RPC: Registered named UNIX socket transport module.
[ 2.001610] RPC: Registered udp transport module.
[ 2.001616] RPC: Registered tcp transport module.
[ 2.001622] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 2.002318] hw perfevents: enabled with ARMv7 Cortex-A8 PMU driver, 5
counters available
[ 2.003690] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 2.003757] audit: initializing netlink subsys (disabled)
[ 2.003809] audit: type=2000 audit(2.000:1): initialized
[ 2.216893] VFS: Disk quotas dquot_6.5.2
[ 2.217068] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[ 2.218581] NFS: Registering the id_resolver key type
[ 2.218640] Key type id_resolver registered
[ 2.218648] Key type id_legacy registered
[ 2.218663] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 2.218920] fuse init (API version 7.23)
[ 2.219302] SGI XFS with ACLs, security attributes, realtime, large
block/inode numbers, no debug enabled
[ 2.220858] msgmni has been set to 989
[ 2.221735] Block layer SCSI generic (bsg) driver version 0.4 loaded
(major 249)
[ 2.221829] io scheduler noop registered
[ 2.221839] io scheduler deadline registered
[ 2.221890] io scheduler cfq registered (default)
[ 2.224180] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[ 2.225869] omap_uart 44e09000.serial: no wakeirq for uart0
[ 2.226167] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88,
base_baud = 3000000) is a OMAP UART0
[ 3.069115] console [ttyO0] enabled
[ 3.074194] omap_rng 48310000.rng: OMAP Random Number Generator ver. 20
[ 3.081298] [drm] Initialized drm 1.1.0 20060810
[ 3.086269] usbcore: registered new interface driver udl
[ 3.091993] at24 0-0050: 32768 byte 24c256 EEPROM, writable, 1
bytes/write
[ 3.099263] at24 2-0054: 32768 byte 24c256 EEPROM, writable, 1
bytes/write
[ 3.106519] at24 2-0055: 32768 byte 24c256 EEPROM, writable, 1
bytes/write
[ 3.113772] at24 2-0056: 32768 byte 24c256 EEPROM, writable, 1
bytes/write
[ 3.121010] at24 2-0057: 32768 byte 24c256 EEPROM, writable, 1
bytes/write
[ 3.130328] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 3.137235] ehci-platform: EHCI generic platform driver
[ 3.142845] ehci-omap: OMAP-EHCI Host Controller driver
[ 3.148470] usbcore: registered new interface driver usb-storage
[ 3.155987] 47401300.usb-phy supply vcc not found, using dummy regulator
[ 3.165089] musb-hdrc musb-hdrc.0.auto: MUSB HDRC host driver
[ 3.171355] musb-hdrc musb-hdrc.0.auto: new USB bus registered,
assigned bus number 1
[ 3.179810] usb usb1: New USB device found, idVendor=1d6b,
idProduct=0002
[ 3.186952] usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 3.194538] usb usb1: Product: MUSB HDRC host driver
[ 3.199745] usb usb1: Manufacturer: Linux 3.15.10-bone8 musb-hcd
[ 3.206054] usb usb1: SerialNumber: musb-hdrc.0.auto
[ 3.211821] hub 1-0:1.0: USB hub found
[ 3.215810] hub 1-0:1.0: 1 port detected
[ 3.220998] 47401b00.usb-phy supply vcc not found, using dummy regulator
[ 3.230033] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 3.236340] musb-hdrc musb-hdrc.1.auto: new USB bus registered,
assigned bus number 2
[ 3.244751] usb usb2: New USB device found, idVendor=1d6b,
idProduct=0002
[ 3.251875] usb usb2: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[ 3.259467] usb usb2: Product: MUSB HDRC host driver
[ 3.264686] usb usb2: Manufacturer: Linux 3.15.10-bone8 musb-hcd
[ 3.270987] usb usb2: SerialNumber: musb-hdrc.1.auto
[ 3.276761] hub 2-0:1.0: USB hub found
[ 3.280722] hub 2-0:1.0: 1 port detected
[ 3.292135] mousedev: PS/2 mouse device common for all mice
[ 3.298397] i2c /dev entries driver
[ 3.302470] IR Sharp protocol handler initialized
[ 3.308484] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60
sec
[ 3.315996] sdhci: Secure Digital Host Controller Interface driver
[ 3.322475] sdhci: Copyright(c) Pierre Ossman
[ 3.400084] mmc0: host does not support reading read-only switch.
assuming write-enable.
[ 3.408804] sdhci-pltfm: SDHCI platform and OF driver helper
[ 3.415606] ledtrig-cpu: registered to indicate activity on CPUs
[ 3.421999] hidraw: raw HID events driver (C) Jiri Kosina
[ 3.427954] mmc0: new high speed SDHC card at address 1234
[ 3.434775] usbcore: registered new interface driver usbhid
[ 3.440623] usbhid: USB HID core driver
[ 3.444868] mmcblk0: mmc0:1234 SA04G 3.63 GiB
[ 3.450524] ashmem: initialized
[ 3.454059] mmcblk0: p1
[ 3.464454] davinci_evm sound.8: tlv320aic3x-hifi <-> 48038000.mcasp
mapping ok
[ 3.474922] oprofile: using arm/armv7
[ 3.478968] TCP: cubic registered
[ 3.482976] NET: Registered protocol family 10
[ 3.488533] mip6: Mobile IPv6
[ 3.491654] NET: Registered protocol family 17
[ 3.496430] Key type dns_resolver registered
[ 3.500908] mpls_gso: MPLS GSO support
[ 3.506006] ThumbEE CPU extension supported.
[ 3.510539] Registering SWP/SWPB emulation handler
[ 3.515592] SmartReflex Class3 initialized
[ 3.520793] registered taskstats version 1
[ 3.527035] Btrfs loaded
[ 3.529805] vbat: disabling
[ 3.532799] Error: Driver 'tfp410' is already registered, aborting...
[ 3.575804] mmc1: BKOPS_EN bit is not set
[ 3.582416] mmc1: new high speed MMC card at address 0001
[ 3.588554] mmcblk1: mmc1:0001 MMC02G 1.78 GiB
[ 3.593541] mmcblk1boot0: mmc1:0001 MMC02G partition 1 1.00 MiB
[ 3.599893] mmcblk1boot1: mmc1:0001 MMC02G partition 2 1.00 MiB
[ 3.607855] mmcblk1: p1 p2
[ 3.612499] mmcblk1boot1: unknown partition table
[ 3.618878] mmcblk1boot0: unknown partition table
[ 3.654930] tda998x 0-0070: found TDA19988
[ 3.660124] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 3.667084] [drm] No driver support for vblank timestamp query.
[ 3.742673] usb 2-1: new high-speed USB device number 2 using musb-hdrc
[ 3.763700] Console: switching to colour frame buffer device 160x64
[ 3.786838] tilcdc 4830e000.lcdc: fb0: frame buffer device
[ 3.792706] tilcdc 4830e000.lcdc: registered panic notifier
[ 3.798564] [drm] Initialized tilcdc 1.0.0 20121205 on minor 0
[ 3.862733] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
[ 3.869154] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[ 3.876875] libphy: 4a101000.mdio: probed
[ 3.881094] davinci_mdio 4a101000.mdio: phy[0]: device
4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[ 3.891262] Detected MACID = c8:a0:30:ac:53:16
[ 3.896925] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[ 3.903565] sr_init: No PMIC hook to init smartreflex
[ 3.908998] sr_init: platform driver register failed for SR
[ 3.917835] net eth0: initializing cpsw version 1.12 (0)
[ 3.926494] usb 2-1: New USB device found, idVendor=05e3, idProduct=0608
[ 3.933551] usb 2-1: New USB device strings: Mfr=0, Product=1,
SerialNumber=0
[ 3.941034] usb 2-1: Product: USB2.0 Hub
[ 3.946056] hub 2-1:1.0: USB hub found
[ 3.950252] hub 2-1:1.0: 4 ports detected
[ 4.003384] net eth0: phy found : id is : 0x7c0f1
[ 4.008385] libphy: PHY 4a101000.mdio:01 not found
[ 4.013426] net eth0: phy 4a101000.mdio:01 not found on slave 1
[ 4.020685] net eth0: BQL enabled
[ 4.029735] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 4.232821] usb 2-1.1: new full-speed USB device number 3 using
musb-hdrc
[ 4.364433] usb 2-1.1: device v0a12 p0001 is not supported
[ 4.370192] usb 2-1.1: New USB device found, idVendor=0a12,
idProduct=0001
[ 4.377420] usb 2-1.1: New USB device strings: Mfr=0, Product=0,
SerialNumber=0
[ 4.462824] usb 2-1.4: new full-speed USB device number 4 using
musb-hdrc
[ 4.564042] usb 2-1.4: device v05a4 p2000 is not supported
[ 4.569799] usb 2-1.4: New USB device found, idVendor=05a4,
idProduct=2000
[ 4.577025] usb 2-1.4: New USB device strings: Mfr=1, Product=2,
SerialNumber=0
[ 4.584707] usb 2-1.4: Product:
[ 4.589548] usb 2-1.4: Manufacturer:
[ 7.083226] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full -
flow control rx/tx
[ 7.092644] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[ 7.112996] IP-Config: Complete:
[ 7.116392] device=eth0, hwaddr=c8:a0:30:ac:53:16,
ipaddr=10.100.116.105, mask=255.255.255.0, gw=10.100.116.1
[ 7.127279] host=10.100.116.105, domain=, nis-domain=(none)
[ 7.133593] bootserver=10.100.116.73, rootserver=10.100.116.73,
rootpath=
[ 7.141315] ALSA device list:
[ 7.144442] #0: DA830 EVM
[ 7.177874] VFS: Mounted root (nfs filesystem) on device 0:14.
[ 7.184386] devtmpfs: mounted
[ 7.187873] Freeing unused kernel memory: 328K (c08e7000 - c0939000)
INIT: version 2.88 booting
INIT: /run/initctl is not a fifo
Using makefile-style concurrent boot in runlevel S.
INIT: Entering runlevel: 2
INIT: /run/initctl is not a fifo
Using makefile-style concurrent boot in runlevel 2.
INIT: /run/initctl is not a fifo
[ 297.463950] random: nonblocking pool is initialized
[ 602.132624] tilcdc 4830e000.lcdc: timeout waiting for framedone

Regards,

John

The kernel has to be compiled with -O2 or more:
http://www.tldp.org/LDP/lkmpg/2.4/html/x208.html

The kernel has to be compiled with -O2 or more:
http://www.tldp.org/LDP/lkmpg/2.4/html/x208.html

Thanks Przemek , but this article is for Kernel Modules and not for the kernel. Perhaps something has changed, but I recall years ago that I was able to compile the kernel with O1, but not with O0.

Regards,
John

The kernel has to be compiled with -O2 or more:
http://www.tldp.org/LDP/lkmpg/2.4/html/x208.html

Instead of using NFS, I used an SDCard and it booted just fine with O1 optimization. Strange.

Regards,
John

As I understand , kernel compile with -O2 is against -O3 and -O4 .
about the nfsroot failed , you should check your nfs server config

how do you generate your nfs server rootfs ?