Merge branch 'perf/urgent' into perf/core
Merge reason: We want to apply a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
+1
-1
@@ -214,7 +214,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v)
|
||||
|
||||
static int irq_spurious_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, irq_spurious_proc_show, NULL);
|
||||
return single_open(file, irq_spurious_proc_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static const struct file_operations irq_spurious_proc_fops = {
|
||||
|
||||
+30
-7
@@ -3922,6 +3922,8 @@ static void perf_event_task_event(struct perf_task_event *task_event)
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(pmu, &pmus, entry) {
|
||||
cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
|
||||
if (cpuctx->active_pmu != pmu)
|
||||
goto next;
|
||||
perf_event_task_ctx(&cpuctx->ctx, task_event);
|
||||
|
||||
ctx = task_event->task_ctx;
|
||||
@@ -4066,6 +4068,8 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(pmu, &pmus, entry) {
|
||||
cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
|
||||
if (cpuctx->active_pmu != pmu)
|
||||
goto next;
|
||||
perf_event_comm_ctx(&cpuctx->ctx, comm_event);
|
||||
|
||||
ctxn = pmu->task_ctx_nr;
|
||||
@@ -4260,6 +4264,8 @@ got_name:
|
||||
rcu_read_lock();
|
||||
list_for_each_entry_rcu(pmu, &pmus, entry) {
|
||||
cpuctx = get_cpu_ptr(pmu->pmu_cpu_context);
|
||||
if (cpuctx->active_pmu != pmu)
|
||||
goto next;
|
||||
perf_event_mmap_ctx(&cpuctx->ctx, mmap_event,
|
||||
vma->vm_flags & VM_EXEC);
|
||||
|
||||
@@ -4841,7 +4847,7 @@ static int perf_swevent_init(struct perf_event *event)
|
||||
break;
|
||||
}
|
||||
|
||||
if (event_id > PERF_COUNT_SW_MAX)
|
||||
if (event_id >= PERF_COUNT_SW_MAX)
|
||||
return -ENOENT;
|
||||
|
||||
if (!event->parent) {
|
||||
@@ -5266,20 +5272,36 @@ static void *find_pmu_context(int ctxn)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void free_pmu_context(void * __percpu cpu_context)
|
||||
static void update_pmu_context(struct pmu *pmu, struct pmu *old_pmu)
|
||||
{
|
||||
struct pmu *pmu;
|
||||
int cpu;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
struct perf_cpu_context *cpuctx;
|
||||
|
||||
cpuctx = per_cpu_ptr(pmu->pmu_cpu_context, cpu);
|
||||
|
||||
if (cpuctx->active_pmu == old_pmu)
|
||||
cpuctx->active_pmu = pmu;
|
||||
}
|
||||
}
|
||||
|
||||
static void free_pmu_context(struct pmu *pmu)
|
||||
{
|
||||
struct pmu *i;
|
||||
|
||||
mutex_lock(&pmus_lock);
|
||||
/*
|
||||
* Like a real lame refcount.
|
||||
*/
|
||||
list_for_each_entry(pmu, &pmus, entry) {
|
||||
if (pmu->pmu_cpu_context == cpu_context)
|
||||
list_for_each_entry(i, &pmus, entry) {
|
||||
if (i->pmu_cpu_context == pmu->pmu_cpu_context) {
|
||||
update_pmu_context(i, pmu);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
free_percpu(cpu_context);
|
||||
free_percpu(pmu->pmu_cpu_context);
|
||||
out:
|
||||
mutex_unlock(&pmus_lock);
|
||||
}
|
||||
@@ -5311,6 +5333,7 @@ int perf_pmu_register(struct pmu *pmu)
|
||||
cpuctx->ctx.pmu = pmu;
|
||||
cpuctx->jiffies_interval = 1;
|
||||
INIT_LIST_HEAD(&cpuctx->rotation_list);
|
||||
cpuctx->active_pmu = pmu;
|
||||
}
|
||||
|
||||
got_cpu_context:
|
||||
@@ -5362,7 +5385,7 @@ void perf_pmu_unregister(struct pmu *pmu)
|
||||
synchronize_rcu();
|
||||
|
||||
free_percpu(pmu->pmu_disable_count);
|
||||
free_pmu_context(pmu->pmu_cpu_context);
|
||||
free_pmu_context(pmu);
|
||||
}
|
||||
|
||||
struct pmu *perf_init_event(struct perf_event *event)
|
||||
|
||||
+3
-1
@@ -1082,13 +1082,15 @@ void printk_tick(void)
|
||||
|
||||
int printk_needs_cpu(int cpu)
|
||||
{
|
||||
if (unlikely(cpu_is_offline(cpu)))
|
||||
printk_tick();
|
||||
return per_cpu(printk_pending, cpu);
|
||||
}
|
||||
|
||||
void wake_up_klogd(void)
|
||||
{
|
||||
if (waitqueue_active(&log_wait))
|
||||
__raw_get_cpu_var(printk_pending) = 1;
|
||||
this_cpu_write(printk_pending, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2338,11 +2338,19 @@ tracing_write_stub(struct file *filp, const char __user *ubuf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static loff_t tracing_seek(struct file *file, loff_t offset, int origin)
|
||||
{
|
||||
if (file->f_mode & FMODE_READ)
|
||||
return seq_lseek(file, offset, origin);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations tracing_fops = {
|
||||
.open = tracing_open,
|
||||
.read = seq_read,
|
||||
.write = tracing_write_stub,
|
||||
.llseek = seq_lseek,
|
||||
.llseek = tracing_seek,
|
||||
.release = tracing_release,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user