Skip to content

Commit

Permalink
Merge branch 'urgent' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/rric/oprofile into perf/urgent
  • Loading branch information
Ingo Molnar committed Sep 1, 2010
2 parents 68d3f1d + 269f45c commit b4c69d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 20 deletions.
22 changes: 17 additions & 5 deletions arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,13 @@ static int __init init_sysfs(void)
int error;

error = sysdev_class_register(&oprofile_sysclass);
if (!error)
error = sysdev_register(&device_oprofile);
if (error)
return error;

error = sysdev_register(&device_oprofile);
if (error)
sysdev_class_unregister(&oprofile_sysclass);

return error;
}

Expand All @@ -580,8 +585,10 @@ static void exit_sysfs(void)
}

#else
#define init_sysfs() do { } while (0)
#define exit_sysfs() do { } while (0)

static inline int init_sysfs(void) { return 0; }
static inline void exit_sysfs(void) { }

#endif /* CONFIG_PM */

static int __init p4_init(char **cpu_type)
Expand Down Expand Up @@ -695,6 +702,8 @@ int __init op_nmi_init(struct oprofile_operations *ops)
char *cpu_type = NULL;
int ret = 0;

using_nmi = 0;

if (!cpu_has_apic)
return -ENODEV;

Expand Down Expand Up @@ -774,7 +783,10 @@ int __init op_nmi_init(struct oprofile_operations *ops)

mux_init(ops);

init_sysfs();
ret = init_sysfs();
if (ret)
return ret;

using_nmi = 1;
printk(KERN_INFO "oprofile: using NMI interrupt.\n");
return 0;
Expand Down
27 changes: 14 additions & 13 deletions drivers/oprofile/buffer_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,14 @@ static struct notifier_block module_load_nb = {
.notifier_call = module_load_notify,
};


static void end_sync(void)
{
end_cpu_work();
/* make sure we don't leak task structs */
process_task_mortuary();
process_task_mortuary();
}


int sync_start(void)
{
int err;

if (!zalloc_cpumask_var(&marked_cpus, GFP_KERNEL))
return -ENOMEM;

start_cpu_work();
mutex_lock(&buffer_mutex);

err = task_handoff_register(&task_free_nb);
if (err)
Expand All @@ -173,7 +163,10 @@ int sync_start(void)
if (err)
goto out4;

start_cpu_work();

out:
mutex_unlock(&buffer_mutex);
return err;
out4:
profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
Expand All @@ -182,19 +175,27 @@ int sync_start(void)
out2:
task_handoff_unregister(&task_free_nb);
out1:
end_sync();
free_cpumask_var(marked_cpus);
goto out;
}


void sync_stop(void)
{
/* flush buffers */
mutex_lock(&buffer_mutex);
end_cpu_work();
unregister_module_notifier(&module_load_nb);
profile_event_unregister(PROFILE_MUNMAP, &munmap_nb);
profile_event_unregister(PROFILE_TASK_EXIT, &task_exit_nb);
task_handoff_unregister(&task_free_nb);
end_sync();
mutex_unlock(&buffer_mutex);
flush_scheduled_work();

/* make sure we don't leak task structs */
process_task_mortuary();
process_task_mortuary();

free_cpumask_var(marked_cpus);
}

Expand Down
2 changes: 0 additions & 2 deletions drivers/oprofile/cpu_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ void end_cpu_work(void)

cancel_delayed_work(&b->work);
}

flush_scheduled_work();
}

/*
Expand Down

0 comments on commit b4c69d4

Please sign in to comment.