Project

General

Profile

Actions

Feature #13042

closed

make prom_debug more useful outside startup.c

Added by Joshua M. Clulow over 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Category:
kernel
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

We have a coarse-grained early boot debug logging facility that one may enable by setting prom_debug in the boot environment (set prom_debug=true in the loader, or boot -B). This facility uses prom_printf() to emit information about where we got up to, and the value of some variables, and is very helpful when your machine is hanging or crashing in very early boot before better debugging tools are available.

The mechanism is presently a set of macros within startup.c for i86pc, but during startup we call into routines in other files that do potentially risky device initialisation work. It would help if there was a common header (as there is on the SPARC side of things) that defined these macros. It would also help to sprinkle the macros around a bit in the APIC and HPET initialisation code. I added most of this while debugging #13039 recently.

Actions #1

Updated by Electric Monk over 3 years ago

  • Gerrit CR set to 849
Actions #2

Updated by Joshua M. Clulow about 3 years ago

Testing Notes

Built the change and installed in an OpenIndiana instance where I can get on the serial console. Then:

  • rebooted the normal way (without prom_debug) and confirmed that there is no spuriuos boot noise.
  • rebooted, escaped at the loader, set prom_debug=true, boot, and confirmed that the new output is visible.
    ok set prom_debug=true
    ok boot
    Loading unix...
    Loading /platform/i86pc/amd64/boot_archive...
    Loading /platform/i86pc/amd64/boot_archive.hash...
    Booting...
    |
    
    illumos prekernel set: /platform/i86pc/kernel/amd64/unix -B console=ttya
    
    ...
    
    ../../i86pc/os/startup.c:2276: psm_install()
    ../../i86pc/os/mp_implfuncs.c:405: 'swp->psw_infop->p_mach_idstring' is 'uppc'
    ../../i86pc/os/mp_implfuncs.c:408: psm_probe()
    ../../i86pc/os/mp_implfuncs.c:410: psm_probe() PSM_SUCCESS
    ../../i86pc/os/mp_implfuncs.c:405: 'swp->psw_infop->p_mach_idstring' is 'apix'
    ../../i86pc/os/mp_implfuncs.c:408: psm_probe()
    ../../i86pc/os/mp_implfuncs.c:416: psm_probe() FAILURE
    ../../i86pc/os/mp_implfuncs.c:405: 'swp->psw_infop->p_mach_idstring' is 'pcplusmp'
    ../../i86pc/os/mp_implfuncs.c:408: psm_probe()
    ../../i86pc/io/pcplusmp/apic.c:254: apic_probe()
    
    ...
    
    ../../i86pc/io/mp_platform_common.c:1041: hpet_acpi_init()
    ../../i86pc/io/hpet_acpi.c:153: no need to program the HPET
    ../../i86pc/io/mp_platform_common.c:1047: SUCCESS
    
    ...
    
    ../../i86pc/os/startup.c:2525: Boot pages released
    NOTICE: hma_vmx_init: CPU does not support VMX
    Hostname: oi0
    
    oi0 console login:
    
Actions #3

Updated by Electric Monk about 3 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

git commit fdcca78f421670bb8f04d68bc3f2762a4b5342be

commit  fdcca78f421670bb8f04d68bc3f2762a4b5342be
Author: Joshua M. Clulow <josh@sysmgr.org>
Date:   2020-09-12T23:51:32.000Z

    13042 make prom_debug more useful outside startup.c
    Reviewed by: Dan McDonald <danmcd@joyent.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF