From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756514AbcJ3Akh (ORCPT ); Sat, 29 Oct 2016 20:40:37 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:34357 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755771AbcJ3AkS (ORCPT ); Sat, 29 Oct 2016 20:40:18 -0400 From: David Carrillo-Cisneros To: linux-kernel@vger.kernel.org Cc: "x86@kernel.org" , Ingo Molnar , Thomas Gleixner , Andi Kleen , Kan Liang , Peter Zijlstra , Vegard Nossum , Marcelo Tosatti , Nilay Vaish , Borislav Petkov , Vikas Shivappa , Ravi V Shankar , Fenghua Yu , Paul Turner , Stephane Eranian , David Carrillo-Cisneros Subject: [PATCH v3 23/46] perf/core: hooks to add architecture specific features in perf_cgroup Date: Sat, 29 Oct 2016 17:38:20 -0700 Message-Id: <1477787923-61185-24-git-send-email-davidcc@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1477787923-61185-1-git-send-email-davidcc@google.com> References: <1477787923-61185-1-git-send-email-davidcc@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The hooks allows architectures to extend the behavior of the perf cgroup. In this patch series, the hooks are used to allow intel_cmt to follow changes in the perf_cgroup hierarchy. Signed-off-by: David Carrillo-Cisneros --- include/linux/perf_event.h | 11 +++++++++++ kernel/events/core.c | 12 ++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index 14dff7a..9f388d4 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -1386,4 +1386,15 @@ int perf_event_exit_cpu(unsigned int cpu); #define perf_event_exit_cpu NULL #endif +/* + * Hooks for architecture specific extensions for perf_cgroup. + */ +#ifndef perf_cgroup_arch_css_online +# define perf_cgroup_arch_css_online(css) 0 +#endif + +#ifndef perf_cgroup_arch_css_offline +# define perf_cgroup_arch_css_offline(css) do { } while (0) +#endif + #endif /* _LINUX_PERF_EVENT_H */ diff --git a/kernel/events/core.c b/kernel/events/core.c index 464f46d..e11a16a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -10748,6 +10748,16 @@ perf_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) return &jc->css; } +static int perf_cgroup_css_online(struct cgroup_subsys_state *css) +{ + return perf_cgroup_arch_css_online(css); +} + +static void perf_cgroup_css_offline(struct cgroup_subsys_state *css) +{ + perf_cgroup_arch_css_offline(css); +} + static void perf_cgroup_css_free(struct cgroup_subsys_state *css) { struct perf_cgroup *jc = container_of(css, struct perf_cgroup, css); @@ -10776,6 +10786,8 @@ static void perf_cgroup_attach(struct cgroup_taskset *tset) struct cgroup_subsys perf_event_cgrp_subsys = { .css_alloc = perf_cgroup_css_alloc, + .css_online = perf_cgroup_css_online, + .css_offline = perf_cgroup_css_offline, .css_free = perf_cgroup_css_free, .attach = perf_cgroup_attach, }; -- 2.8.0.rc3.226.g39d4020