Revision f37755490fe9bf76f6ba1d8c6591745d3574a6a6 authored by Steven Rostedt (Red Hat) on 15 February 2016, 17:36:14 UTC, committed by Steven Rostedt on 15 February 2016, 18:04:46 UTC
The tracepoint infrastructure uses RCU sched protection to enable and
disable tracepoints safely. There are some instances where tracepoints are
used in infrastructure code (like kfree()) that get called after a CPU is
going offline, and perhaps when it is coming back online but hasn't been
registered yet.

This can probuce the following warning:

 [ INFO: suspicious RCU usage. ]
 4.4.0-00006-g0fe53e8-dirty #34 Tainted: G S
 -------------------------------
 include/trace/events/kmem.h:141 suspicious rcu_dereference_check() usage!

 other info that might help us debug this:

 RCU used illegally from offline CPU!  rcu_scheduler_active = 1, debug_locks = 1
 no locks held by swapper/8/0.

 stack backtrace:
  CPU: 8 PID: 0 Comm: swapper/8 Tainted: G S              4.4.0-00006-g0fe53e8-dirty #34
  Call Trace:
  [c0000005b76c78d0] [c0000000008b9540] .dump_stack+0x98/0xd4 (unreliable)
  [c0000005b76c7950] [c00000000010c898] .lockdep_rcu_suspicious+0x108/0x170
  [c0000005b76c79e0] [c00000000029adc0] .kfree+0x390/0x440
  [c0000005b76c7a80] [c000000000055f74] .destroy_context+0x44/0x100
  [c0000005b76c7b00] [c0000000000934a0] .__mmdrop+0x60/0x150
  [c0000005b76c7b90] [c0000000000e3ff0] .idle_task_exit+0x130/0x140
  [c0000005b76c7c20] [c000000000075804] .pseries_mach_cpu_die+0x64/0x310
  [c0000005b76c7cd0] [c000000000043e7c] .cpu_die+0x3c/0x60
  [c0000005b76c7d40] [c0000000000188d8] .arch_cpu_idle_dead+0x28/0x40
  [c0000005b76c7db0] [c000000000101e6c] .cpu_startup_entry+0x50c/0x560
  [c0000005b76c7ed0] [c000000000043bd8] .start_secondary+0x328/0x360
  [c0000005b76c7f90] [c000000000008a6c] start_secondary_prolog+0x10/0x14

This warning is not a false positive either. RCU is not protecting code that
is being executed while the CPU is offline.

Instead of playing "whack-a-mole(TM)" and adding conditional statements to
the tracepoints we find that are used in this instance, simply add a
cpu_online() test to the tracepoint code where the tracepoint will be
ignored if the CPU is offline.

Use of raw_smp_processor_id() is fine, as there should never be a case where
the tracepoint code goes from running on a CPU that is online and suddenly
gets migrated to a CPU that is offline.

Link: http://lkml.kernel.org/r/1455387773-4245-1-git-send-email-kda@linux-powerpc.org

Reported-by: Denis Kirjanov <kda@linux-powerpc.org>
Fixes: 97e1c18e8d17b ("tracing: Kernel Tracepoints")
Cc: stable@vger.kernel.org # v2.6.28+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 18558ca
Raw File
00-INDEX
00-INDEX
	- this file (info on some of the filesystems supported by linux).
Locking
	- info on locking rules as they pertain to Linux VFS.
Makefile
	- Makefile for building the filsystems-part of DocBook.
9p.txt
	- 9p (v9fs) is an implementation of the Plan 9 remote fs protocol.
adfs.txt
	- info and mount options for the Acorn Advanced Disc Filing System.
afs.txt
	- info and examples for the distributed AFS (Andrew File System) fs.
affs.txt
	- info and mount options for the Amiga Fast File System.
autofs4-mount-control.txt
	- info on device control operations for autofs4 module.
automount-support.txt
	- information about filesystem automount support.
befs.txt
	- information about the BeOS filesystem for Linux.
bfs.txt
	- info for the SCO UnixWare Boot Filesystem (BFS).
btrfs.txt
	- info for the BTRFS filesystem.
caching/
	- directory containing filesystem cache documentation.
ceph.txt
	- info for the Ceph Distributed File System.
cifs/
	- directory containing CIFS filesystem documentation and example code.
coda.txt
	- description of the CODA filesystem.
configfs/
	- directory containing configfs documentation and example code.
cramfs.txt
	- info on the cram filesystem for small storage (ROMs etc).
dax.txt
	- info on avoiding the page cache for files stored on CPU-addressable
	  storage devices.
debugfs.txt
	- info on the debugfs filesystem.
devpts.txt
	- info on the devpts filesystem.
directory-locking
	- info about the locking scheme used for directory operations.
dlmfs.txt
	- info on the userspace interface to the OCFS2 DLM.
dnotify.txt
	- info about directory notification in Linux.
dnotify_test.c
	- example program for dnotify.
ecryptfs.txt
	- docs on eCryptfs: stacked cryptographic filesystem for Linux.
efivarfs.txt
	- info for the efivarfs filesystem.
exofs.txt
	- info, usage, mount options, design about EXOFS.
ext2.txt
	- info, mount options and specifications for the Ext2 filesystem.
ext3.txt
	- info, mount options and specifications for the Ext3 filesystem.
ext4.txt
	- info, mount options and specifications for the Ext4 filesystem.
f2fs.txt
	- info and mount options for the F2FS filesystem.
fiemap.txt
	- info on fiemap ioctl.
files.txt
	- info on file management in the Linux kernel.
fuse.txt
	- info on the Filesystem in User SpacE including mount options.
gfs2-glocks.txt
	- info on the Global File System 2 - Glock internal locking rules.
gfs2-uevents.txt
	- info on the Global File System 2 - uevents.
gfs2.txt
	- info on the Global File System 2.
hfs.txt
	- info on the Macintosh HFS Filesystem for Linux.
hfsplus.txt
	- info on the Macintosh HFSPlus Filesystem for Linux.
hpfs.txt
	- info and mount options for the OS/2 HPFS.
inotify.txt
	- info on the powerful yet simple file change notification system.
isofs.txt
	- info and mount options for the ISO 9660 (CDROM) filesystem.
jfs.txt
	- info and mount options for the JFS filesystem.
locks.txt
	- info on file locking implementations, flock() vs. fcntl(), etc.
logfs.txt
	- info on the LogFS flash filesystem.
mandatory-locking.txt
	- info on the Linux implementation of Sys V mandatory file locking.
ncpfs.txt
	- info on Novell Netware(tm) filesystem using NCP protocol.
nfs/
	- nfs-related documentation.
nilfs2.txt
	- info and mount options for the NILFS2 filesystem.
ntfs.txt
	- info and mount options for the NTFS filesystem (Windows NT).
ocfs2.txt
	- info and mount options for the OCFS2 clustered filesystem.
omfs.txt
	- info on the Optimized MPEG FileSystem.
path-lookup.txt
	- info on path walking and name lookup locking.
pohmelfs/
	- directory containing pohmelfs filesystem documentation.
porting
	- various information on filesystem porting.
proc.txt
	- info on Linux's /proc filesystem.
qnx6.txt
	- info on the QNX6 filesystem.
quota.txt
	- info on Quota subsystem.
ramfs-rootfs-initramfs.txt
	- info on the 'in memory' filesystems ramfs, rootfs and initramfs.
relay.txt
	- info on relay, for efficient streaming from kernel to user space.
romfs.txt
	- description of the ROMFS filesystem.
seq_file.txt
	- how to use the seq_file API.
sharedsubtree.txt
	- a description of shared subtrees for namespaces.
spufs.txt
	- info and mount options for the SPU filesystem used on Cell.
squashfs.txt
	- info on the squashfs filesystem.
sysfs-pci.txt
	- info on accessing PCI device resources through sysfs.
sysfs-tagging.txt
	- info on sysfs tagging to avoid duplicates.
sysfs.txt
	- info on sysfs, a ram-based filesystem for exporting kernel objects.
sysv-fs.txt
	- info on the SystemV/V7/Xenix/Coherent filesystem.
tmpfs.txt
	- info on tmpfs, a filesystem that holds all files in virtual memory.
ubifs.txt
	- info on the Unsorted Block Images FileSystem.
udf.txt
	- info and mount options for the UDF filesystem.
ufs.txt
	- info on the ufs filesystem.
vfat.txt
	- info on using the VFAT filesystem used in Windows NT and Windows 95.
vfs.txt
	- overview of the Virtual File System.
xfs-delayed-logging-design.txt
	- info on the XFS Delayed Logging Design.
xfs-self-describing-metadata.txt
	- info on XFS Self Describing Metadata.
xfs.txt
	- info and mount options for the XFS filesystem.
back to top