aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/xenoprof.c
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-10 15:41:26 +0100
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-07-10 15:41:26 +0100
commitafd3d1854cc3896a78dc3d127fc9f153e98c6de2 (patch)
treeb00d2c2549373923a8906737162f1b03ddc68efa /xen/common/xenoprof.c
parent24b297caea90977f3fa9956c81c4c0577cce11cf (diff)
downloadxen-afd3d1854cc3896a78dc3d127fc9f153e98c6de2.tar.gz
xen-afd3d1854cc3896a78dc3d127fc9f153e98c6de2.tar.bz2
xen-afd3d1854cc3896a78dc3d127fc9f153e98c6de2.zip
xenoprof: Fix initialisation. Much can be done at boot-time, as
indicated by the fact that the low-level functiosn are marked '__init'. Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/common/xenoprof.c')
-rw-r--r--xen/common/xenoprof.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c
index 13dbdd8a04..9212156f02 100644
--- a/xen/common/xenoprof.c
+++ b/xen/common/xenoprof.c
@@ -21,26 +21,26 @@
/* Lock protecting the following global state */
static DEFINE_SPINLOCK(xenoprof_lock);
-struct domain *active_domains[MAX_OPROF_DOMAINS];
-int active_ready[MAX_OPROF_DOMAINS];
-unsigned int adomains;
+static struct domain *active_domains[MAX_OPROF_DOMAINS];
+static int active_ready[MAX_OPROF_DOMAINS];
+static unsigned int adomains;
-struct domain *passive_domains[MAX_OPROF_DOMAINS];
-unsigned int pdomains;
+static struct domain *passive_domains[MAX_OPROF_DOMAINS];
+static unsigned int pdomains;
-unsigned int activated;
-struct domain *xenoprof_primary_profiler;
-int xenoprof_state = XENOPROF_IDLE;
+static unsigned int activated;
+static struct domain *xenoprof_primary_profiler;
+static int xenoprof_state = XENOPROF_IDLE;
static unsigned long backtrace_depth;
-u64 total_samples;
-u64 invalid_buffer_samples;
-u64 corrupted_buffer_samples;
-u64 lost_samples;
-u64 active_samples;
-u64 passive_samples;
-u64 idle_samples;
-u64 others_samples;
+static u64 total_samples;
+static u64 invalid_buffer_samples;
+static u64 corrupted_buffer_samples;
+static u64 lost_samples;
+static u64 active_samples;
+static u64 passive_samples;
+static u64 idle_samples;
+static u64 others_samples;
int is_active(struct domain *d)
{
@@ -48,13 +48,13 @@ int is_active(struct domain *d)
return ((x != NULL) && (x->domain_type == XENOPROF_DOMAIN_ACTIVE));
}
-int is_passive(struct domain *d)
+static int is_passive(struct domain *d)
{
struct xenoprof *x = d->xenoprof;
return ((x != NULL) && (x->domain_type == XENOPROF_DOMAIN_PASSIVE));
}
-int is_profiled(struct domain *d)
+static int is_profiled(struct domain *d)
{
return (is_active(d) || is_passive(d));
}
@@ -543,24 +543,24 @@ void xenoprof_log_event(struct vcpu *vcpu,
static int xenoprof_op_init(XEN_GUEST_HANDLE(void) arg)
{
+ struct domain *d = current->domain;
struct xenoprof_init xenoprof_init;
int ret;
if ( copy_from_guest(&xenoprof_init, arg, 1) )
return -EFAULT;
- if ( (ret = xenoprof_arch_init(&xenoprof_init.num_events,
- &xenoprof_init.is_primary,
+ if ( (ret = xenoprof_arch_init(&xenoprof_init.num_events,
xenoprof_init.cpu_type)) )
return ret;
- if ( copy_to_guest(arg, &xenoprof_init, 1) )
- return -EFAULT;
-
+ xenoprof_init.is_primary =
+ ((xenoprof_primary_profiler == d) ||
+ ((xenoprof_primary_profiler == NULL) && (d->domain_id == 0)));
if ( xenoprof_init.is_primary )
xenoprof_primary_profiler = current->domain;
- return 0;
+ return (copy_to_guest(arg, &xenoprof_init, 1) ? -EFAULT : 0);
}
#endif /* !COMPAT */