linux-stable/drivers
Tejun Heo e2f15f9a79 netconsole: implement extended console support
printk logbuf keeps various metadata and optional key=value dictionary for
structured messages, both of which are stripped when messages are handed
to regular console drivers.

It can be useful to have this metadata and dictionary available to
netconsole consumers.  This obviously makes logging via netconsole more
complete and the sequence number in particular is useful in environments
where messages may be lost or reordered in transit - e.g.  when netconsole
is used to collect messages in a large cluster where packets may have to
travel congested hops to reach the aggregator.  The lost and reordered
messages can easily be identified and handled accordingly using the
sequence numbers.

printk recently added extended console support which can be selected by
setting CON_EXTENDED flag.  From console driver side, not much changes.
The only difference is that the text passed to the write callback is
formatted the same way as /dev/kmsg.

This patch implements extended console support for netconsole which can be
enabled by either prepending "+" to a netconsole boot param entry or
echoing 1 to "extended" file in configfs.  When enabled, netconsole
transmits extended log messages with headers identical to /dev/kmsg
output.

There's one complication due to message fragments.  netconsole limits the
maximum message size to 1k and messages longer than that are split into
multiple fragments.  As all extended console messages should carry
matching headers and be uniquely identifiable, each extended message
fragment carries full copy of the metadata and an extra header field to
identify the specific fragment.  The optional header is of the form
"ncfrag=OFF/LEN" where OFF is the byte offset into the message body and
LEN is the total length.

To avoid unnecessarily making printk format extended messages, Extended
netconsole is registered with printk when the first extended netconsole is
configured.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: David Miller <davem@davemloft.net>
Cc: Kay Sievers <kay@vrfy.org>
Cc: Petr Mladek <pmladek@suse.cz>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-06-25 17:00:39 -07:00
..
accessibility
acpi Power management and ACPI material for v4.2-rc1 2015-06-23 14:18:07 -07:00
amba
android
ata
atm
auxdisplay
base regmap: Fixes for v4.2 2015-06-23 17:25:32 -07:00
bcma
block zram: check comp algorithm availability earlier 2015-06-25 17:00:37 -07:00
bluetooth Bluetooth: ath3k: Add support of 04ca:300d AR3012 device 2015-06-18 21:00:06 +03:00
bus Power management and ACPI material for v4.2-rc1 2015-06-23 14:18:07 -07:00
cdrom
char powerpc updates for 4.2 2015-06-24 08:46:32 -07:00
clk Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
clocksource clocksource: Increase dependencies of timer-stm32 to limit build wreckage 2015-06-21 20:01:48 +02:00
connector
cpufreq Power management and ACPI material for v4.2-rc1 2015-06-23 14:18:07 -07:00
cpuidle Merge branch 'pm-cpuidle' 2015-06-22 15:15:36 +02:00
crypto Power management and ACPI material for v4.2-rc1 2015-06-23 14:18:07 -07:00
dca
devfreq
dio
dma Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
dma-buf
edac EDAC, mce_amd_inj: Set MISCV on injection 2015-06-24 18:17:38 +02:00
eisa
extcon
firewire
firmware Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:10:44 -07:00
fmc
gpio Here is the bulk of pin control changes for the v4.2 series: 2015-06-24 19:21:02 -07:00
gpu Power management and ACPI material for v4.2-rc1 2015-06-23 14:18:07 -07:00
hid Merge branches 'for-4.2/i2c-hid', 'for-4.2/lenovo', 'for-4.2/plantronics', 'for-4.2/rmi', 'for-4.2/sensor-hub', 'for-4.2/sjoy', 'for-4.2/sony' and 'for-4.2/wacom' into for-linus 2015-06-22 16:23:43 +02:00
hsi HSI: nokia-modem: use flags argument of devm_gpiod_get to set direction 2015-06-23 02:40:03 +02:00
hv
hwmon hwmon changes for v4.2 2015-06-23 13:39:56 -07:00
hwspinlock
hwtracing/coresight
i2c == Changes to existing drivers == 2015-06-23 17:31:27 -07:00
ide
idle
iio
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-06-24 19:56:58 -07:00
iommu IOMMU Updates for Linux v4.2 2015-06-23 18:27:19 -07:00
ipack
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 19:42:56 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
leds Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-06-24 19:56:58 -07:00
lguest Merge branch 'x86-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-06-22 17:59:09 -07:00
macintosh
mailbox
mcb
md
media Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-06-23 14:08:54 -07:00
memory
memstick
message
mfd Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
misc drivers/misc/altera-stapl/altera.c: remove extraneous KERN_INFO prefix 2015-06-25 17:00:38 -07:00
mmc mmc: queue: prevent soft lockups on PREEMPT=n 2015-06-18 09:21:04 +02:00
mtd powerpc updates for 4.2 2015-06-24 08:46:32 -07:00
net netconsole: implement extended console support 2015-06-25 17:00:39 -07:00
nfc
ntb PCI changes for the v4.2 merge window: 2015-06-23 13:41:24 -07:00
nubus
of Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
oprofile
parisc
parport
pci Mohit Kumar has moved 2015-06-25 17:00:38 -07:00
pcmcia pcmcia: do not break rsrc_nonstatic when handling anonymous cards 2015-06-16 07:29:39 +02:00
phy Mohit Kumar has moved 2015-06-25 17:00:38 -07:00
pinctrl Here is the bulk of pin control changes for the v4.2 series: 2015-06-24 19:21:02 -07:00
platform == Changes to existing drivers == 2015-06-23 17:31:27 -07:00
pnp Merge branches 'pnp' and 'pm-tools' 2015-06-19 01:18:43 +02:00
power power supply and reset changes for the v4.2 series 2015-06-23 16:10:27 -07:00
powercap
pps
ps3
ptp
pwm pwm: Changes for v4.2-rc1 2015-06-23 13:32:38 -07:00
rapidio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-06-23 14:08:54 -07:00
ras
regulator == Changes to existing drivers == 2015-06-23 17:31:27 -07:00
remoteproc
reset
rpmsg
rtc == Changes to existing drivers == 2015-06-23 17:31:27 -07:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
sbus
scsi Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
sfi
sh
sn
soc
spi Merge remote-tracking branches 'spi/topic/sirf', 'spi/topic/spidev' and 'spi/topic/zynq' into spi-next 2015-06-18 00:19:56 +01:00
spmi
ssb
staging Merge branch 'akpm' (patches from Andrew) 2015-06-24 20:47:21 -07:00
target Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
tc
thermal
thunderbolt
tty Merge branch 'akpm' (patches from Andrew) 2015-06-24 20:47:21 -07:00
uio
usb Pratyush Anand has moved 2015-06-25 17:00:38 -07:00
uwb
vfio powerpc updates for 4.2 2015-06-24 08:46:32 -07:00
vhost Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-06-24 16:49:49 -07:00
video == Changes to existing drivers == 2015-06-24 18:57:00 -07:00
virt
virtio PCI changes for the v4.2 merge window: 2015-06-23 13:41:24 -07:00
vlynq
vme
w1
watchdog
xen frontswap: allow multiple backends 2015-06-24 17:49:45 -07:00
zorro
Kconfig
Makefile