aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
Commit message (Collapse)AuthorAge
* Merge branch 'linus' into core/percpuIngo Molnar2009-01-27
|\ | | | | | | | | Conflicts: arch/x86/kernel/setup_percpu.c
| * oprofile: fix uninitialized use of struct op_entryRobert Richter2009-01-17
| | | | | | | | | | | | | | | | | | | | | | Impact: fix crash In case of losing samples struct op_entry could have been used uninitialized causing e.g. a wrong preemption count or NULL pointer access. This patch fixes this. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* | cpumask: convert misc driver functionsRusty Russell2009-01-11
|/ | | | | | | | | | | | | | | | | | | | | | Impact: use new cpumask API. Convert misc driver functions to use struct cpumask. To Do: - Convert iucv_buffer_cpumask to cpumask_var_t. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Mike Travis <travis@sgi.com> Acked-by: Dean Nelson <dcn@sgi.com> Cc: Robert Richter <robert.richter@amd.com> Cc: oprofile-list@lists.sf.net Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Chris Wright <chrisw@sous-sol.org> Cc: virtualization@lists.osdl.org Cc: xen-devel@lists.xensource.com Cc: Ursula Braun <ursula.braun@de.ibm.com> Cc: linux390@de.ibm.com Cc: linux-s390@vger.kernel.org
* Merge branch 'for-linus' of ↵Linus Torvalds2009-01-09
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: (31 commits) powerpc/oprofile: fix whitespaces in op_model_cell.c powerpc/oprofile: IBM CELL: add SPU event profiling support powerpc/oprofile: fix cell/pr_util.h powerpc/oprofile: IBM CELL: cleanup and restructuring oprofile: make new cpu buffer functions part of the api oprofile: remove #ifdef CONFIG_OPROFILE_IBS in non-ibs code ring_buffer: fix ring_buffer_event_length() oprofile: use new data sample format for ibs oprofile: add op_cpu_buffer_get_data() oprofile: add op_cpu_buffer_add_data() oprofile: rework implementation of cpu buffer events oprofile: modify op_cpu_buffer_read_entry() oprofile: add op_cpu_buffer_write_reserve() oprofile: rename variables in add_ibs_begin() oprofile: rename add_sample() in cpu_buffer.c oprofile: rename variable ibs_allowed to has_ibs in op_model_amd.c oprofile: making add_sample_entry() inline oprofile: remove backtrace code for ibs oprofile: remove unused ibs macro oprofile: remove unused components in struct oprofile_cpu_buffer ...
| * oprofile: make new cpu buffer functions part of the apiRobert Richter2009-01-07
| | | | | | | | | | | | | | | | | | | | | | | | This patch creates the new functions oprofile_write_reserve() oprofile_add_data() oprofile_write_commit() and makes them part of the oprofile api. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove #ifdef CONFIG_OPROFILE_IBS in non-ibs codeRobert Richter2009-01-07
| | | | | | | | | | | | | | | | The ifdefs can be removed since the code is no longer ibs specific and can be used for other purposes as well. IBS specific code is only in op_model_amd.c. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: use new data sample format for ibsRobert Richter2009-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | The new ring buffer implementation allows the storage of samples with different size. This patch implements the usage of the new sample format to store ibs samples in the cpu buffer. Until now, writing to the cpu buffer could lead to incomplete sampling sequences since IBS samples were transfered in multiple samples. Due to a full buffer, data could be lost at any time. This can't happen any more since the complete data is reserved in advance and then stored in a single sample. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: add op_cpu_buffer_get_data()Robert Richter2009-01-07
| | | | | | | | | | | | | | | | | | This function provides access to attached data of a sample. It returns the size of data including the current value. Also, op_cpu_buffer_get_size() is available to check if there is data attached. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: add op_cpu_buffer_add_data()Robert Richter2009-01-07
| | | | | | | | | | | | | | | | This function can be used to attach data to a sample. It returns the remaining free buffer size that has been reserved with op_cpu_buffer_write_reserve(). Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: rework implementation of cpu buffer eventsRobert Richter2009-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Special events such as task or context switches are marked with an escape code in the cpu buffer followed by an event code or a task identifier. There is one escape code per event. To make escape sequences also available for data samples the internal cpu buffer format must be changed. The current implementation does not allow the extension of event codes since this would lead to collisions with the task identifiers. To avoid this, this patch introduces an event mask that allows the storage of multiple events with one escape code. Now, task identifiers are stored in the data section of the sample. The implementation also allows the usage of custom data in a sample. As a side effect the new code is much more readable and easier to understand. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: modify op_cpu_buffer_read_entry()Robert Richter2009-01-07
| | | | | | | | | | | | This implements the support of samples with attached data. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: add op_cpu_buffer_write_reserve()Robert Richter2009-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | This function prepares the cpu buffer to write a sample. Struct op_entry is used during operations on the ring buffer while struct op_sample contains the data that is stored in the ring buffer. Struct entry can be uninitialized. The function reserves a data array that is specified by size. Use op_cpu_buffer_write_commit() after preparing the sample. In case of errors a null pointer is returned, otherwise the pointer to the sample. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: rename variables in add_ibs_begin()Robert Richter2009-01-07
| | | | | | | | | | | | This unifies usage of variable names within oprofile. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: rename add_sample() in cpu_buffer.cRobert Richter2009-01-07
| | | | | | | | | | | | | | 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>
| * oprofile: making add_sample_entry() inlineRobert Richter2009-01-07
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove backtrace code for ibsRobert Richter2009-01-07
| | | | | | | | | | | | | | | | 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>
| * oprofile: remove unused ibs macroRobert Richter2009-01-07
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove unused components in struct oprofile_cpu_bufferRobert Richter2009-01-07
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_ibs_begin()Robert Richter2009-01-07
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_sample() in cpu_buffer.cRobert Richter2008-12-29
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify oprofile_begin_trace()Robert Richter2008-12-29
| | | | | | | | | | | | | | | | 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>
| * oprofile: simplify sync_buffer()Robert Richter2008-12-29
| | | | | | | | | | | | Make code more readable. No functional changes. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_sample()Robert Richter2008-12-29
| | | | | | | | | | | | | | 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>
| * oprofile: add inline function __oprofile_add_ext_sample()Robert Richter2008-12-29
| | | | | | | | | | | | | | | | 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>
| * oprofile: reordering some code in cpu_buffer.cRobert Richter2008-12-29
| | | | | | | | | | | | Reordering code to keep alloc/free functions together. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove ring buffer inline functions in cpu_buffer.hRobert Richter2008-12-29
| | | | | | | | | | | | | | 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>
| * oprofile: rename cpu buffer functionsRobert Richter2008-12-29
| | | | | | | | | | | | | | | | 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>
| * oprofile: rename kernel-wide identifiersRobert Richter2008-12-16
| | | | | | | | | | | | | | | | 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>
* | zero i_uid/i_gid on inode allocationAl Viro2009-01-05
| | | | | | | | | | | | | | | | | | ... 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>
* | shrink struct dentryNick Piggin2008-12-31
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* oprofile: fix lost sample counterRobert Richter2008-12-10
| | | | | | | | 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>
* oprofile: remove nr_available_slots()Robert Richter2008-12-10
| | | | | | | | | | | | | | | | 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>
* oprofile: port to the new ring_bufferRobert Richter2008-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* oprofile: moving cpu_buffer_reset() to cpu_buffer.hRobert Richter2008-12-10
| | | | | | This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: adding cpu_buffer_entries()Robert Richter2008-12-10
| | | | | | This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: adding cpu_buffer_write_commit()Robert Richter2008-12-10
| | | | | | This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: adding cpu buffer r/w access functionsRobert Richter2008-12-10
| | | | | | This is in preparation for changes in the cpu buffer implementation. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: set values to default when creating oprofilefsRobert Richter2008-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* oprofile: implement switch/case in buffer_sync.cRobert Richter2008-12-10
| | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: fix typoRobert Richter2008-12-10
| | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: whitspace changes onlyRobert Richter2008-12-10
| | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: comment cleanupRobert Richter2008-12-10
| | | | | | This fixes the coding style of some comments. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: fix memory orderingNick Piggin2008-10-27
| | | | | | | | | 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>
* Merge branch 'for-linus' of ↵Linus Torvalds2008-10-23
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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}
| * OProfile: Fix buffer synchronization for IBSBarry Kasindorf2008-10-20
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * oprofile: hotplug cpu fixChris J Arges2008-10-17
| | | | | | | | | | | | | | | | | | | | | | | | 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>
| * oprofile: fixing whitespaces in drivers/oprofile/*Robert Richter2008-10-16
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * x86/oprofile: removing unused function parameter in add_ibs_begin()Robert Richter2008-10-15
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: more whitespace fixesRobert Richter2008-10-15
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: whitespace fixesRobert Richter2008-10-15
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>