linux/include
Steven Rostedt (Red Hat) bef794e8c8 tracing: Fix trace_printk() to print when not using bprintk()
[ Upstream commit 3debb0a9dd ]

The trace_printk() code will allocate extra buffers if the compile detects
that a trace_printk() is used. To do this, the format of the trace_printk()
is saved to the __trace_printk_fmt section, and if that section is bigger
than zero, the buffers are allocated (along with a message that this has
happened).

If trace_printk() uses a format that is not a constant, and thus something
not guaranteed to be around when the print happens, the compiler optimizes
the fmt out, as it is not used, and the __trace_printk_fmt section is not
filled. This means the kernel will not allocate the special buffers needed
for the trace_printk() and the trace_printk() will not write anything to the
tracing buffer.

Adding a "__used" to the variable in the __trace_printk_fmt section will
keep it around, even though it is set to NULL. This will keep the string
from being printed in the debugfs/tracing/printk_formats section as it is
not needed.

Reported-by: Vlastimil Babka <vbabka@suse.cz>
Fixes: 07d777fe8c "tracing: Add percpu buffers for trace_printk()"
Cc: stable@vger.kernel.org # v3.5+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
History 2016-04-18 08:51:06 -04:00
..
acpi ACPICA: Tables: Enable default 64-bit FADT addresses favor 2015-08-03 09:29:14 -07:00
asm-generic bitops: Do not default to __clear_bit() for __clear_bit_unlock() 2016-04-18 08:51:05 -04:00
clocksource time: move the timecounter/cyclecounter code into its own file. 2014-12-30 18:29:25 -05:00
crypto crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path 2016-02-03 16:23:19 -05:00
drm drm/dp/mst: move GUID storage from mgr, port to only mst branch 2016-04-13 17:14:24 -04:00
dt-bindings Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
keys KEYS: Restore partial ID matching functionality for asymmetric keys 2014-10-06 15:21:05 +01:00
kvm KVM/ARM changes for v4.1: 2015-04-07 18:09:20 +02:00
linux tracing: Fix trace_printk() to print when not using bprintk() 2016-04-18 08:51:06 -04:00
math-emu math-emu: fix floating-point to integer overflow detection 2014-01-07 18:36:24 -06:00
media Merge branch 'patchwork' into v4l_for_linus 2015-04-21 06:12:35 -03:00
memory ddr: add LPDDR2 data from JESD209-2 2012-05-02 00:04:06 -07:00
misc cxl: Add new header for call backs and structs 2014-10-08 20:15:43 +11:00
net cfg80211/wext: fix message ordering 2016-03-17 23:13:32 -04:00
pcmcia pcmcia/ds.h: introduce helper for pcmcia_driver module boilerplate 2013-03-15 12:26:03 -07:00
ras PCI/AER: Rename PCI_ERR_UNC_TRAIN to PCI_ERR_UNC_UND 2014-09-25 09:42:40 -06:00
rdma IB/core: Fix unaligned accesses 2015-05-05 13:21:27 -04:00
rxrpc RxRPC: Handle VERSION Rx protocol packets 2015-04-01 16:31:26 +01:00
scsi Revert "libata-eh: Set 'information' field for autosense" 2015-09-13 09:07:46 -07:00
soc iommu/tegra-smmu: Parameterize number of TLB lines 2015-09-29 19:26:14 +02:00
sound ALSA: hda - Check the return value from pm_runtime_get/put*() 2016-04-18 08:50:48 -04:00
target target: Fix remote-port TMR ABORT + se_cmd fabric stop 2016-03-05 22:11:42 -05:00
trace net: sunrpc: fix tracepoint Warning: unknown op '->' 2015-09-29 19:26:10 +02:00
uapi net/ipv6: add sysctl option accept_ra_min_hop_limit 2016-03-04 10:25:48 -05:00
video fbdev changes for v4.1 2015-04-20 15:16:25 -07:00
xen x86/xen: Support kexec/kdump in HVM guests by doing a soft reset 2015-10-22 14:43:14 -07:00
Kbuild UAPI: remove empty Kbuild files 2013-04-30 17:04:09 -07:00