From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
To: robert.richter@amd.com
Cc: mingo@elte.hu, oprofile-list@lists.sf.net,
linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
borntraeger@de.ibm.com, schwidefsky@de.ibm.com,
heiko.carstens@de.ibm.com,
Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>,
Maran Pakkirisamy <maranp@linux.vnet.ibm.com>
Subject: [patch v2 3/3] This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample)
Date: Fri, 21 Jan 2011 11:06:54 +0100 [thread overview]
Message-ID: <20110121100842.200732938@linux.vnet.ibm.com> (raw)
In-Reply-To: 20110121100651.821690659@linux.vnet.ibm.com
[-- Attachment #1: oprofile_worker.patch --]
[-- Type: text/plain, Size: 3662 bytes --]
From: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample)
that can also take task_struct as an argument, which is used by the hwsampler kernel module
when copying hardware samples to OProfile buffers.
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Maran Pakkirisamy <maranp@linux.vnet.ibm.com>
Signed-off-by: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
---
drivers/oprofile/cpu_buffer.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
Index: linux-2.6/drivers/oprofile/cpu_buffer.c
===================================================================
--- linux-2.6.orig/drivers/oprofile/cpu_buffer.c
+++ linux-2.6/drivers/oprofile/cpu_buffer.c
@@ -22,6 +22,7 @@
#include <linux/sched.h>
#include <linux/oprofile.h>
#include <linux/errno.h>
+#include <linux/module.h>
#include "event_buffer.h"
#include "cpu_buffer.h"
@@ -258,8 +259,10 @@ op_add_sample(struct oprofile_cpu_buffer
*/
static int
log_sample(struct oprofile_cpu_buffer *cpu_buf, unsigned long pc,
- unsigned long backtrace, int is_kernel, unsigned long event)
+ unsigned long backtrace, int is_kernel, unsigned long event,
+ struct task_struct *task)
{
+ struct task_struct *tsk = task ? task : current;
cpu_buf->sample_received++;
if (pc == ESCAPE_CODE) {
@@ -267,7 +270,7 @@ log_sample(struct oprofile_cpu_buffer *c
return 0;
}
- if (op_add_code(cpu_buf, backtrace, is_kernel, current))
+ if (op_add_code(cpu_buf, backtrace, is_kernel, tsk))
goto fail;
if (op_add_sample(cpu_buf, pc, event))
@@ -292,7 +295,8 @@ static inline void oprofile_end_trace(st
static inline void
__oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
- unsigned long event, int is_kernel)
+ unsigned long event, int is_kernel,
+ struct task_struct *task)
{
struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
unsigned long backtrace = oprofile_backtrace_depth;
@@ -301,7 +305,7 @@ __oprofile_add_ext_sample(unsigned long
* if log_sample() fail we can't backtrace since we lost the
* source of this event
*/
- if (!log_sample(cpu_buf, pc, backtrace, is_kernel, event))
+ if (!log_sample(cpu_buf, pc, backtrace, is_kernel, event, task))
/* failed */
return;
@@ -316,9 +320,18 @@ __oprofile_add_ext_sample(unsigned long
void oprofile_add_ext_sample(unsigned long pc, struct pt_regs * const regs,
unsigned long event, int is_kernel)
{
- __oprofile_add_ext_sample(pc, regs, event, is_kernel);
+ __oprofile_add_ext_sample(pc, regs, event, is_kernel, NULL);
}
+#ifdef CONFIG_HAVE_HWSAMPLER
+void oprofile_add_ext_hw_sample(unsigned long pc, struct pt_regs * const regs,
+ unsigned long event, int is_kernel,
+ struct task_struct *task)
+{
+ __oprofile_add_ext_sample(pc, regs, event, is_kernel, task);
+}
+#endif /* CONFIG_HAVE_HWSAMPLER */
+
void oprofile_add_sample(struct pt_regs * const regs, unsigned long event)
{
int is_kernel;
@@ -332,7 +345,7 @@ void oprofile_add_sample(struct pt_regs
pc = ESCAPE_CODE; /* as this causes an early return. */
}
- __oprofile_add_ext_sample(pc, regs, event, is_kernel);
+ __oprofile_add_ext_sample(pc, regs, event, is_kernel, NULL);
}
/*
@@ -403,7 +416,7 @@ int oprofile_write_commit(struct op_entr
void oprofile_add_pc(unsigned long pc, int is_kernel, unsigned long event)
{
struct oprofile_cpu_buffer *cpu_buf = &__get_cpu_var(op_cpu_buffer);
- log_sample(cpu_buf, pc, 0, is_kernel, event);
+ log_sample(cpu_buf, pc, 0, is_kernel, event, NULL);
}
void oprofile_add_trace(unsigned long pc)
next prev parent reply other threads:[~2011-01-21 10:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-21 10:06 [patch v2 0/3] OProfile support for System z's hardware sampling Heinz Graalfs
2011-01-21 10:06 ` [patch v2 1/3] This patch adds support for hardware based sampling on System z processors (models z10 and up) Heinz Graalfs
2011-02-14 18:57 ` Robert Richter
2011-03-25 11:00 ` Robert Richter
2011-03-29 12:38 ` Heinz Graalfs
2011-01-21 10:06 ` [patch v2 2/3] This patch enhances OProfile to support System zs hardware sampling feature Heinz Graalfs
2011-02-14 19:01 ` Robert Richter
2011-02-14 19:03 ` Robert Richter
2011-02-14 19:05 ` [PATCH] oprofile, s390: Rework hwsampler implementation Robert Richter
2011-02-14 19:07 ` [PATCH] oprofile, s390: Fix section mismatch of function hws_cpu_callback() Robert Richter
2011-01-21 10:06 ` Heinz Graalfs [this message]
2011-02-14 18:55 ` [patch v2 3/3] This patch introduces a new oprofile sample add function (oprofile_add_ext_hw_sample) Robert Richter
2011-02-07 8:23 ` [patch v2 0/3] OProfile support for System z's hardware sampling Heinz Graalfs
2011-02-14 19:42 ` Robert Richter
2011-02-15 7:17 ` Heiko Carstens
2011-02-15 16:59 ` Heinz Graalfs
2011-02-15 17:29 ` Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110121100842.200732938@linux.vnet.ibm.com \
--to=graalfs@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mahesh@linux.vnet.ibm.com \
--cc=maranp@linux.vnet.ibm.com \
--cc=mingo@elte.hu \
--cc=oprofile-list@lists.sf.net \
--cc=robert.richter@amd.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox