1. 12 Feb, 2015 15 commits
  2. 11 Feb, 2015 6 commits
  3. 07 Feb, 2015 7 commits
  4. 06 Feb, 2015 9 commits
  5. 04 Feb, 2015 3 commits
    • Mark Rutland's avatar
      perf: Decouple unthrottling and rotating · 2fde4f94
      Mark Rutland authored
      Currently the adjusments made as part of perf_event_task_tick() use the
      percpu rotation lists to iterate over any active PMU contexts, but these
      are not used by the context rotation code, having been replaced by
      separate (per-context) hrtimer callbacks. However, some manipulation of
      the rotation lists (i.e. removal of contexts) has remained in
      perf_rotate_context(). This leads to the following issues:
      
      * Contexts are not always removed from the rotation lists. Removal of
        PMUs which have been placed in rotation lists, but have not been
        removed by a hrtimer callback can result in corruption of the rotation
        lists (when memory backing the context is freed).
      
        This has been observed to result in hangs when PMU drivers built as
        modules are inserted and removed around the creation of events for
        said PMUs.
      
      * Contexts which do not require rotation may be removed from the
        rotation lists as a result of a hrtimer, and will not be considered by
        the unthrottling code in perf_event_task_tick.
      
      This patch fixes the issue by updating the rotation ist when events are
      scheduled in/out, ensuring that each rotation list stays in sync with
      the HW state. As each event holds a refcount on the module of its PMU,
      this ensures that when a PMU module is unloaded none of its CPU contexts
      can be in a rotation list. By maintaining a list of perf_event_contexts
      rather than perf_event_cpu_contexts, we don't need separate paths to
      handle the cpu and task contexts, which also makes the code a little
      simpler.
      
      As the rotation_list variables are not used for rotation, these are
      renamed to active_ctx_list, which better matches their current function.
      perf_pmu_rotate_{start,stop} are renamed to
      perf_pmu_ctx_{activate,deactivate}.
      Reported-by: default avatarJohannes Jensen <johannes.jensen@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Will Deacon <Will.Deacon@arm.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/20150129134511.GR17721@leverpostejSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      2fde4f94
    • Mark Rutland's avatar
      perf: Drop module reference on event init failure · cc34b98b
      Mark Rutland authored
      When initialising an event, perf_init_event will call try_module_get() to
      ensure that the PMU's module cannot be removed for the lifetime of the
      event, with __free_event() dropping the reference when the event is
      finally destroyed. If something fails after the event has been
      initialised, but before the event is installed, perf_event_alloc will
      drop the reference on the module.
      
      However, if we fail to initialise an event for some reason (e.g. we ask
      an uncore PMU to perform sampling, and it refuses to initialise the
      event), we do not drop the refcount. If we try to open such a bogus
      event without a precise IDR type, we will loop over each PMU in the pmus
      list, incrementing each of their refcounts without decrementing them.
      
      This patch adds a module_put when pmu->event_init(event) fails, ensuring
      that the refcounts are balanced in failure cases. As the innards of the
      precise and search based initialisation look very similar, this logic is
      hoisted out into a new helper function. While the early return for the
      failed try_module_get is removed from the search case, this is handled
      by the remaining return when ret is not -ENOENT.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1420642611-22667-1-git-send-email-mark.rutland@arm.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      cc34b98b
    • Jiri Olsa's avatar
      perf: Use POLLIN instead of POLL_IN for perf poll data in flag · 7c60fc0e
      Jiri Olsa authored
      Currently we flag available data (via poll syscall) on perf fd with
      POLL_IN macro, which is normally used for SIGIO interface.
      
      We've been lucky, because POLLIN (0x1) is subset of POLL_IN (0x20001)
      and sys_poll (do_pollfd function) cut the extra bit out (0x20000).
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1422467678-22341-1-git-send-email-jolsa@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      7c60fc0e