All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kernel: trace: remove __init from race_selftest_startup_function() and trace_selftest_startup_function_graph()
Date: Fri, 12 Jul 2013 15:20:58 +0800	[thread overview]
Message-ID: <51DFAE5A.2060005@asianux.com> (raw)
In-Reply-To: <51DF7250.9020209@asianux.com>

On 07/12/2013 11:04 AM, Chen Gang wrote:
> On 07/12/2013 10:38 AM, Steven Rostedt wrote:
>> On Fri, 2013-07-12 at 09:58 +0800, Chen Gang wrote:
>>> On 07/12/2013 09:41 AM, Steven Rostedt wrote:
>>>> On Fri, 2013-07-12 at 07:51 +0800, Chen Gang wrote:
>>>>
>>>>>> Hmm, can all trace_selftest_startup_* (*selftest* in trace_selftest.c)
>>>>>> use '__init', so not waste memory keeping them around ?
>>>> Yeah, they should all be set to __init, but that's pretty low on the
>>>> totem poll, as distros don't enable selftests in their main kernels.
>>>
>>> Excuse me, my English is not quite well, I guess your meaning is:
>>>
>>>   they should all be set to '__init', although it is minor in real world.
>>>
>>> Is it correct ?
>>
>> Correct.
>>
>>>
>>>
>>> For me, I recommend to let all *selftest* as the same: "all add '
>>> __init' or none add '__init'" (if choose add, all report warnings).
>>>
>>> Is it suitable to still send new related patch for it ? If so, could
>>> you provide your suggesting choice (all add, or none add) ?
>>
>> Does this patch fix your warning?
>>
>> -- Steve
>>
> 

After the test, they will not report the related warning.

Hmm..., but that will let another none *selftest* functions miss
'__read_mostly'.

Do the original *selftest* intend to have no '__init' so can fit other
none *selftest* with '__read_mostly', and without warnings ?

Welcome any members' suggestions or completions.

Thanks.

> I guess it can (although I do not give a compiling test), it seems a
> better fixing.
> 
> And is it suitable to let all *selftest* as the same ? (all add, or none
> add '__init').
> 
> Thanks.
> 
>> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
>> index a4ed382..5e794d1 100644
>> --- a/kernel/trace/trace.h
>> +++ b/kernel/trace/trace.h
>> @@ -680,6 +680,15 @@ extern int trace_selftest_startup_sched_switch(struct tracer *trace,
>>  					       struct trace_array *tr);
>>  extern int trace_selftest_startup_branch(struct tracer *trace,
>>  					 struct trace_array *tr);
>> +/*
>> + * Tracer data references selftest functions that only occur
>> + * on boot up. These can be __init functions. Thus, when selftests
>> + * are enabled, then the tracers need to reference __init functions.
>> + */
>> +#define __tracer_data		__refdata
>> +#else
>> +/* Tracers are seldom changed. Optimize when selftests are disabled. */
>> +#define __tracer_data		__read_mostly
>>  #endif /* CONFIG_FTRACE_STARTUP_TEST */
>>  
>>  extern void *head_page(struct trace_array_cpu *data);
>> diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
>> index b863f93..38fe148 100644
>> --- a/kernel/trace/trace_functions.c
>> +++ b/kernel/trace/trace_functions.c
>> @@ -199,7 +199,7 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
>>  	return 0;
>>  }
>>  
>> -static struct tracer function_trace __read_mostly =
>> +static struct tracer function_trace __tracer_data =
>>  {
>>  	.name		= "function",
>>  	.init		= function_trace_init,
>>
>>
>>
>>
> 
> 


-- 
Chen Gang

  reply	other threads:[~2013-07-12  7:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-11  0:31 [PATCH] kernel: trace: remove __init from race_selftest_startup_function() and trace_selftest_startup_function_graph() Chen Gang
2013-07-11 16:47 ` Steven Rostedt
2013-07-11 23:51   ` Chen Gang
2013-07-12  1:41     ` Steven Rostedt
2013-07-12  1:58       ` Chen Gang
2013-07-12  2:38         ` Steven Rostedt
2013-07-12  3:04           ` Chen Gang
2013-07-12  7:20             ` Chen Gang [this message]
2013-07-15  2:12               ` Chen Gang
2013-07-15 16:20                 ` Steven Rostedt
2013-07-16  0:22                   ` Chen Gang
2013-07-17  0:52                     ` Chen Gang

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=51DFAE5A.2060005@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.