[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1232117253.21980.74.camel@localhost.localdomain>
Date: Fri, 16 Jan 2009 09:47:33 -0500
From: Steven Rostedt <srostedt@...hat.com>
To: Markus Metzger <markus.t.metzger@...el.com>
Cc: linux-kernel@...r.kernel.org, mingo@...e.hu, tglx@...utronix.de,
hpa@...or.com, markus.t.metzger@...il.com, ak@...ux.jf.intel.com
Subject: Re: [patch 1/5] x86, ftrace, hw-branch-tracer: support hotplug cpus
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 @@
> }
> }
>
> +
--
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