lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5384E6F9.6060806@codeaurora.org>
Date:	Tue, 27 May 2014 12:26:49 -0700
From:	Stephen Boyd <sboyd@...eaurora.org>
To:	Steven Rostedt <rostedt@...dmis.org>
CC:	Frederic Weisbecker <fweisbec@...il.com>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: Don't account for cpu idle time with irqsoff
 tracers

On 05/27/14 12:13, Steven Rostedt wrote:
> Hey! I was able to get to this.

Great!

>
> On Mon, 19 May 2014 12:30:47 -0700
> Stephen Boyd <sboyd@...eaurora.org> wrote:
>
>> +	if (!tracer_enabled || !tracing_is_enabled() ||
>> +			per_cpu(timings_stopped, cpu))
>> +		return;
> Micro optimization. As this gets called even when not tracing, the
> tracer_enabled is what determines if tracing is enabled or not. Can you
> keep the first condition the same, and just add your check to the one
> below:
>
> if (per_cpu(timings_stop, cpu) || per_cpu(tracing_cpu, cpu))
> 	return;

Ok.

>
>> +
>>  	if (per_cpu(tracing_cpu, cpu))
>>  		return;
>>  
>> @@ -418,7 +421,8 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
>>  	else
>>  		return;
>>  
>> -	if (!tracer_enabled || !tracing_is_enabled())
>> +	if (!tracer_enabled || !tracing_is_enabled() ||
>> +			per_cpu(timings_stopped, cpu))
>>  		return;
>>  
>>  	data = per_cpu_ptr(tr->trace_buffer.data, cpu);
>> @@ -439,15 +443,19 @@ stop_critical_timing(unsigned long ip, unsigned long parent_ip)
>>  /* start and stop critical timings used to for stoppage (in idle) */
>>  void start_critical_timings(void)
>>  {
>> -	if (preempt_trace() || irq_trace())
>> +	if (preempt_trace() || irq_trace()) {
>> +		per_cpu(timings_stopped, raw_smp_processor_id()) = false;
>>  		start_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
>> +	}
>>  }
>>  EXPORT_SYMBOL_GPL(start_critical_timings);
>>  
>>  void stop_critical_timings(void)
>>  {
>> -	if (preempt_trace() || irq_trace())
>> +	if (preempt_trace() || irq_trace()) {
>>  		stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
>> +		per_cpu(timings_stopped, raw_smp_processor_id()) = true;
>> +	}
> Hmm, I think this is racy. If we enter idle with tracing enabled it
> will set timings_stopped to true for this cpu. But if we disable
> tracing while in idle, it will not turn it off.
>
> Well, this isn't really true, because once we enable tracing the
> trace_type that is used to check preempt_trace() and irq_trace() stays
> set even when tracing isn't enabled. But this may change soon and that
> can make this a problem.
>
> I don't see any reason the setting of timings_stopped can't be set
> unconditionally in these functions.

I don't see any problem either. I'll send an update.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ