linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, anand.gore@broadcom.com,
	william.zhang@broadcom.com, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Anna-Maria Gleixner <anna-maria@linutronix.de>,
	Sebastian Siewior <bigeasy@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	"open list:PERFORMANCE EVENTS SUBSYSTEM" 
	<linux-perf-users@vger.kernel.org>
Subject: Re: [PATCH] perf: Fix perf_event_{init,exit}_cpu stubs
Date: Fri, 4 Nov 2022 10:38:02 -0700	[thread overview]
Message-ID: <c6852cb4-a929-2f42-bfcd-04c4aa99b4a5@gmail.com> (raw)
In-Reply-To: <Y2UOQpniaV12E0P9@hirez.programming.kicks-ass.net>



On 11/4/2022 6:06 AM, Peter Zijlstra wrote:
> On Thu, Nov 03, 2022 at 03:43:03PM -0700, Florian Fainelli wrote:
>> The original commit that introduced those stubs was already at fault,
>> but in the absence of a caller of perf_event_{init,exit}_cpu outside of
>> code that is compiled regardless of CONFIG_PERF_EVENTS, the build
>> failure cannot be observed. This was observed with the Android kernel to
>> produce a build failure similar to this:
>>
>>      In file included from ./include/uapi/linux/posix_types.h:5,
>>                       from ./include/uapi/linux/types.h:14,
>>                       from ./include/linux/types.h:6,
>>                       from ./include/linux/limits.h:6,
>>                       from ./include/linux/kernel.h:7,
>>                       from ./include/linux/sched/mm.h:5,
>>                       from kernel/cpu.c:6:
>>      kernel/cpu.c: In function 'random_and_perf_prepare_fusion':
>>      ./include/linux/stddef.h:8:14: error: called object is not a function or function pointer
>>       #define NULL ((void *)0)
>>                    ^
>>      ./include/linux/perf_event.h:1607:29: note: in expansion of macro 'NULL'
>>       #define perf_event_init_cpu NULL
>>                                   ^~~~
>>      kernel/cpu.c:1686:2: note: in expansion of macro 'perf_event_init_cpu'
>>        perf_event_init_cpu(cpu);
>>        ^~~~~~~~~~~~~~~~~~~
> 
> What is the actual problem reported here? Did you see all the other NULL
> assignments in cpuhp_hp_states ?

Anand reported to me that the following downstream commit in the Android 
common kernel repository:

https://android.googlesource.com/kernel/common/+/ca927bd22ad8bd26fd8dcebf3c7f2a093385d8ea

was resulting in the build failure above.

While this is an Android inflicted change and I still intend to get a 
fix there, upon closer look, the build failure could be experienced 
upstream as well with any code calling perf_event_{init,exit}_cpu() as a 
regular function call as opposed to being used as a function pointer.

This felt worthy of fixing in the upstream kernel, hence this patch.
-- 
Florian


  reply	other threads:[~2022-11-04 17:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 22:43 [PATCH] perf: Fix perf_event_{init,exit}_cpu stubs Florian Fainelli
2022-11-04 13:06 ` Peter Zijlstra
2022-11-04 17:38   ` Florian Fainelli [this message]
2022-11-10 19:05     ` Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c6852cb4-a929-2f42-bfcd-04c4aa99b4a5@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anand.gore@broadcom.com \
    --cc=anna-maria@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=william.zhang@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).