linux/drivers
John Ogness 2bb2b7b57f printk: add functions to prefer direct printing
Once kthread printing is available, console printing will no longer
occur in the context of the printk caller. However, there are some
special contexts where it is desirable for the printk caller to
directly print out kernel messages. Using pr_flush() to wait for
threaded printers is only possible if the caller is in a sleepable
context and the kthreads are active. That is not always the case.

Introduce printk_prefer_direct_enter() and printk_prefer_direct_exit()
functions to explicitly (and globally) activate/deactivate preferred
direct console printing. The term "direct console printing" refers to
printing to all enabled consoles from the context of the printk
caller. The term "prefer" is used because this type of printing is
only best effort. If the console is currently locked or other
printers are already actively printing, the printk caller will need
to rely on the other contexts to handle the printing.

This preferred direct printing is how all printing has been handled
until now (unless it was explicitly deferred).

When kthread printing is introduced, there may be some unanticipated
problems due to kthreads being unable to flush important messages.
In order to minimize such risks, preferred direct printing is
activated for the primary important messages when the system
experiences general types of major errors. These are:

 - emergency reboot/shutdown
 - cpu and rcu stalls
 - hard and soft lockups
 - hung tasks
 - warn
 - sysrq

Note that since kthread printing does not yet exist, no behavior
changes result from this commit. This is only implementing the
counter and marking the various places where preferred direct
printing is active.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Acked-by: Paul E. McKenney <paulmck@kernel.org> # for RCU
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220421212250.565456-13-john.ogness@linutronix.de
2022-04-22 21:30:58 +02:00
..
accessibility speakup-dectlk: Restore pitch setting 2022-02-08 12:15:04 +01:00
acpi Power management updates for 5.18-rc1 2022-03-21 14:26:28 -07:00
amba ARM: 9174/1: amba: Move EXPORT_SYMBOL() closer to definition 2022-02-28 13:59:18 +00:00
android
ata ata: pata_hpt37x: disable primary channel on HPT371 2022-02-23 09:39:37 +09:00
atm atm: eni: Add check for dma_map_single 2022-03-15 11:01:52 +00:00
auxdisplay auxdisplay: lcd2s: Use proper API to free the instance of charlcd object 2022-03-03 00:30:31 +01:00
base Merge branch 'akpm' (patches from Andrew) 2022-03-22 16:11:53 -07:00
bcma
block Folio changes for 5.18 2022-03-22 17:03:12 -07:00
bluetooth virtio,vdpa,qemu_fw_cfg: features, cleanups, fixes 2022-01-18 10:05:48 +02:00
bus spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
cdrom block: remove genhd.h 2022-02-02 07:49:59 -07:00
char Revert "random: block in /dev/urandom" 2022-03-22 09:17:20 -07:00
clk spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
clocksource ACPI updates for 5.18-rc1 2022-03-21 14:17:20 -07:00
comedi
connector connector/cn_proc: Use task_is_in_init_pid_ns() 2022-01-26 18:57:09 -08:00
counter counter: Stop using dev_get_drvdata() to get the counter device 2022-03-15 19:24:13 +01:00
cpufreq Merge branch 'pm-tools' 2022-03-18 18:46:15 +01:00
cpuidle cpuidle: haltpoll: Call cpuidle_poll_state_init() later 2022-03-09 19:59:45 +01:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2022-03-21 16:02:36 -07:00
cxl
dax Filesystem folio changes for 5.18 2022-03-22 18:26:56 -07:00
dca
devfreq
dio
dma ARM development updates for 5.18: 2022-03-21 10:55:18 -07:00
dma-buf dma-buf: heaps: Fix potential spectre v1 gadget 2022-02-01 13:18:09 +05:30
edac Merge branch 'edac-amd64' into edac-updates-for-v5.18 2022-03-21 10:34:57 +01:00
eisa
extcon
firewire
firmware pstore updates for v5.18-rc1 2022-03-21 19:24:47 -07:00
fpga
fsi
gnss
gpio spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
gpu Folio changes for 5.18 2022-03-22 17:03:12 -07:00
greybus
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2022-03-09 13:47:12 -08:00
hsi
hv Drivers: hv: utils: Make use of the helper macro LIST_HEAD() 2022-02-09 14:33:21 +00:00
hwmon spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
hwspinlock
hwtracing intel_th: msu: Use memset_startat() for clearing hw header 2022-02-13 16:48:04 -08:00
i2c i2c: brcmstb: fix support for DSL and CM variants 2022-02-18 10:37:33 +01:00
i3c i3c: master: dw: check return of dw_i3c_master_get_free_pos() 2022-01-13 02:05:50 +01:00
idle cpuidle: intel_idle: Drop redundant backslash at line end 2022-03-17 14:32:59 +01:00
iio spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
infiniband Folio changes for 5.18 2022-03-22 17:03:12 -07:00
input spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
interconnect
iommu Reenable ENQCMD/PASID support: 2022-03-21 12:28:13 -07:00
ipack
irqchip arm64 updates for 5.18 2022-03-21 10:46:39 -07:00
isdn isdn: hfcpci: check the return value of dma_set_mask() in setup_hw() 2022-03-07 11:27:12 +00:00
leds spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
macintosh macintosh/mac_hid.c: simplify subdirectory registration with register_sysctl() 2022-01-22 08:33:35 +02:00
mailbox - qcom: misc updates to qcom-ipcc driver 2022-01-13 11:19:07 -08:00
mcb
md for-5.18/drivers-2022-03-18 2022-03-21 17:16:01 -07:00
media bounds-fixes updates for v5.18-rc1 2022-03-21 19:58:27 -07:00
memory
memstick memstick/mspro_block: simplify refcounting 2022-02-16 19:44:24 -07:00
message
mfd spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
misc spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
mmc spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
most
mtd spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
mux
net spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
nfc spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
ntb ntb: intel: fix port config status offset for SPR 2022-01-28 10:19:16 -05:00
nubus proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
nvdimm Folio changes for 5.18 2022-03-22 17:03:12 -07:00
nvme Folio changes for 5.18 2022-03-22 17:03:12 -07:00
nvmem nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property 2022-02-21 17:59:25 +01:00
of cma: factor out minimum alignment requirement 2022-03-22 15:57:05 -07:00
opp
parisc parisc: Fix sglist access in ccio-dma.c 2022-01-28 10:15:34 +01:00
parport
pci Changes in this cycle were: 2022-03-22 14:39:12 -07:00
pcmcia pci-v5.17-changes 2022-01-16 08:08:11 +02:00
perf perf/marvell: Fix !CONFIG_OF build for CN10K DDR PMU driver 2022-03-09 12:31:00 +00:00
phy phy: dphy: Correct clk_pre parameter 2022-02-02 10:33:04 +05:30
pinctrl Linux 5.17-rc8 2022-03-14 18:53:00 +01:00
platform spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
pnp PNP update for 5.18-rc1 2022-03-21 14:46:01 -07:00
power power: supply: bq256xx: Handle OOM correctly 2022-02-11 21:19:51 +01:00
powercap powercap: DTPM: Fix spelling mistake "initialze" -> "initialize" 2022-03-01 18:59:35 +01:00
pps
ps3
ptp ptp: ocp: Add ptp_ocp_adjtime_coarse for large adjustments 2022-03-02 09:51:21 -08:00
pwm pwm: Changes for v5.17-rc1 2022-01-20 13:25:01 +02:00
rapidio
ras
regulator regulator: Updates for v5.18 2022-03-21 18:27:05 -07:00
remoteproc remoteproc: qcom: q6v5: fix service routines build errors 2022-01-17 16:44:26 -06:00
reset
rpmsg rpmsg fixes for v5.17-rc1 2022-01-27 11:23:26 +02:00
rtc spi: make remove callback a void function 2022-02-09 13:00:45 +00:00
s390 for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
sbus
scsi for-5.18/block-2022-03-18 2022-03-21 16:48:55 -07:00
sh
siox
slimbus
soc Power management updates for 5.18-rc1 2022-03-21 14:26:28 -07:00
soundwire Char/Misc and other driver changes for 5.17-rc1 2022-01-14 16:02:28 +01:00
spi spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
spmi
ssb
staging spi: Updates for v5.18 2022-03-21 18:33:57 -07:00
target block: pass a block_device and opf to bio_alloc 2022-02-02 07:49:59 -07:00
tc
tee OP-TEE fix error return code in probe functions 2022-02-18 17:30:01 +01:00
thermal Merge branch 'thermal-hfi' 2022-03-18 19:00:26 +01:00
thunderbolt
tty printk: add functions to prefer direct printing 2022-04-22 21:30:58 +02:00
uio
usb Folio changes for 5.18 2022-03-22 17:03:12 -07:00
vdpa vdpa: fix use-after-free on vp_vdpa_remove 2022-03-06 06:06:50 -05:00
vfio VFIO updates for v5.17-rc1 2022-01-20 13:31:46 +02:00
vhost Networking fixes for 5.17-final, including fixes from netfilter, ipsec, 2022-03-17 12:55:26 -07:00
video Filesystem folio changes for 5.18 2022-03-22 18:26:56 -07:00
virt virt: vmgenid: notify RNG of VM fork and supply generation ID 2022-03-12 18:00:56 -07:00
virtio mm: enforce pageblock_order < MAX_ORDER 2022-03-22 15:57:06 -07:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.17-rc1 tag 2022-01-17 08:07:57 +02:00
xen xen/gnttab: fix gnttab_end_foreign_access() without page specified 2022-03-07 09:48:55 +01:00
zorro proc: remove PDE_DATA() completely 2022-01-22 08:33:37 +02:00
Kconfig
Makefile