All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
	linux-kernel@vger.kernel.org, mingo@elte.hu,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	lenb@kernel.org
Subject: Re: PATCH] ftrace: Add a C/P state tracer to help power optimization
Date: Tue, 7 Oct 2008 06:39:41 -0400 (EDT)	[thread overview]
Message-ID: <alpine.DEB.1.10.0810070635580.19491@gandalf.stny.rr.com> (raw)
In-Reply-To: <87y711moz2.fsf@basil.nowhere.org>


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.
> 
> 

  parent reply	other threads:[~2008-10-07 10:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-06 17:26 PATCH] ftrace: Add a C/P state tracer to help power optimization Arjan van de Ven
2008-10-06 20:46 ` Andi Kleen
2008-10-06 20:57   ` Arjan van de Ven
2008-10-06 21:19     ` Andi Kleen
2008-10-06 21:21       ` Arjan van de Ven
2008-10-06 21:34         ` Andi Kleen
2008-10-07 10:39   ` Steven Rostedt [this message]
2008-10-27 15:59 ` Ingo Molnar
2008-10-27 16:05   ` Steven Rostedt
2008-10-27 16:21     ` Alan Cox
2008-10-27 17:16       ` Steven Rostedt
2008-10-27 18:05   ` Arjan van de Ven
2008-10-27 19:47     ` Frank Ch. Eigler
2008-10-27 20:13       ` Steven Rostedt
2008-10-27 21:06       ` Arjan van de Ven
2008-10-28 10:04         ` Ingo Molnar
2009-02-10 20:57         ` Jason Baron
2009-02-10 21:26           ` Frederic Weisbecker
2009-02-11  9:30           ` Ingo Molnar
2009-02-11 18:57             ` Jason Baron

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=alpine.DEB.1.10.0810070635580.19491@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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.