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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 7 Oct 2008 06:39:41 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Andi Kleen <andi@...stfloor.org>
cc:	Arjan van de Ven <arjan@...radead.org>,
	linux-kernel@...r.kernel.org, mingo@...e.hu,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>, lenb@...nel.org
Subject: Re: PATCH] ftrace: Add a C/P state tracer to help power
 optimization


On Mon, 6 Oct 2008, Andi Kleen wrote:
> 
> > +void trace_power_end(struct power_trace *it)
> > +{
> > +	struct ring_buffer_event *event;
> > +	struct trace_power *entry;
> > +	struct trace_array_cpu *data;
> > +	unsigned long irq_flags;
> > +	struct trace_array *tr = power_trace;
> > +
> > +	if (!trace_power_enabled)
> > +		return;
> > +
> > +	preempt_disable();
> > +	it->end = ktime_get();
> > +	data = tr->data[smp_processor_id()];
> > +
> > +	event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
> > +					 &irq_flags);
> > +	if (!event)
> > +		goto out;
> > +	entry	= ring_buffer_event_data(event);
> > +	tracing_generic_entry_update(&entry->ent, 0, 0);
> > +	entry->ent.type = TRACE_POWER;
> > +	entry->state_data = *it;
> > +	ring_buffer_unlock_commit(tr->buffer, event, irq_flags);
> 
> When ring_buffer_lock_reserve really disables interrupts (I haven't
> checked since it's not in 2.6.27rc8) you could avoid the
> preempt_disable by moving the data = tr->data ... one below.

The ring_buffer_lock_reserve use to disable interrupts (I'll be removing
the flags argument soon). Now it just does a minimum of preempt_disable.
So your suggestion about moving the smp_processor_id() calls below that
is still valid. The reserve will always disable preemption.

-- Steve

> 
> Similar comments to trace_power_mark. Also it would be probably good 
> to use a common function instead of duplicating so much code.
> 
> 
--
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