Bug 5215

Summary: qemumips doesn't have CONFIG_TRACEPOINTS
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Richard Purdie <richard.purdie>
Component: kernelAssignee: Tom Zanussi <tom.zanussi>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: bruce.ashfield, tom.zanussi
Version: 1.4   
Target Milestone: 1.5   
Hardware: x86   
OS: mips   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Richard Purdie 2013-09-17 11:10:06 UTC
qemumips builds are showing:

WARNING: lttng-modules: no modules were created; this may be due to CONFIG_TRACEPOINTS not being enabled in your kernel.

reproducer is "bitbake lttng-modules" for qemumips. I'm assuming this should be enabled on mips and some setting was just overlooked?
Comment 1 Bruce Ashfield 2013-09-17 12:51:45 UTC
Tom had already been looking into this, I can't remember if he found the root cause yet.
If he hasn't I can likely have a look into it later today.
Comment 2 Tom Zanussi 2013-09-17 13:48:21 UTC
Yeah, I had mentioned this in our kernel meeting a couple weeks ago, and did look a bit into it but got sidetracked again..

Refreshing my memory, basically what I discovered was that CONFIG_TRACEPOINTS wasn't on because CONFIG_TRACING wasn't on, and CONFIG_TRACING normally gets turned on by the ftrace feature, but in the mips machines ftrace is disabled:

bsp/mti-malta32/mti-malta32.scc:include features/ftrace/ftrace-disable.scc

I'm not sure why the mips machines disable ftrace, but probably the mips machines need to explicitly enable CONFIG_TRACING.  Probably in general nothing should be counting on CONFIG_TRACING being turned on as a side effect of one feature or another..
Comment 3 Tom Zanussi 2013-09-17 13:50:53 UTC
Oh, here's the explanation for ftrace-disable in mti-malta32.scc:

# v3.8+ kernels have broken mips dynamic ftrace, disable it completely for now
Comment 4 Bruce Ashfield 2013-09-17 13:51:41 UTC
Ah yes, on the qemu machines, in particular 64 bit mips. ftrace is completely broken and 
causes boot failures due to the dynamic trace point calculations. 

We can try re-enabling it again, but an upstream search for a full fix needs to be done first.

Anyone can try a quick boot test, but during my uprev, I carried the config forward as-is, 
since that was the known good baseline.
Comment 5 Tom Zanussi 2013-09-17 13:54:16 UTC
We should be able to turn on tracepoints explicitly and forget about ftrace, I think.
Comment 6 Tom Zanussi 2013-09-17 14:39:34 UTC
I assume it's not just DYNAMIC_FTRACE that breaks mips?  It's not turned on explicitly by anything, turning on the function tracer seems to turn it on automatically, but under the assumption that it's any function tracing that causes problems for mips, adding CONFIG_ENABLE_DEFAULT_TRACERS to mips might do the trick for now..
Comment 7 Tom Zanussi 2013-09-17 15:48:39 UTC
Adding and testing a new tracing/enable-default-tracers.scc to be added after every use of ftrace-disable.scc...
Comment 8 Darren Hart 2013-09-17 16:27:47 UTC
Assigning to Tom as he's clearly already moving with this.
Comment 9 Tom Zanussi 2013-09-17 19:46:06 UTC
Actually ONFIG_ENABLE_DEFAULT_TRACERS, CONFIG_TRACEPOINTS, etc can't be turned on unless CONFIG_FTRACE is turned on.  CONFIG_FTRACE 'Tracers' is to 'Enable the kernel tracing infrastructure.', the function tracers and dynamic function tracing apparently causing problems are FUNCTION_TRACER
Comment 10 Tom Zanussi 2013-09-17 19:50:19 UTC
(In reply to comment #9)
> Actually ONFIG_ENABLE_DEFAULT_TRACERS, CONFIG_TRACEPOINTS, etc can't be
> turned on unless CONFIG_FTRACE is turned on.  CONFIG_FTRACE 'Tracers' is to
> 'Enable the kernel tracing infrastructure.', the function tracers and
> dynamic function tracing apparently causing problems are FUNCTION_TRACER

oops hit send before done...

FUNCTION_TRACER Enable the kernel to trace every kernel function. This is done
by using a compiler feature to insert a small, 5-byte No-Operation
instruction at the beginning of every kernel function

and DYNAMIC_FTRACE This option will modify all the calls to function tracing
dynamically (will patch them out of the binary image and
replace them with a No-Op instruction) on boot up.

So we should be able to turn FTRACE on but make sure the above are off.

If that's ok, I'll submit a patch for that, otherwise, need more info on if it really is just FTRACE alone that causes the problem.
Comment 11 Bruce Ashfield 2013-09-17 20:28:15 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Actually ONFIG_ENABLE_DEFAULT_TRACERS, CONFIG_TRACEPOINTS, etc can't be
> > turned on unless CONFIG_FTRACE is turned on.  CONFIG_FTRACE 'Tracers' is to
> > 'Enable the kernel tracing infrastructure.', the function tracers and
> > dynamic function tracing apparently causing problems are FUNCTION_TRACER
> 
> oops hit send before done...
> 
> FUNCTION_TRACER Enable the kernel to trace every kernel function. This is
> done
> by using a compiler feature to insert a small, 5-byte No-Operation
> instruction at the beginning of every kernel function
> 
> and DYNAMIC_FTRACE This option will modify all the calls to function tracing
> dynamically (will patch them out of the binary image and
> replace them with a No-Op instruction) on boot up.
> 
> So we should be able to turn FTRACE on but make sure the above are off.
> 
> If that's ok, I'll submit a patch for that, otherwise, need more info on if
> it really is just FTRACE alone that causes the problem.

That should be fine. A quick boot test will show if it works or not, so if you can 
enable ftrace, and disable dynamic ftrace and still boot, we are good.
Comment 12 Tom Zanussi 2013-09-18 01:24:23 UTC
Patches sent to linux-yocto ML:

https://lists.yoctoproject.org/pipermail/linux-yocto/2013-September/001005.html