aboutsummaryrefslogtreecommitdiff
path: root/drivers/oprofile
AgeCommit message (Collapse)Author
2008-12-29oprofile: simplify sync_buffer()Robert Richter
Make code more readable. No functional changes. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: simplify add_sample()Robert Richter
This patch removes add_us_sample() and simplifies add_sample(). Code is much more readable now. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: add inline function __oprofile_add_ext_sample()Robert Richter
This patch adds the inline function __oprofile_add_ext_sample() to cpu_buffer.c and thus reduces overhead when calling oprofile_add_sample(). Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: reordering some code in cpu_buffer.cRobert Richter
Reordering code to keep alloc/free functions together. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: remove ring buffer inline functions in cpu_buffer.hRobert Richter
This patch moves ring buffer inline functions to cpu_buffer.c. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: rename cpu buffer functionsRobert Richter
This patch renames cpu buffer functions to something more oprofile specific names. Functions will be moved to the global name space. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-16oprofile: rename kernel-wide identifiersRobert Richter
This patch renames kernel-wide identifiers to something more oprofile specific names. Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: fix lost sample counterRobert Richter
The number of lost samples could be greater than the number of received samples. This patches fixes this. The implementation introduces return values for add_sample() and add_code(). Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: remove nr_available_slots()Robert Richter
This function is no longer available after the port to the new ring buffer. Its removal can lead to incomplete sampling sequences since IBS samples and backtraces are transfered in multiple samples. Due to a full buffer, samples could be lost any time. The userspace daemon has to live with such incomplete sampling sequences as long as the data within one sample is consistent. This will be fixed by changing the internal buffer data there all data of one IBS sample or a backtrace is packed in a single ring buffer entry. This is possible since the new ring buffer supports variable data size. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: port to the new ring_bufferRobert Richter
This patch replaces the current oprofile cpu buffer implementation with the ring buffer provided by the tracing framework. The motivation here is to leave the pain of implementing ring buffers to others. Oh, no, there are more advantages. Main reason is the support of different sample sizes that could be stored in the buffer. Use cases for this are IBS and Cell spu profiling. Using the new ring buffer ensures valid and complete samples and allows copying the cpu buffer stateless without knowing its content. Second it will use generic kernel API and also reduce code size. And hopefully, there are less bugs. Since the new tracing ring buffer implementation uses spin locks to protect the buffer during read/write access, it is difficult to use the buffer in an NMI handler. In this case, writing to the buffer by the NMI handler (x86) could occur also during critical sections when reading the buffer. To avoid this, there are 2 buffers for independent read and write access. Read access is in process context only, write access only in the NMI handler. If the read buffer runs empty, both buffers are swapped atomically. There is potentially a small window during swapping where the buffers are disabled and samples could be lost. Using 2 buffers is a little bit overhead, but the solution is clear and does not require changes in the ring buffer implementation. It can be changed to a single buffer solution when the ring buffer access is implemented as non-locking atomic code. The new buffer requires more size to store the same amount of samples because each sample includes an u32 header. Also, there is more code to execute for buffer access. Nonetheless, the buffer implementation is proven in the ftrace environment and worth to use also in oprofile. Patches that changes the internal IBS buffer usage will follow. Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: moving cpu_buffer_reset() to cpu_buffer.hRobert Richter
This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: adding cpu_buffer_entries()Robert Richter
This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: adding cpu_buffer_write_commit()Robert Richter
This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: adding cpu buffer r/w access functionsRobert Richter
This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: set values to default when creating oprofilefsRobert Richter
This patch restores default values for: /dev/oprofile/cpu_buffer_size /dev/oprofile/buffer_watershed /dev/oprofile/buffer_size when creating the oprofilefs: # opcontrol --deinit # opcontrol --init # cat /dev/oprofile/cpu_buffer_size 8192 # echo 5123 > /dev/oprofile/cpu_buffer_size # cat /dev/oprofile/cpu_buffer_size 5123 # opcontrol --deinit # opcontrol --init # cat /dev/oprofile/cpu_buffer_size 8192 # opcontrol --deinit This sets the values in a defined state. Before, there was no way to restore the defaults without rebooting the system or reloading the module. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: implement switch/case in buffer_sync.cRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: fix typoRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: whitspace changes onlyRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: comment cleanupRobert Richter
This fixes the coding style of some comments. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-27oprofile: fix memory orderingNick Piggin
Regular bitops don't work as locks on all architectures. Also: can use non-atomic unlock as no concurrent stores to the word. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-23Merge branch 'for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile: (21 commits) OProfile: Fix buffer synchronization for IBS oprofile: hotplug cpu fix oprofile: fixing whitespaces in arch/x86/oprofile/* oprofile: fixing whitespaces in arch/x86/oprofile/* oprofile: fixing whitespaces in drivers/oprofile/* x86/oprofile: add the logic for enabling additional IBS bits x86/oprofile: reordering functions in nmi_int.c x86/oprofile: removing unused function parameter in add_ibs_begin() oprofile: more whitespace fixes oprofile: whitespace fixes OProfile: Rename IBS sysfs dir into "ibs_op" OProfile: Rework string handling in setup_ibs_files() OProfile: Rework oprofile_add_ibs_sample() function oprofile: discover counters for op ppro too oprofile: Implement Intel architectural perfmon support oprofile: Don't report Nehalem as core_2 oprofile: drop const in num counters field Revert "Oprofile Multiplexing Patch" x86, oprofile: BUG: using smp_processor_id() in preemptible code x86/oprofile: fix on_each_cpu build error ... Manually fixed trivial conflicts in drivers/oprofile/{cpu_buffer.c,event_buffer.h}
2008-10-21powerpc/oprofile: Fix mutex locking for cell spu-oprofileCarl Love
The issue is the SPU code is not holding the kernel mutex lock while adding samples to the kernel buffer. This patch creates per SPU buffers to hold the data. Data is added to the buffers from in interrupt context. The data is periodically pushed to the kernel buffer via a new Oprofile function oprofile_put_buff(). The oprofile_put_buff() function is called via a work queue enabling the funtion to acquire the mutex lock. The existing user controls for adjusting the per CPU buffer size is used to control the size of the per SPU buffers. Similarly, overflows of the SPU buffers are reported by incrementing the per CPU buffer stats. This eliminates the need to have architecture specific controls for the per SPU buffers which is not acceptable to the OProfile user tool maintainer. The export of the oprofile add_event_entry() is removed as it is no longer needed given this patch. Note, this patch has not addressed the issue of indexing arrays by the spu number. This still needs to be fixed as the spu numbering is not guarenteed to be 0 to max_num_spus-1. Signed-off-by: Carl Love <carll@us.ibm.com> Signed-off-by: Maynard Johnson <maynardj@us.ibm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Acked-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2008-10-20OProfile: Fix buffer synchronization for IBSBarry Kasindorf
The patch is needed since there is some IBS code in add_ibs_begin() that handles more than one sample per iteration. This requires calling get_slots() during each loop. This fixes the current problem, but a proper solution that reworks the cpu buffer synchronization is needed here in the future. Signed-off-by: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-17oprofile: hotplug cpu fixChris J Arges
This patch addresses problems when hotplugging cpus while profiling. Instead of allocating only online cpus, all possible cpu buffers are allocated, which allows cpus to be onlined during operation. If a cpu is offlined before profiling is shutdown wq_sync_buffer checks for this condition then cancels this work and does not sync this buffer. Signed-off-by: Chris J Arges <arges@linux.vnet.ibm.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-16oprofile: fixing whitespaces in drivers/oprofile/*Robert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15x86/oprofile: removing unused function parameter in add_ibs_begin()Robert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15oprofile: more whitespace fixesRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15oprofile: whitespace fixesRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15OProfile: Rework oprofile_add_ibs_sample() functionRobert Richter
Code looks much more cleaner now. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-13Merge branch 'linus' into oprofile-v2Ingo Molnar
Conflicts: arch/x86/kernel/apic_32.c arch/x86/oprofile/nmi_int.c include/linux/pci_ids.h
2008-09-24Merge commit 'v2.6.27-rc5' into tip/oprofileRobert Richter
Conflicts: arch/x86/oprofile/nmi_int.c
2008-09-24Revert "Oprofile Multiplexing Patch"Robert Richter
Reverting commit 1a960b402a51d80abf54e3f8e4972374ffe5f22d for the main branch. Multiplexing will be tracked on a separate feature branch. Conflicts: arch/x86/oprofile/nmi_int.c
2008-08-26powerpc/cell/oprofile: Avoid double vfree of profile bufferCarl Love
If an error occurs on opcontrol start, the event and per cpu buffers are released. If later opcontrol shutdown is called then the free function will be called again to free buffers that no longer exist. This results in a kernel oops. The following changes prevent the call to delete buffers that don't exist. Signed-off-by: Carl Love <carll@us.ibm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-07-26Oprofile Multiplexing PatchJason Yeh
This patch introduces multiplexing support for the Oprofile kernel module. It basically adds a new function pointer in oprofile_operator allowing each architecture to supply its callback to switch between different sets of event when the timer expires. Userspace tools can modify the time slice through /dev/oprofile/time_slice. It also modifies the number of counters exposed to the userspace through /dev/oprofile. For example, the number of counters for AMD CPUs are changed to 32 and multiplexed in the sets of 4. Signed-off-by: Jason Yeh <jason.yeh@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26oprofile: fix printk in cpu_buffer.cRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Cc: Robert Richter <robert.richter@amd.com> Cc: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26x86/oprofile: add CONFIG_OPROFILE_IBS optionRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Cc: Robert Richter <robert.richter@amd.com> Cc: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26x86/oprofile: add IBS support for AMD CPUs, IBS buffer handling routinesBarry Kasindorf
This patchset supports the new profiling hardware available in the latest AMD CPUs in the oProfile driver. Signed-off-by: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26OProfile: moving increment_tail() in buffer_sync.cRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Cc: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-07-26drivers/oprofile: coding style fixes in buffer_sync.cRobert Richter
Signed-off-by: Robert Richter <robert.richter@amd.com> Cc: oprofile-list <oprofile-list@lists.sourceforge.net> Cc: Barry Kasindorf <barry.kasindorf@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-05-14oprofile: don't request cache line alignment for cpu_bufferEric Dumazet
Alignment was previously requested because cpu_buffer was an [NR_CPUS] array, to avoid cache line sharing between CPUS. After commit 608dfddd845da5ab6accef70154c8910529699f7 (oprofile: change cpu_buffer from array to per_cpu variable ), we dont need to force an alignement anymore since cpu_buffer sits in per_cpu zone. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Cc: Mike Travis <travis@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-28oprofile: change cpu_buffer from array to per_cpu variableMike Travis
Change cpu_buffer from array to per_cpu variable in oprofile functions. [akpm@linux-foundation.org: coding-style fixes] Cc: Philippe Elie <phil.el@wanadoo.fr> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-14d_path: Make get_dcookie() use a struct path argumentJan Blunck
get_dcookie() is always called with a dentry and a vfsmount from a struct path. Make get_dcookie() take it directly as an argument. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jan Blunck <jblunck@suse.de> Acked-by: Christoph Hellwig <hch@infradead.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-11-14oProfile: oops when profile_pc() returns ~0LUPhilippe Elie
Instruction pointer returned by profile_pc() can be a random value. This break the assumption than we can safely set struct op_sample.eip field to a magic value to signal to the per-cpu buffer reader side special event like task switch ending up in a segfault in get_task_mm() when profile_pc() return ~0UL. Fixed by sanitizing the sampled eip and reject/log invalid eip. Problem reported by Sami Farin, patch tested by him. Signed-off-by: Philippe Elie <phil.el@wanadoo.fr> Tested-by: Sami Farin <safari-kernel@safari.iki.fi> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-20[CELL] oprofile: add support to OProfile for profiling CELL BE SPUsBob Nelson
From: Maynard Johnson <mpjohn@us.ibm.com> This patch updates the existing arch/powerpc/oprofile/op_model_cell.c to add in the SPU profiling capabilities. In addition, a 'cell' subdirectory was added to arch/powerpc/oprofile to hold Cell-specific SPU profiling code. Exports spu_set_profile_private_kref and spu_get_profile_private_kref which are used by OProfile to store private profile information in spufs data structures. Also incorporated several fixes from other patches (rrn). Check pointer returned from kzalloc. Eliminated unnecessary cast. Better error handling and cleanup in the related area. 64-bit unsigned long parameter was being demoted to 32-bit unsigned int and eventually promoted back to unsigned long. Signed-off-by: Carl Love <carll@us.ibm.com> Signed-off-by: Maynard Johnson <mpjohn@us.ibm.com> Signed-off-by: Bob Nelson <rrnelson@us.ibm.com> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org>
2007-05-21Detach sched.h from mm.hAlexey Dobriyan
First thing mm.h does is including sched.h solely for can_do_mlock() inline function which has "current" dereference inside. By dealing with can_do_mlock() mm.h can be detached from sched.h which is good. See below, why. This patch a) removes unconditional inclusion of sched.h from mm.h b) makes can_do_mlock() normal function in mm/mlock.c c) exports can_do_mlock() to not break compilation d) adds sched.h inclusions back to files that were getting it indirectly. e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were getting them indirectly Net result is: a) mm.h users would get less code to open, read, preprocess, parse, ... if they don't need sched.h b) sched.h stops being dependency for significant number of files: on x86_64 allmodconfig touching sched.h results in recompile of 4083 files, after patch it's only 3744 (-8.3%). Cross-compile tested on all arm defconfigs, all mips defconfigs, all powerpc defconfigs, alpha alpha-up arm i386 i386-up i386-defconfig i386-allnoconfig ia64 ia64-up m68k mips parisc parisc-up powerpc powerpc-up s390 s390-up sparc sparc-up sparc64 sparc64-up um-x86_64 x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig as well as my two usual configs. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-03-28[PATCH] oprofile: fix potential deadlock on oprofilefs_lockJiri Kosina
nmi_cpu_setup() is called from hardirq context and acquires oprofilefs_lock. alloc_event_buffer() and oprofilefs_ulong_from_user() acquire this lock without disabling irqs, which could deadlock. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-12[PATCH] mark struct file_operations const 5Arjan van de Ven
Many struct file_operations in the kernel can be "const". Marking them const moves these to the .rodata section, which avoids false sharing with potential dirty data. In addition it'll catch accidental writes at compile time to these shared resources. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2006-12-08[PATCH] struct path: convert oprofileJosef Sipek
Signed-off-by: Josef Sipek <jsipek@fsl.cs.sunysb.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-11-22WorkStruct: make allyesconfigDavid Howells
Fix up for make allyesconfig. Signed-Off-By: David Howells <dhowells@redhat.com>
2006-09-27[PATCH] inode-diet: Eliminate i_blksize from the inode structureTheodore Ts'o
This eliminates the i_blksize field from struct inode. Filesystems that want to provide a per-inode st_blksize can do so by providing their own getattr routine instead of using the generic_fillattr() function. Note that some filesystems were providing pretty much random (and incorrect) values for i_blksize. [bunk@stusta.de: cleanup] [akpm@osdl.org: generic_fillattr() fix] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>