linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/core: declare the percpu variable properly
@ 2018-11-27  9:13 Mukesh Ojha
  2018-12-05  7:43 ` Mukesh Ojha
  2018-12-11 15:30 ` [tip:perf/core] perf/core: Declare the __percpu attribute on non-deref types tip-bot for Mukesh Ojha
  0 siblings, 2 replies; 3+ messages in thread
From: Mukesh Ojha @ 2018-11-27  9:13 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mukesh Ojha, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Jiri Olsa, Namhyung Kim

Sparse reports the current declaration of percpu variable with
below warning

warning: incorrect type in initializer (different address spaces)
         expected void const [noderef] <asn:3>*__vpp_verify
         got struct perf_cpu_context *<noident>

Fix it by declaring it properly.

Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>

---
 include/linux/perf_event.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 53c500f..1d5c551 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -262,8 +262,8 @@ struct pmu {
 	 */
 	int				capabilities;
 
-	int * __percpu			pmu_disable_count;
-	struct perf_cpu_context * __percpu pmu_cpu_context;
+	int __percpu			*pmu_disable_count;
+	struct perf_cpu_context __percpu *pmu_cpu_context;
 	atomic_t			exclusive_cnt; /* < 0: cpu; > 0: tsk */
 	int				task_ctx_nr;
 	int				hrtimer_interval_ms;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center,
Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project


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

* Re: [PATCH] perf/core: declare the percpu variable properly
  2018-11-27  9:13 [PATCH] perf/core: declare the percpu variable properly Mukesh Ojha
@ 2018-12-05  7:43 ` Mukesh Ojha
  2018-12-11 15:30 ` [tip:perf/core] perf/core: Declare the __percpu attribute on non-deref types tip-bot for Mukesh Ojha
  1 sibling, 0 replies; 3+ messages in thread
From: Mukesh Ojha @ 2018-12-05  7:43 UTC (permalink / raw)
  To: linux-kernel
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Jiri Olsa,
	Namhyung Kim

Hi All,

Can you please review the change ?

Thanks,
Mukesh


On 11/27/2018 2:43 PM, Mukesh Ojha wrote:
> Sparse reports the current declaration of percpu variable with
> below warning
>
> warning: incorrect type in initializer (different address spaces)
>           expected void const [noderef] <asn:3>*__vpp_verify
>           got struct perf_cpu_context *<noident>
>
> Fix it by declaring it properly.
>
> Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
>
> ---
>   include/linux/perf_event.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 53c500f..1d5c551 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -262,8 +262,8 @@ struct pmu {
>   	 */
>   	int				capabilities;
>   
> -	int * __percpu			pmu_disable_count;
> -	struct perf_cpu_context * __percpu pmu_cpu_context;
> +	int __percpu			*pmu_disable_count;
> +	struct perf_cpu_context __percpu *pmu_cpu_context;
>   	atomic_t			exclusive_cnt; /* < 0: cpu; > 0: tsk */
>   	int				task_ctx_nr;
>   	int				hrtimer_interval_ms;


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

* [tip:perf/core] perf/core: Declare the __percpu attribute on non-deref types
  2018-11-27  9:13 [PATCH] perf/core: declare the percpu variable properly Mukesh Ojha
  2018-12-05  7:43 ` Mukesh Ojha
@ 2018-12-11 15:30 ` tip-bot for Mukesh Ojha
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Mukesh Ojha @ 2018-12-11 15:30 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mojha, jolsa, torvalds, acme, hpa, namhyung, tglx, mingo,
	linux-kernel, peterz

Commit-ID:  43b9e4febc66b98d83cc1560196d56ac7fef3c32
Gitweb:     https://git.kernel.org/tip/43b9e4febc66b98d83cc1560196d56ac7fef3c32
Author:     Mukesh Ojha <mojha@codeaurora.org>
AuthorDate: Tue, 27 Nov 2018 14:43:32 +0530
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 11 Dec 2018 15:01:48 +0100

perf/core: Declare the __percpu attribute on non-deref types

Sparse reports the current declaration of two perf percpu variables
with this warning:

  warning: incorrect type in initializer (different address spaces)
         expected void const [noderef] <asn:3>*__vpp_verify
         got struct perf_cpu_context *<noident>

While it's normally perfectly fine to place GCC attributes anywhere
in the definition, this particular attribute is for a checking
compiler's such as Sparse's benefit, which doesn't want __percpu
on pointers.

So reorder the attribute to come after the structure type, not after
the pointer type.

[ mingo: Rewrote the changelog. ]

Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/1543310012-7967-1-git-send-email-mojha@codeaurora.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 include/linux/perf_event.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 53c500f0ca79..1d5c551a5add 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -262,8 +262,8 @@ struct pmu {
 	 */
 	int				capabilities;
 
-	int * __percpu			pmu_disable_count;
-	struct perf_cpu_context * __percpu pmu_cpu_context;
+	int __percpu			*pmu_disable_count;
+	struct perf_cpu_context __percpu *pmu_cpu_context;
 	atomic_t			exclusive_cnt; /* < 0: cpu; > 0: tsk */
 	int				task_ctx_nr;
 	int				hrtimer_interval_ms;

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

end of thread, other threads:[~2018-12-11 15:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  9:13 [PATCH] perf/core: declare the percpu variable properly Mukesh Ojha
2018-12-05  7:43 ` Mukesh Ojha
2018-12-11 15:30 ` [tip:perf/core] perf/core: Declare the __percpu attribute on non-deref types tip-bot for Mukesh Ojha

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).