]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
perf/core: Fix perf_event_enable_on_exec() timekeeping (again)
authorPeter Zijlstra <peterz@infradead.org>
Wed, 15 Feb 2017 15:12:20 +0000 (16:12 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 24 Feb 2017 07:56:32 +0000 (08:56 +0100)
Where commit:

  7fce250915ef ("perf: Fix scaling vs.  perf_event_enable_on_exec()")

disabled the ctx-time a-priory, such that all events get enabled and
scheduled at the time point in time, there is one hole in that patch,
when no events do get enabled nothing re-enables the ctx-time.

Reported-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Reported-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Fixes: 7fce250915ef ("perf: Fix scaling vs. perf_event_enable_on_exec()")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c

index 94d7b9aae92593c1ccaa3b8369a19b539f954213..d4e3f8d8238b32fcedb830929930881df249ae12 100644 (file)
@@ -3522,6 +3522,8 @@ static void perf_event_enable_on_exec(int ctxn)
        if (enabled) {
                clone_ctx = unclone_ctx(ctx);
                ctx_resched(cpuctx, ctx, event_type);
+       } else {
+               ctx_sched_in(ctx, cpuctx, EVENT_TIME, current);
        }
        perf_ctx_unlock(cpuctx, ctx);