mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
Small fix for xenoprof.
Update list of privileged xenoprof operations which were not in sync with new added functions. Since the number of privileged operations is larger than the non privileged ones, change the logic to list unprivileged ones instead. Also added a few printk statements on failed xenoprof initialization to identify the source of the problem. Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
This commit is contained in:
1 parent
e082c0eae9
commit
9f665fdd21
2 files changed
+35
-12
No files matched your search
@@ -269,8 +269,12 @@ static int __init p4_init(char * cpu_type)
|
||||
{
|
||||
__u8 cpu_model = current_cpu_data.x86_model;
|
||||
|
||||
if ((cpu_model > 6) || (cpu_model == 5))
|
||||
if ((cpu_model > 6) || (cpu_model == 5)) {
|
||||
printk("xenoprof: Initialization failed. "
|
||||
"Intel processor model %d for pentium 4 family is not "
|
||||
"supported\n", cpu_model);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SMP
|
||||
strncpy (cpu_type, "i386/p4", XENOPROF_CPU_TYPE_SIZE - 1);
|
||||
@@ -301,8 +305,12 @@ static int __init ppro_init(char *cpu_type)
|
||||
{
|
||||
__u8 cpu_model = current_cpu_data.x86_model;
|
||||
|
||||
if (cpu_model > 0xd)
|
||||
if (cpu_model > 0xd) {
|
||||
printk("xenoprof: Initialization failed. "
|
||||
"Intel processor model %d for P6 class family is not "
|
||||
"supported\n", cpu_model);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cpu_model == 9) {
|
||||
strncpy (cpu_type, "i386/p6_mobile", XENOPROF_CPU_TYPE_SIZE - 1);
|
||||
@@ -324,8 +332,10 @@ int nmi_init(int *num_events, int *is_primary, char *cpu_type)
|
||||
__u8 family = current_cpu_data.x86;
|
||||
int prim = 0;
|
||||
|
||||
if (!cpu_has_apic)
|
||||
if (!cpu_has_apic) {
|
||||
printk("xenoprof: Initialization failed. No apic.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (primary_profiler == NULL) {
|
||||
/* For now, only dom0 can be the primary profiler */
|
||||
@@ -344,6 +354,9 @@ int nmi_init(int *num_events, int *is_primary, char *cpu_type)
|
||||
|
||||
switch (family) {
|
||||
default:
|
||||
printk("xenoprof: Initialization failed. "
|
||||
"AMD processor family %d is not "
|
||||
"supported\n", family);
|
||||
return -ENODEV;
|
||||
case 6:
|
||||
model = &op_athlon_spec;
|
||||
@@ -375,11 +388,17 @@ int nmi_init(int *num_events, int *is_primary, char *cpu_type)
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("xenoprof: Initialization failed. "
|
||||
"Intel processor family %d is not "
|
||||
"supported\n", family);
|
||||
return -ENODEV;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
printk("xenoprof: Initialization failed. "
|
||||
"Unsupported processor. Unknown vendor %d\n",
|
||||
vendor);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
@@ -492,19 +492,23 @@ int xenoprof_op_get_buffer(XEN_GUEST_HANDLE(void) arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PRIV_OP(op) ( (op == XENOPROF_set_active) \
|
||||
|| (op == XENOPROF_reserve_counters) \
|
||||
|| (op == XENOPROF_setup_events) \
|
||||
|| (op == XENOPROF_start) \
|
||||
|| (op == XENOPROF_stop) \
|
||||
|| (op == XENOPROF_release_counters) \
|
||||
|| (op == XENOPROF_shutdown))
|
||||
|
||||
#define NONPRIV_OP(op) ( (op == XENOPROF_init) \
|
||||
|| (op == XENOPROF_enable_virq) \
|
||||
|| (op == XENOPROF_disable_virq) \
|
||||
|| (op == XENOPROF_get_buffer))
|
||||
|
||||
int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if ( (op < 0) || (op>XENOPROF_last_op) )
|
||||
{
|
||||
printk("xenoprof: invalid operation %d for domain %d\n",
|
||||
op, current->domain->domain_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ( PRIV_OP(op) && (current->domain != primary_profiler) )
|
||||
if ( !NONPRIV_OP(op) && (current->domain != primary_profiler) )
|
||||
{
|
||||
printk("xenoprof: dom %d denied privileged operation %d\n",
|
||||
current->domain->domain_id, op);
|
||||
|
||||