aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-01-07oprofile: remove unused ibs macroRobert Richter1-2/+0
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07oprofile: remove unused components in struct oprofile_cpu_bufferRobert Richter2-4/+0
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07oprofile: simplify add_ibs_begin()Robert Richter1-5/+2
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-05zero i_uid/i_gid on inode allocationAl Viro1-3/+0
... and don't bother in callers. Don't bother with zeroing i_blocks, while we are at it - it's already been zeroed. i_mode is not worth the effort; it has no common default value. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-12-31shrink struct dentryNick Piggin1-1/+1
struct dentry is one of the most critical structures in the kernel. So it's sad to see it going neglected. With CONFIG_PROFILING turned on (which is probably the common case at least for distros and kernel developers), sizeof(struct dcache) == 208 here (64-bit). This gives 19 objects per slab. I packed d_mounted into a hole, and took another 4 bytes off the inline name length to take the padding out from the end of the structure. This shinks it to 200 bytes. I could have gone the other way and increased the length to 40, but I'm aiming for a magic number, read on... I then got rid of the d_cookie pointer. This shrinks it to 192 bytes. Rant: why was this ever a good idea? The cookie system should increase its hash size or use a tree or something if lookups are a problem. Also the "fast dcookie lookups" in oprofile should be moved into the dcookie code -- how can oprofile possibly care about the dcookie_mutex? It gets dropped after get_dcookie() returns so it can't be providing any sort of protection. At 192 bytes, 21 objects fit into a 4K page, saving about 3MB on my system with ~140 000 entries allocated. 192 is also a multiple of 64, so we get nice cacheline alignment on 64 and 32 byte line systems -- any given dentry will now require 3 cachelines to touch all fields wheras previously it would require 4. I know the inline name size was chosen quite carefully, however with the reduction in cacheline footprint, it should actually be just about as fast to do a name lookup for a 36 character name as it was before the patch (and faster for other sizes). The memory footprint savings for names which are <= 32 or > 36 bytes long should more than make up for the memory cost for 33-36 byte names. Performance is a feature... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-12-30oprofile: simplify add_sample() in cpu_buffer.cRobert Richter1-5/+1
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: simplify oprofile_begin_trace()Robert Richter1-5/+4
This patch removes the unused return parameter in oprofile_begin_trace(). Also, oprofile_begin_trace() and oprofile_end_trace() are inline now. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: simplify sync_buffer()Robert Richter1-6/+14
Make code more readable. No functional changes. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29oprofile: simplify add_sample()Robert Richter1-20/+19
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 Richter1-3/+10
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 Richter1-10/+10
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 Richter2-48/+50
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 Richter3-12/+12
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 Richter5-27/+28
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 Richter1-30/+53
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 Richter1-34/+0
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 Richter3-85/+114
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 Richter3-27/+14
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 Richter2-29/+29
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 Richter2-17/+18
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 Richter3-12/+22
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 Richter1-3/+12
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 Richter1-8/+14
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: fix typoRobert Richter1-1/+1
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: whitspace changes onlyRobert Richter1-2/+2
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10oprofile: comment cleanupRobert Richter1-9/+16
This fixes the coding style of some comments. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-27oprofile: fix memory orderingNick Piggin1-3/+3
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 git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofileLinus Torvalds13-184/+174
* '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 Love3-1/+45
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 Kasindorf1-1/+7
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 Arges1-2/+7
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 Richter12-60/+60
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15x86/oprofile: removing unused function parameter in add_ibs_begin()Robert Richter1-5/+3
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15oprofile: more whitespace fixesRobert Richter9-72/+72
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15oprofile: whitespace fixesRobert Richter2-13/+12
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15OProfile: Rework oprofile_add_ibs_sample() functionRobert Richter1-33/+15
Code looks much more cleaner now. Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-13Merge branch 'linus' into oprofile-v2Ingo Molnar2-1/+5
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 Richter2-1/+5
Conflicts: arch/x86/oprofile/nmi_int.c
2008-09-24Revert "Oprofile Multiplexing Patch"Robert Richter3-95/+6
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 Love2-1/+5
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 Yeh3-6/+95
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 Richter1-1/+1
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 Richter2-0/+10
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 Kasindorf3-2/+140
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 Richter1-13/+11
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 Richter1-54/+57
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 Dumazet2-2/+2
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 Travis4-12/+13
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 Blunck1-12/+9
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 Elie3-0/+12
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>