Commit Graph

73 Commits (d0e233846dcef56ae78f6d8fd0e0cba85a2a1489)

Author SHA1 Message Date
Robert Richter d0e233846d oprofile: rename add_sample() in cpu_buffer.c
Rename the fucntion to op_add_sample() since there is a collision with
another one with the same name in buffer_sync.c.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 22:35:26 +01:00
Robert Richter 6368a1f4d9 oprofile: making add_sample_entry() inline
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 17:06:47 +01:00
Robert Richter 8350c78734 oprofile: remove backtrace code for ibs
This code is broken since a TRACE_BEGIN_CODE is never sent to the
daemon. The data becomes corrupt since the backtrace is interpreted as
ibs sample.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 17:06:32 +01:00
Robert Richter f4ff236441 oprofile: remove unused ibs macro
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 17:06:16 +01:00
Robert Richter 8d15df84a4 oprofile: remove unused components in struct oprofile_cpu_buffer
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 17:06:00 +01:00
Robert Richter dbe6e2835e oprofile: simplify add_ibs_begin()
Signed-off-by: Robert Richter <robert.richter@amd.com>
2009-01-07 17:05:44 +01:00
Robert Richter 3967e93e06 oprofile: simplify add_sample() in cpu_buffer.c
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-30 05:30:05 +01:00
Robert Richter 6352d92dec oprofile: simplify oprofile_begin_trace()
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-29 18:54:44 +01:00
Robert Richter 317f33bce6 oprofile: simplify sync_buffer()
Make code more readable. No functional changes.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29 18:53:40 +01:00
Robert Richter 9741b309bb oprofile: simplify add_sample()
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-29 18:53:26 +01:00
Robert Richter d45d23bed4 oprofile: add inline function __oprofile_add_ext_sample()
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-29 18:51:39 +01:00
Robert Richter 300157768f oprofile: reordering some code in cpu_buffer.c
Reordering code to keep alloc/free functions together.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-29 17:24:36 +01:00
Robert Richter 9966718dae oprofile: remove ring buffer inline functions in cpu_buffer.h
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-29 15:19:19 +01:00
Robert Richter 6d2c53f3cd oprofile: rename cpu buffer functions
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-29 15:17:52 +01:00
Robert Richter bd2172f580 oprofile: rename kernel-wide identifiers
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-16 17:52:49 +01:00
Robert Richter 211117ff09 oprofile: fix lost sample counter
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-10 20:25:15 +01:00
Robert Richter 1d7503b5dc oprofile: remove nr_available_slots()
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-10 20:03:35 +01:00
Robert Richter 6dad828b76 oprofile: port to the new ring_buffer
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-10 14:20:18 +01:00
Robert Richter fbc9bf9f0e oprofile: moving cpu_buffer_reset() to cpu_buffer.h
This is in preparation for changes in the cpu buffer implementation.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:16 +01:00
Robert Richter bf589e3296 oprofile: adding cpu_buffer_entries()
This is in preparation for changes in the cpu buffer implementation.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:15 +01:00
Robert Richter 229234ae4a oprofile: adding cpu_buffer_write_commit()
This is in preparation for changes in the cpu buffer implementation.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:14 +01:00
Robert Richter 7d468abee0 oprofile: adding cpu buffer r/w access functions
This is in preparation for changes in the cpu buffer implementation.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:13 +01:00
Robert Richter 37ca5eb341 oprofile: set values to default when creating oprofilefs
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-10 14:20:10 +01:00
Robert Richter fd7826d56b oprofile: implement switch/case in buffer_sync.c
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:09 +01:00
Robert Richter 8dbc50c322 oprofile: fix typo
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:06 +01:00
Robert Richter cdc1834d1a oprofile: whitspace changes only
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:05 +01:00
Robert Richter fd13f6c851 oprofile: comment cleanup
This fixes the coding style of some comments.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-12-10 14:20:01 +01:00
Nick Piggin cae042a73b oprofile: fix memory ordering
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-27 19:15:41 +01:00
Linus Torvalds 92fb83afd6 Merge branch 'for-linus' of 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-23 10:05:40 -07:00
Carl Love a5598ca0d4 powerpc/oprofile: Fix mutex locking for cell spu-oprofile
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-21 15:17:48 +11:00
Barry Kasindorf 9b1f261166 OProfile: Fix buffer synchronization for IBS
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-20 13:44:21 +02:00
Chris J Arges 4bd9b9dc97 oprofile: hotplug cpu fix
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-17 10:38:58 +02:00
Robert Richter 6a18037d41 oprofile: fixing whitespaces in drivers/oprofile/*
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-16 15:01:40 +02:00
Robert Richter 8655a3b872 x86/oprofile: removing unused function parameter in add_ibs_begin()
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15 20:56:49 +02:00
Robert Richter 25ad2913ca oprofile: more whitespace fixes
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15 20:55:51 +02:00
Robert Richter c92960fccb oprofile: whitespace fixes
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15 20:47:41 +02:00
Robert Richter e2fee2761a OProfile: Rework oprofile_add_ibs_sample() function
Code looks much more cleaner now.

Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15 20:47:31 +02:00
Ingo Molnar accba5f396 Merge branch 'linus' into oprofile-v2
Conflicts:
	arch/x86/kernel/apic_32.c
	arch/x86/oprofile/nmi_int.c
	include/linux/pci_ids.h
2008-10-13 11:05:51 +02:00
Robert Richter f78e80209c Merge commit 'v2.6.27-rc5' into tip/oprofile
Conflicts:
	arch/x86/oprofile/nmi_int.c
2008-09-24 11:25:31 +02:00
Robert Richter 4c168eaf7e Revert "Oprofile Multiplexing Patch"
Reverting commit 1a960b402a for the main
branch. Multiplexing will be tracked on a separate feature branch.

Conflicts:

    arch/x86/oprofile/nmi_int.c
2008-09-24 11:08:52 +02:00
Carl Love f4156d1cd1 powerpc/cell/oprofile: Avoid double vfree of profile buffer
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-08-26 10:24:46 +10:00
Jason Yeh 1a960b402a Oprofile Multiplexing Patch
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-26 11:48:16 +02:00
Robert Richter bd17b625c0 oprofile: fix printk in cpu_buffer.c
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-26 11:48:14 +02:00
Robert Richter 852402cc27 x86/oprofile: add CONFIG_OPROFILE_IBS option
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-26 11:48:13 +02:00
Barry Kasindorf 345c25730d x86/oprofile: add IBS support for AMD CPUs, IBS buffer handling routines
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-26 11:48:04 +02:00
Robert Richter 5e11f98dce OProfile: moving increment_tail() in buffer_sync.c
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-26 11:48:03 +02:00
Robert Richter 73185e0a5d drivers/oprofile: coding style fixes in buffer_sync.c
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-26 11:48:02 +02:00
Eric Dumazet 8b8b498836 oprofile: don't request cache line alignment for cpu_buffer
Alignment was previously requested because cpu_buffer was an [NR_CPUS]
array, to avoid cache line sharing between CPUS.

After commit 608dfddd84 (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-05-14 19:11:12 -07:00
Mike Travis 608dfddd84 oprofile: change cpu_buffer from array to per_cpu variable
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-04-28 08:58:31 -07:00
Jan Blunck 448678a0f3 d_path: Make get_dcookie() use a struct path argument
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>
2008-02-14 21:17:08 -08:00