aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2012-03-08 17:02:57 +0100
committerJan Beulich <jbeulich@suse.com>2012-03-08 17:02:57 +0100
commitcae10a689a5ee104a24dc01131e1d71d4060cc70 (patch)
tree74c22cad4cd0d7263a4b99cb57e258491c5d6521 /xen
parent48844dc21098fa59f1cac06eba31b548f576a446 (diff)
downloadxen-cae10a689a5ee104a24dc01131e1d71d4060cc70.tar.gz
xen-cae10a689a5ee104a24dc01131e1d71d4060cc70.tar.bz2
xen-cae10a689a5ee104a24dc01131e1d71d4060cc70.zip
oprofile: don't pass around redundant, easily derived arguments
Passing both a struct vcpu pointer and the corresponding struct domain one is simply pointless, especially when intermediate functions just forward it without themselves making use of the already obtained value. Also constify a few function parameters. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen')
-rw-r--r--xen/arch/ia64/xen/oprofile/xenoprof.c2
-rw-r--r--xen/arch/x86/oprofile/backtrace.c31
-rw-r--r--xen/arch/x86/oprofile/xenoprof.c4
-rw-r--r--xen/common/xenoprof.c17
-rw-r--r--xen/include/asm-ia64/xenoprof.h7
-rw-r--r--xen/include/asm-x86/xenoprof.h7
-rw-r--r--xen/include/xen/xenoprof.h8
7 files changed, 35 insertions, 41 deletions
diff --git a/xen/arch/ia64/xen/oprofile/xenoprof.c b/xen/arch/ia64/xen/oprofile/xenoprof.c
index fdabc28ef1..8635c7e676 100644
--- a/xen/arch/ia64/xen/oprofile/xenoprof.c
+++ b/xen/arch/ia64/xen/oprofile/xenoprof.c
@@ -27,7 +27,7 @@
#include <asm/vmx.h> /* for vmx_user_mode() */
int
-xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
+xenoprofile_get_mode(const struct vcpu *v, const struct cpu_user_regs *regs)
{
int mode;
diff --git a/xen/arch/x86/oprofile/backtrace.c b/xen/arch/x86/oprofile/backtrace.c
index dcb38230f6..33fd14274f 100644
--- a/xen/arch/x86/oprofile/backtrace.c
+++ b/xen/arch/x86/oprofile/backtrace.c
@@ -32,10 +32,10 @@ DEFINE_COMPAT_HANDLE(frame_head32_t);
#endif
static struct frame_head *
-dump_hypervisor_backtrace(struct domain *d, struct vcpu *vcpu,
- struct frame_head * head, int mode)
+dump_hypervisor_backtrace(struct vcpu *vcpu, const struct frame_head *head,
+ int mode)
{
- if (!xenoprof_add_trace(d, vcpu, head->ret, mode))
+ if (!xenoprof_add_trace(vcpu, head->ret, mode))
return 0;
/* frame pointers should strictly progress back up the stack
@@ -57,8 +57,8 @@ static inline int is_32bit_vcpu(struct vcpu *vcpu)
#endif
static struct frame_head *
-dump_guest_backtrace(struct domain *d, struct vcpu *vcpu,
- const struct frame_head *head, int mode)
+dump_guest_backtrace(struct vcpu *vcpu, const struct frame_head *head,
+ int mode)
{
frame_head_t bufhead;
@@ -90,7 +90,7 @@ dump_guest_backtrace(struct domain *d, struct vcpu *vcpu,
return 0;
}
- if (!xenoprof_add_trace(d, vcpu, bufhead.ret, mode))
+ if (!xenoprof_add_trace(vcpu, bufhead.ret, mode))
return 0;
/* frame pointers should strictly progress back up the stack
@@ -132,8 +132,8 @@ dump_guest_backtrace(struct domain *d, struct vcpu *vcpu,
* in the kernel mode.
*/
#if defined(CONFIG_FRAME_POINTER)
-static int valid_hypervisor_stack(struct frame_head * head,
- struct cpu_user_regs * regs)
+static int valid_hypervisor_stack(const struct frame_head *head,
+ const struct cpu_user_regs *regs)
{
unsigned long headaddr = (unsigned long)head;
#ifdef CONFIG_X86_64
@@ -147,27 +147,24 @@ static int valid_hypervisor_stack(struct frame_head * head,
}
#else
/* without fp, it's just junk */
-static int valid_hypervisor_stack(struct frame_head * head,
- struct cpu_user_regs * regs)
+static int valid_hypervisor_stack(const struct frame_head *head,
+ const struct cpu_user_regs *regs)
{
return 0;
}
#endif
-void xenoprof_backtrace(struct domain *d, struct vcpu *vcpu,
- struct cpu_user_regs * const regs,
+void xenoprof_backtrace(struct vcpu *vcpu, const struct cpu_user_regs *regs,
unsigned long depth, int mode)
{
- struct frame_head *head;
-
- head = (struct frame_head *)regs->ebp;
+ const struct frame_head *head = (void *)regs->ebp;
if (mode > 1) {
while (depth-- && valid_hypervisor_stack(head, regs))
- head = dump_hypervisor_backtrace(d, vcpu, head, mode);
+ head = dump_hypervisor_backtrace(vcpu, head, mode);
return;
}
while (depth-- && head)
- head = dump_guest_backtrace(d, vcpu, head, mode);
+ head = dump_guest_backtrace(vcpu, head, mode);
}
diff --git a/xen/arch/x86/oprofile/xenoprof.c b/xen/arch/x86/oprofile/xenoprof.c
index 0c1c7ab031..71f00ef7da 100644
--- a/xen/arch/x86/oprofile/xenoprof.c
+++ b/xen/arch/x86/oprofile/xenoprof.c
@@ -10,6 +10,7 @@
#include <xen/guest_access.h>
#include <xen/sched.h>
+#include <xen/xenoprof.h>
#include <public/xenoprof.h>
#ifdef CONFIG_COMPAT
#include <compat/xenoprof.h>
@@ -77,7 +78,8 @@ int compat_oprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
}
#endif
-int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
+int xenoprofile_get_mode(const struct vcpu *v,
+ const struct cpu_user_regs *regs)
{
if ( !guest_mode(regs) )
return 2;
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c
index a99d3432bb..e571fea829 100644
--- a/xen/common/xenoprof.c
+++ b/xen/common/xenoprof.c
@@ -511,24 +511,23 @@ static int xenoprof_add_sample(struct domain *d, xenoprof_buf_t *buf,
return 1;
}
-int xenoprof_add_trace(struct domain *d, struct vcpu *vcpu,
- uint64_t eip, int mode)
+int xenoprof_add_trace(struct vcpu *vcpu, uint64_t pc, int mode)
{
+ struct domain *d = vcpu->domain;
xenoprof_buf_t *buf = d->xenoprof->vcpu[vcpu->vcpu_id].buffer;
/* Do not accidentally write an escape code due to a broken frame. */
- if ( eip == XENOPROF_ESCAPE_CODE )
+ if ( pc == XENOPROF_ESCAPE_CODE )
{
invalid_buffer_samples++;
return 0;
}
- return xenoprof_add_sample(d, buf, eip, mode, 0);
+ return xenoprof_add_sample(d, buf, pc, mode, 0);
}
-void xenoprof_log_event(struct vcpu *vcpu,
- struct cpu_user_regs * regs, uint64_t eip,
- int mode, int event)
+void xenoprof_log_event(struct vcpu *vcpu, const struct cpu_user_regs *regs,
+ uint64_t pc, int mode, int event)
{
struct domain *d = vcpu->domain;
struct xenoprof_vcpu *v;
@@ -565,7 +564,7 @@ void xenoprof_log_event(struct vcpu *vcpu,
}
}
- if ( xenoprof_add_sample(d, buf, eip, mode, event) )
+ if ( xenoprof_add_sample(d, buf, pc, mode, event) )
{
if ( is_active(vcpu->domain) )
active_samples++;
@@ -581,7 +580,7 @@ void xenoprof_log_event(struct vcpu *vcpu,
}
if ( backtrace_depth > 0 )
- xenoprof_backtrace(d, vcpu, regs, backtrace_depth, mode);
+ xenoprof_backtrace(vcpu, regs, backtrace_depth, mode);
}
diff --git a/xen/include/asm-ia64/xenoprof.h b/xen/include/asm-ia64/xenoprof.h
index 3fc166410d..daf2ffa9e3 100644
--- a/xen/include/asm-ia64/xenoprof.h
+++ b/xen/include/asm-ia64/xenoprof.h
@@ -45,14 +45,13 @@ static inline int xenoprof_arch_ibs_counter(XEN_GUEST_HANDLE(void) arg)
struct vcpu;
struct cpu_user_regs;
-int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+int xenoprofile_get_mode(const struct vcpu *, const struct cpu_user_regs *);
static inline int xenoprof_backtrace_supported(void)
{
return 0;
}
-static inline void xenoprof_backtrace(
- struct domain *d, struct vcpu *vcpu,
- struct pt_regs *const regs, unsigned long depth, int mode)
+static inline void xenoprof_backtrace(struct vcpu *vcpu,
+ const struct pt_regs *regs, unsigned long depth, int mode)
{
/* To be implemented */
return;
diff --git a/xen/include/asm-x86/xenoprof.h b/xen/include/asm-x86/xenoprof.h
index f98b76e378..c03f8c8bf0 100644
--- a/xen/include/asm-x86/xenoprof.h
+++ b/xen/include/asm-x86/xenoprof.h
@@ -56,16 +56,15 @@ static inline void ibs_init(void) {}
#define ibs_caps 0
#endif
-int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+int xenoprofile_get_mode(const struct vcpu *, const struct cpu_user_regs *);
static inline int xenoprof_backtrace_supported(void)
{
return 1;
}
-void xenoprof_backtrace(
- struct domain *d, struct vcpu *vcpu,
- struct cpu_user_regs *const regs, unsigned long depth, int mode);
+void xenoprof_backtrace(struct vcpu *, const struct cpu_user_regs *,
+ unsigned long depth, int mode);
#define xenoprof_shared_gmfn(d, gmaddr, maddr) \
do { \
diff --git a/xen/include/xen/xenoprof.h b/xen/include/xen/xenoprof.h
index e34ad20ab3..7804e69329 100644
--- a/xen/include/xen/xenoprof.h
+++ b/xen/include/xen/xenoprof.h
@@ -68,8 +68,7 @@ int is_active(struct domain *d);
int is_passive(struct domain *d);
void free_xenoprof_pages(struct domain *d);
-int xenoprof_add_trace(struct domain *d, struct vcpu *v,
- uint64_t eip, int mode);
+int xenoprof_add_trace(struct vcpu *, uint64_t pc, int mode);
#define PMU_OWNER_NONE 0
#define PMU_OWNER_XENOPROF 1
@@ -77,8 +76,7 @@ int xenoprof_add_trace(struct domain *d, struct vcpu *v,
int acquire_pmu_ownship(int pmu_ownership);
void release_pmu_ownship(int pmu_ownership);
-void xenoprof_log_event(struct vcpu *vcpu,
- struct cpu_user_regs * regs, uint64_t eip,
- int mode, int event);
+void xenoprof_log_event(struct vcpu *, const struct cpu_user_regs *,
+ uint64_t pc, int mode, int event);
#endif /* __XEN__XENOPROF_H__ */