[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] oprofile: don't pass around redundant, easily derived arguments
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1331222577 -3600 # Node ID 66de4220113e937811529b12ea7f6427c0848630 # Parent 07adf050e1f463987f05070d586e564d8832f224 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@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> --- diff -r 07adf050e1f4 -r 66de4220113e xen/arch/ia64/xen/oprofile/xenoprof.c --- a/xen/arch/ia64/xen/oprofile/xenoprof.c Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/arch/ia64/xen/oprofile/xenoprof.c Thu Mar 08 17:02:57 2012 +0100 @@ -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 -r 07adf050e1f4 -r 66de4220113e xen/arch/x86/oprofile/backtrace.c --- a/xen/arch/x86/oprofile/backtrace.c Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/arch/x86/oprofile/backtrace.c Thu Mar 08 17:02:57 2012 +0100 @@ -32,10 +32,10 @@ #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 @@ #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 @@ 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 @@ * 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 @@ } #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 -r 07adf050e1f4 -r 66de4220113e xen/arch/x86/oprofile/xenoprof.c --- a/xen/arch/x86/oprofile/xenoprof.c Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/arch/x86/oprofile/xenoprof.c Thu Mar 08 17:02:57 2012 +0100 @@ -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 @@ } #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 -r 07adf050e1f4 -r 66de4220113e xen/common/xenoprof.c --- a/xen/common/xenoprof.c Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/common/xenoprof.c Thu Mar 08 17:02:57 2012 +0100 @@ -511,24 +511,23 @@ 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 @@ } } - 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 @@ } if ( backtrace_depth > 0 ) - xenoprof_backtrace(d, vcpu, regs, backtrace_depth, mode); + xenoprof_backtrace(vcpu, regs, backtrace_depth, mode); } diff -r 07adf050e1f4 -r 66de4220113e xen/include/asm-ia64/xenoprof.h --- a/xen/include/asm-ia64/xenoprof.h Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/include/asm-ia64/xenoprof.h Thu Mar 08 17:02:57 2012 +0100 @@ -45,14 +45,13 @@ 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 -r 07adf050e1f4 -r 66de4220113e xen/include/asm-x86/xenoprof.h --- a/xen/include/asm-x86/xenoprof.h Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/include/asm-x86/xenoprof.h Thu Mar 08 17:02:57 2012 +0100 @@ -56,16 +56,15 @@ #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 -r 07adf050e1f4 -r 66de4220113e xen/include/xen/xenoprof.h --- a/xen/include/xen/xenoprof.h Thu Mar 08 13:49:24 2012 +0100 +++ b/xen/include/xen/xenoprof.h Thu Mar 08 17:02:57 2012 +0100 @@ -68,8 +68,7 @@ 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 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__ */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |