diff mbox

[REPORT] bpf_trace: build error without PERF_EVENTS

Message ID 20151110092501.0bc676c9@gandalf.local.home
State Superseded, archived
Delegated to: David Miller
Headers show

Commit Message

Steven Rostedt Nov. 10, 2015, 2:25 p.m. UTC
On Tue, 10 Nov 2015 14:31:38 +0100
Daniel Borkmann <daniel@iogearbox.net> wrote:

> On 11/10/2015 01:55 PM, Arnd Bergmann wrote:
> > In my ARM randconfig tests, I'm getting a build error for
> > newly added code in bpf_perf_event_read and bpf_perf_event_output
> > whenever CONFIG_PERF_EVENTS is disabled:
> >
> > kernel/trace/bpf_trace.c: In function 'bpf_perf_event_read':
> > kernel/trace/bpf_trace.c:203:11: error: 'struct perf_event' has no member named 'oncpu'
> > if (event->oncpu != smp_processor_id() ||
> >           ^
> > kernel/trace/bpf_trace.c:204:11: error: 'struct perf_event' has no member named 'pmu'
> >        event->pmu->count)
> >
> > This can happen when UPROBE_EVENT is enabled but KPROBE_EVENT
> > is disabled. I'm not sure if that is a configuration we care
> > about, otherwise we could prevent this case from occuring by
> > adding Kconfig dependencies.  
> 
> I think that seems better than spreading #if IS_ENABLEDs into the code.
> Probably enough to add a 'depends on PERF_EVENTS' to config BPF_EVENTS,
> so it's also explicitly documented.
> 

So just do the following then?

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Alexei Starovoitov Nov. 10, 2015, 5:14 p.m. UTC | #1
On Tue, Nov 10, 2015 at 09:25:01AM -0500, Steven Rostedt wrote:
> On Tue, 10 Nov 2015 14:31:38 +0100
> Daniel Borkmann <daniel@iogearbox.net> wrote:
> 
> > On 11/10/2015 01:55 PM, Arnd Bergmann wrote:
> > > In my ARM randconfig tests, I'm getting a build error for
> > > newly added code in bpf_perf_event_read and bpf_perf_event_output
> > > whenever CONFIG_PERF_EVENTS is disabled:
> > >
> > > kernel/trace/bpf_trace.c: In function 'bpf_perf_event_read':
> > > kernel/trace/bpf_trace.c:203:11: error: 'struct perf_event' has no member named 'oncpu'
> > > if (event->oncpu != smp_processor_id() ||
> > >           ^
> > > kernel/trace/bpf_trace.c:204:11: error: 'struct perf_event' has no member named 'pmu'
> > >        event->pmu->count)
> > >
> > > This can happen when UPROBE_EVENT is enabled but KPROBE_EVENT
> > > is disabled. I'm not sure if that is a configuration we care
> > > about, otherwise we could prevent this case from occuring by
> > > adding Kconfig dependencies.  
> > 
> > I think that seems better than spreading #if IS_ENABLEDs into the code.
> > Probably enough to add a 'depends on PERF_EVENTS' to config BPF_EVENTS,
> > so it's also explicitly documented.
> > 
> 
> So just do the following then?
> 
> -- Steve
> 
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index 8d6363f42169..f5aecff2d243 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -434,7 +434,7 @@ config UPROBE_EVENT
>  
>  config BPF_EVENTS
>  	depends on BPF_SYSCALL
> -	depends on KPROBE_EVENT || UPROBE_EVENT
> +	depends on KPROBE_EVENT && UPROBE_EVENT

yeah that's definitely cleaner and avoids ifdef creep in the future.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Daniel Borkmann Nov. 10, 2015, 5:23 p.m. UTC | #2
On 11/10/2015 06:14 PM, Alexei Starovoitov wrote:
> On Tue, Nov 10, 2015 at 09:25:01AM -0500, Steven Rostedt wrote:
>> On Tue, 10 Nov 2015 14:31:38 +0100
>> Daniel Borkmann <daniel@iogearbox.net> wrote:
>>
>>> On 11/10/2015 01:55 PM, Arnd Bergmann wrote:
>>>> In my ARM randconfig tests, I'm getting a build error for
>>>> newly added code in bpf_perf_event_read and bpf_perf_event_output
>>>> whenever CONFIG_PERF_EVENTS is disabled:
>>>>
>>>> kernel/trace/bpf_trace.c: In function 'bpf_perf_event_read':
>>>> kernel/trace/bpf_trace.c:203:11: error: 'struct perf_event' has no member named 'oncpu'
>>>> if (event->oncpu != smp_processor_id() ||
>>>>            ^
>>>> kernel/trace/bpf_trace.c:204:11: error: 'struct perf_event' has no member named 'pmu'
>>>>         event->pmu->count)
>>>>
>>>> This can happen when UPROBE_EVENT is enabled but KPROBE_EVENT
>>>> is disabled. I'm not sure if that is a configuration we care
>>>> about, otherwise we could prevent this case from occuring by
>>>> adding Kconfig dependencies.
>>>
>>> I think that seems better than spreading #if IS_ENABLEDs into the code.
>>> Probably enough to add a 'depends on PERF_EVENTS' to config BPF_EVENTS,
>>> so it's also explicitly documented.
>>>
>>
>> So just do the following then?
>>
>> -- Steve
>>
>> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
>> index 8d6363f42169..f5aecff2d243 100644
>> --- a/kernel/trace/Kconfig
>> +++ b/kernel/trace/Kconfig
>> @@ -434,7 +434,7 @@ config UPROBE_EVENT
>>
>>   config BPF_EVENTS
>>   	depends on BPF_SYSCALL
>> -	depends on KPROBE_EVENT || UPROBE_EVENT
>> +	depends on KPROBE_EVENT && UPROBE_EVENT
>
> yeah that's definitely cleaner and avoids ifdef creep in the future.

Agreed, that's better.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 8d6363f42169..f5aecff2d243 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -434,7 +434,7 @@  config UPROBE_EVENT
 
 config BPF_EVENTS
 	depends on BPF_SYSCALL
-	depends on KPROBE_EVENT || UPROBE_EVENT
+	depends on KPROBE_EVENT && UPROBE_EVENT
 	bool
 	default y
 	help