Skip to content

Commit

Permalink
perf/x86: Add __ro_after_init annotations
Browse files Browse the repository at this point in the history
x86_pmu_{format,events,attr,caps}_group is written to in
init_hw_perf_events and not modified after. This makes them suitable
candidates for annotating as __ro_after_init.

Signed-off-by: Zubin Mithra <zsm@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: acme@kernel.org
Cc: alexander.shishkin@linux.intel.com
Cc: groeck@chromium.org
Link: http://lkml.kernel.org/r/20180810154314.96710-1-zsm@chromium.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Zubin Mithra authored and Ingo Molnar committed Sep 10, 2018
1 parent ba6cc93 commit 2766d2e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/x86/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ static void __init pmu_check_apic(void)

}

static struct attribute_group x86_pmu_format_group = {
static struct attribute_group x86_pmu_format_group __ro_after_init = {
.name = "format",
.attrs = NULL,
};
Expand Down Expand Up @@ -1715,7 +1715,7 @@ static struct attribute *events_attr[] = {
NULL,
};

static struct attribute_group x86_pmu_events_group = {
static struct attribute_group x86_pmu_events_group __ro_after_init = {
.name = "events",
.attrs = events_attr,
};
Expand Down Expand Up @@ -2230,7 +2230,7 @@ static struct attribute *x86_pmu_attrs[] = {
NULL,
};

static struct attribute_group x86_pmu_attr_group = {
static struct attribute_group x86_pmu_attr_group __ro_after_init = {
.attrs = x86_pmu_attrs,
};

Expand All @@ -2248,7 +2248,7 @@ static struct attribute *x86_pmu_caps_attrs[] = {
NULL
};

static struct attribute_group x86_pmu_caps_group = {
static struct attribute_group x86_pmu_caps_group __ro_after_init = {
.name = "caps",
.attrs = x86_pmu_caps_attrs,
};
Expand Down

0 comments on commit 2766d2e

Please sign in to comment.