freebsd-skq/sys/geom
jhb bcc5b0c55d Add an EARLY_AP_STARTUP option to start APs earlier during boot.
Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed).  This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP.  It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot.  Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system.  In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU.  Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code.  This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP).  This will allow the option to be turned off
if need be during initial testing.  I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0.  Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86.  Other platform maintainers
are encouraged to port their architectures over as well.  The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR:		kern/199321
Reviewed by:	markj, gnn, kib
Sponsored by:	Netflix
2016-05-14 18:22:52 +00:00
..
bde sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
cache
concat
eli Add an EARLY_AP_STARTUP option to start APs earlier during boot. 2016-05-14 18:22:52 +00:00
gate g_gate: for pointers replace 0 with NULL. 2016-04-15 16:18:07 +00:00
journal sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
label
linux_lvm
mirror sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
mountver
multipath Prevent g_access calls to bad multipath members 2015-12-15 21:11:41 +00:00
nop Make geom_nop(4) collect statistics on all types of BIOs, not just 2015-10-10 09:03:31 +00:00
part sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
raid sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
raid3 sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
sched Cleanup unnecessary semicolons from the kernel. 2016-04-10 23:07:00 +00:00
shsec
stripe
uzip Add missing include "opt_geom.h" to make GEOM_UZIP_DEBUG option working, 2016-05-06 20:32:39 +00:00
vinum sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
virstor sys: Make use of our rounddown() macro when sys/param.h is available. 2016-04-30 14:41:18 +00:00
zero
geom_aes.c
geom_bsd_enc.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_bsd.c
geom_ccd.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_ctl.c geom: unsign some types to match their definitions and avoid overflows. 2016-04-27 15:10:40 +00:00
geom_ctl.h
geom_dev.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_disk.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_disk.h
geom_dump.c
geom_event.c
geom_flashmap.c Teach the flashmap code about the SPI flash. 2016-01-23 05:26:29 +00:00
geom_fox.c
geom_int.h
geom_io.c Bump bio_cmd and bio_*flags from 8 bits to 16. 2016-04-14 05:10:41 +00:00
geom_kern.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_map.c Fix incorrect error message in geom map 2015-12-27 17:09:23 +00:00
geom_mbr_enc.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_mbr.c
geom_pc98_enc.c
geom_pc98.c
geom_redboot.c
geom_slice.c
geom_slice.h
geom_subr.c Bump bio_cmd and bio_*flags from 8 bits to 16. 2016-04-14 05:10:41 +00:00
geom_sunlabel_enc.c sys/geom: spelling fixes in comments. 2016-04-29 20:56:58 +00:00
geom_sunlabel.c
geom_vfs.c
geom_vfs.h
geom_vol_ffs.c
geom.h Create an API to reset a struct bio (g_reset_bio). This is mandatory 2016-02-17 17:16:02 +00:00
notes