linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/x86: Add __ro_after_init annotations
@ 2018-08-10 15:43 Zubin Mithra
  2018-08-13 22:37 ` Kees Cook
  2018-09-11  6:20 ` [tip:perf/core] " tip-bot for Zubin Mithra
  0 siblings, 2 replies; 3+ messages in thread
From: Zubin Mithra @ 2018-08-10 15:43 UTC (permalink / raw)
  To: peterz, mingo, acme, alexander.shishkin, x86
  Cc: linux-kernel, groeck, keescook, zsm

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>
---
 arch/x86/events/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 5f4829f10129..88e5f67f5d4c 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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,
 };
@@ -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,
 };
@@ -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,
 };
 
@@ -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,
 };
-- 
2.18.0.597.ga71716f1ad-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf/x86: Add __ro_after_init annotations
  2018-08-10 15:43 [PATCH] perf/x86: Add __ro_after_init annotations Zubin Mithra
@ 2018-08-13 22:37 ` Kees Cook
  2018-09-11  6:20 ` [tip:perf/core] " tip-bot for Zubin Mithra
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2018-08-13 22:37 UTC (permalink / raw)
  To: Zubin Mithra
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Alexander Shishkin, X86 ML, LKML, Guenter Roeck

On Fri, Aug 10, 2018 at 8:43 AM, Zubin Mithra <zsm@chromium.org> wrote:
> 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>

-Kees

> ---
>  arch/x86/events/core.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 5f4829f10129..88e5f67f5d4c 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -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,
>  };
> @@ -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,
>  };
> @@ -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,
>  };
>
> @@ -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,
>  };
> --
> 2.18.0.597.ga71716f1ad-goog
>



-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip:perf/core] perf/x86: Add __ro_after_init annotations
  2018-08-10 15:43 [PATCH] perf/x86: Add __ro_after_init annotations Zubin Mithra
  2018-08-13 22:37 ` Kees Cook
@ 2018-09-11  6:20 ` tip-bot for Zubin Mithra
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Zubin Mithra @ 2018-09-11  6:20 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: zsm, keescook, tglx, torvalds, linux-kernel, mingo, peterz, hpa

Commit-ID:  2766d2ee960c52adc415931130dd6910158dd04d
Gitweb:     https://git.kernel.org/tip/2766d2ee960c52adc415931130dd6910158dd04d
Author:     Zubin Mithra <zsm@chromium.org>
AuthorDate: Fri, 10 Aug 2018 08:43:14 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 10 Sep 2018 14:55:36 +0200

perf/x86: Add __ro_after_init annotations

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>
---
 arch/x86/events/core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index dfb2f7c0d019..7a6fb9b2bec5 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -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,
 };
@@ -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,
 };
@@ -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,
 };
 
@@ -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,
 };

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-11  6:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 15:43 [PATCH] perf/x86: Add __ro_after_init annotations Zubin Mithra
2018-08-13 22:37 ` Kees Cook
2018-09-11  6:20 ` [tip:perf/core] " tip-bot for Zubin Mithra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).