summaryrefslogtreecommitdiffstats
path: root/drivers/oprofile
Commit message (Collapse)AuthorAgeFilesLines
* oprofile: warn on freeing event buffer too earlyRobert Richter2009-10-091-10/+15
| | | | | | | | | | | | | | A race shouldn't happen since all workqueues or handlers are canceled or flushed before the event buffer is freed. A warning is triggered now if the buffer is freed too early. Also, this patch adds some comments about event buffer protection, reworks some code and adds code to clear buffer_pos during alloc and free of the event buffer. Cc: David Rientjes <rientjes@google.com> Cc: Stephane Eranian <eranian@google.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: fix race condition in event_buffer freeDavid Rientjes2009-10-091-1/+13
| | | | | | | | | | | | | | | | | | | Looking at the 2.6.31-rc9 code, it appears there is a race condition in the event_buffer cleanup code path (shutdown). This could lead to kernel panic as some CPUs may be operating on the event buffer AFTER it has been freed. The attached patch solves the problem and makes sure CPUs check if the buffer is not NULL before they access it as some may have been spinning on the mutex while the buffer was being freed. The race may happen if the buffer is freed during pending reads. But it is not clear why there are races in add_event_entry() since all workqueues or handlers are canceled or flushed before the event buffer is freed. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
* cpumask: use zalloc_cpumask_var() where possibleLi Zefan2009-09-241-2/+1
| | | | | | | Remove open-coded zalloc_cpumask_var() and zalloc_cpumask_var_node(). Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* const: mark remaining super_operations constAlexey Dobriyan2009-09-221-1/+1
| | | | | | Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* oprofile: Adding switch counter to oprofile statistic variablesRobert Richter2009-07-203-9/+8
| | | | | | | | | This patch moves the multiplexing switch counter from x86 code to common oprofile statistic variables. Now the value will be available and usable for all architectures. The initialization and incrementation also moved to common code. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: Grouping multiplexing code in oprof.cRobert Richter2009-07-201-51/+49
| | | | | | | This patch moves multiplexing code to a single section of code. This reduces the use of #ifdefs especially within functions. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: Remove oprofile_multiplexing_init()Robert Richter2009-07-202-14/+2
| | | | | | | oprofile_multiplexing_init() can be removed when moving the initialization of oprofile_time_slice to oprofile_create_files(). Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: Rename variable timeout_jiffies and move to oprofile_files.cRobert Richter2009-07-203-8/+9
| | | | | | | | | | This patch renames timeout_jiffies into an oprofile specific name. The macro MULTIPLEXING_TIMER_DEFAULT is changed too. Also, since this variable is controlled using oprofilefs, its definition is moved to oprofile_files.c. Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: oprofile_set_timeout(), return with error for invalid argsRobert Richter2009-07-201-3/+8
| | | | | | | Return with -EINVAL for invalid parameters instead of setting the default value in oprofile_set_timeout(). Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: Implement performance counter multiplexingJason Yeh2009-07-204-0/+133
| | | | | | | | | | | | | | | | | | | | | The number of hardware counters is limited. The multiplexing feature enables OProfile to gather more events than counters are provided by the hardware. This is realized by switching between events at an user specified time interval. A new file (/dev/oprofile/time_slice) is added for the user to specify the timer interval in ms. If the number of events to profile is higher than the number of hardware counters available, the patch will schedule a work queue that switches the event counter and re-writes the different sets of values into it. The switching mechanism needs to be implemented for each architecture to support multiplexing. This patch only implements AMD CPU support, but multiplexing can be easily extended for other models and architectures. There are follow-on patches that rework parts of this patch. Signed-off-by: Jason Yeh <jason.yeh@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
*-. Merge commit 'v2.6.31-rc3'; commit 'tip/oprofile' into oprofile/coreRobert Richter2009-07-141-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: drivers/oprofile/oprofile_stats.c drivers/usb/otg/Kconfig drivers/usb/otg/Makefile Signed-off-by: Robert Richter <robert.richter@amd.com>
| | * Merge branches 'oprofile/fixes', 'oprofile/next' and 'oprofile/master' into ↵Robert Richter2009-06-121-0/+1
| | |\ | |/ / |/| | | | | oprofile/auto
| | * oprofile: reset bt_lost_no_mapping with other statsMaynard Johnson2009-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bt_lost_no_mapping is not getting reset at the start of a profiling run, thus the oprofiled.log shows erroneous values for this statistic. The attached patch fixes this problem. Signed-off-by: Maynard Johnson <maynardj@us.ibm.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
| * | oprofile: reset bt_lost_no_mapping with other statsMaynard Johnson2009-07-101-0/+1
| |/ | | | | | | | | | | | | | | | | | | The bt_lost_no_mapping is not getting reset at the start of a profiling run, thus the oprofiled.log shows erroneous values for this statistic. The attached patch fixes this problem. Signed-off-by: Maynard Johnson <maynardj@us.ibm.com> Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* | x86/oprofile: introduce oprofile_add_data64()Robert Richter2009-06-111-0/+15
| | | | | | | | | | | | | | | | | | The IBS implemention writes 64 bit register values to the cpu buffer by writing two 32 values using oprofile_add_data(). This patch introduces oprofile_add_data64() to write a single 64 bit value to the buffer. Signed-off-by: Robert Richter <robert.richter@amd.com>
* | oprofile: remove obselete include headersRobert Richter2009-06-111-1/+0
|/ | | | | | | | This became obsolete with this commit: 6dad828 oprofile: port to the new ring_buffer Signed-off-by: Robert Richter <robert.richter@amd.com>
* oprofile: fix cpu buffer sizeRobert Richter2009-05-071-2/+6
| | | | | | | | | | The unit of oprofile_cpu_buffer_size is in samples, but was allocated in bytes. This led to the allocation of too small cpu buffers. This patch recalculates the buffer size in bytes taking also the ring_buffer_event header size into account. Reported-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> Signed-off-by: Robert Richter <robert.richter@amd.com>
* Merge branch 'tracing-for-linus' of ↵Linus Torvalds2009-04-051-3/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip * 'tracing-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (413 commits) tracing, net: fix net tree and tracing tree merge interaction tracing, powerpc: fix powerpc tree and tracing tree interaction ring-buffer: do not remove reader page from list on ring buffer free function-graph: allow unregistering twice trace: make argument 'mem' of trace_seq_putmem() const tracing: add missing 'extern' keywords to trace_output.h tracing: provide trace_seq_reserve() blktrace: print out BLK_TN_MESSAGE properly blktrace: extract duplidate code blktrace: fix memory leak when freeing struct blk_io_trace blktrace: fix blk_probes_ref chaos blktrace: make classic output more classic blktrace: fix off-by-one bug blktrace: fix the original blktrace blktrace: fix a race when creating blk_tree_root in debugfs blktrace: fix timestamp in binary output tracing, Text Edit Lock: cleanup tracing: filter fix for TRACE_EVENT_FORMAT events ftrace: Using FTRACE_WARN_ON() to check "freed record" in ftrace_release() x86: kretprobe-booster interrupt emulation code fix ... Fix up trivial conflicts in arch/parisc/include/asm/ftrace.h include/linux/memory.h kernel/extable.c kernel/module.c
| * Merge branch 'tracing/core-v2' into tracing-for-linusIngo Molnar2009-04-021-3/+2
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: include/linux/slub_def.h lib/Kconfig.debug mm/slob.c mm/slub.c
| | * Merge branch 'x86/core' into tracing/texteditIngo Molnar2009-03-063-5/+30
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: arch/x86/Kconfig block/blktrace.c kernel/irq/handle.c Semantic conflict: kernel/trace/blktrace.c Signed-off-by: Ingo Molnar <mingo@elte.hu>
| | * | ring_buffer: remove unused flags parameter, fixIngo Molnar2009-02-061-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | Oprofile's ring-buffer use was not considered. Signed-off-by: Ingo Molnar <mingo@elte.hu>
| * | | oprofile: Thou shalt not call __exit functions from __init functionsRussell King2009-03-301-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Impact: fix ref to discarded function `buffer_sync_cleanup' referenced in section `.init.text' of arch/arm/oprofile/built-in.o: defined in discarded section `.exit.text' of arch/arm/oprofile/built-in.o Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* | | Merge branch 'x86/core' into cpus4096Ingo Molnar2009-03-112-0/+12
|\ \ \ | |/ /
| * | Merge branch 'linus' into core/percpuIngo Molnar2009-01-272-0/+12
| |\ \ | | |/ | | | | | | | | | Conflicts: arch/x86/kernel/setup_percpu.c
| | * oprofile: fix uninitialized use of struct op_entryRobert Richter2009-01-172-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: modifiy oprofile initializationRobert Richter2009-01-223-26/+7
|/ / | | | | | | | | | | | | | | | | | | | | Delta patch to f7df8ed164996cd2c6aca9674388be6ef78d8b37 for tip/cpus4096. Moved initialization to sync_start()/sync_stop(). No changes needed in buffer_sync.h and oprof.c anymore. Signed-off-by: Robert Richter <robert.richter@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
* | cpumask: convert misc driver functionsRusty Russell2009-01-113-5/+30
|/ | | | | | | | | | | | | | | | | | | | | | 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-097-296/+340
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-072-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | 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-072-10/+0
| | | | | | | | | | | | | | | | 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-073-59/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-072-2/+24
| | | | | | | | | | | | | | | | | | 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-072-1/+13
| | | | | | | | | | | | | | | | 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-073-91/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-073-14/+25
| | | | | | | | | | | | 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-072-15/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-13/+13
| | | | | | | | | | | | 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-071-11/+11
| | | | | | | | | | | | | | 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-071-1/+1
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove backtrace code for ibsRobert Richter2009-01-072-10/+2
| | | | | | | | | | | | | | | | 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-071-2/+0
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: remove unused components in struct oprofile_cpu_bufferRobert Richter2009-01-072-4/+0
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_ibs_begin()Robert Richter2009-01-071-5/+2
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_sample() in cpu_buffer.cRobert Richter2008-12-301-5/+1
| | | | | | | | Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify oprofile_begin_trace()Robert Richter2008-12-291-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>
| * oprofile: simplify sync_buffer()Robert Richter2008-12-291-6/+14
| | | | | | | | | | | | Make code more readable. No functional changes. Signed-off-by: Robert Richter <robert.richter@amd.com>
| * oprofile: simplify add_sample()Robert Richter2008-12-291-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>
| * oprofile: add inline function __oprofile_add_ext_sample()Robert Richter2008-12-291-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>
| * oprofile: reordering some code in cpu_buffer.cRobert Richter2008-12-291-10/+10
| | | | | | | | | | | | 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-292-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>
OpenPOWER on IntegriCloud