From: Steven Rostedt <srostedt@redhat.com>
To: Markus Metzger <markus.t.metzger@intel.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, tglx@linutronix.de,
hpa@zytor.com, markus.t.metzger@gmail.com, ak@linux.jf.intel.com
Subject: Re: [patch 1/5] x86, ftrace, hw-branch-tracer: support hotplug cpus
Date: Fri, 16 Jan 2009 09:47:33 -0500 [thread overview]
Message-ID: <1232117253.21980.74.camel@localhost.localdomain> (raw)
In-Reply-To: <20090116115051.A29998@sedona.ch.intel.com>
On Fri, 2009-01-16 at 11:50 +0100, Markus Metzger wrote:
> static void bts_trace_print_header(struct seq_file *m)
> {
> seq_puts(m,
> @@ -107,18 +173,34 @@
> {
> struct ring_buffer_event *event;
> struct hw_branch_entry *entry;
> - unsigned long irq;
> + unsigned long irq1, irq2;
> + int cpu;
> +
> + if (unlikely(!tr))
> + return;
> +
> + if (unlikely(!trace_hw_branches_enabled))
> + return;
> +
> + local_irq_save(irq1);
> + cpu = raw_smp_processor_id();
> + if (atomic_inc_return(&tr->data[cpu]->disabled) != 1)
> + goto out;
>
> - event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), &irq);
> + event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), &irq2);
> if (!event)
> return;
You need a goto out here, otherwise you leave with interrupts disabled.
Doing 'echo 0 > /debug/tracing/tracing_on' will guarantee that you hit
this return.
-- Steve
> entry = ring_buffer_event_data(event);
> tracing_generic_entry_update(&entry->ent, 0, from);
> entry->ent.type = TRACE_HW_BRANCHES;
> - entry->ent.cpu = smp_processor_id();
> + entry->ent.cpu = cpu;
> entry->from = from;
> entry->to = to;
> - ring_buffer_unlock_commit(tr->buffer, event, irq);
> + ring_buffer_unlock_commit(tr->buffer, event, irq2);
> +
> + out:
> + atomic_dec(&tr->data[cpu]->disabled);
> + local_irq_restore(irq1);
> }
>
> static void trace_bts_at(struct trace_array *tr,
> @@ -142,6 +224,11 @@
> }
> }
>
> +
next prev parent reply other threads:[~2009-01-16 14:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-16 10:50 Markus Metzger
2009-01-16 14:47 ` Steven Rostedt [this message]
2009-01-16 14:59 ` Metzger, Markus T
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=1232117253.21980.74.camel@localhost.localdomain \
--to=srostedt@redhat.com \
--cc=ak@linux.jf.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@gmail.com \
--cc=markus.t.metzger@intel.com \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®