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] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 25 Nov 2008 11:39:35 +0100
From:	"Frédéric Weisbecker" <fweisbec@...il.com>
To:	"Markus Metzger" <markus.t.metzger@...el.com>
Cc:	hpa@...or.com, linux-kernel@...r.kernel.org, mingo@...e.hu,
	tglx@...utronix.de, markus.t.metzger@...il.com, roland@...hat.com,
	akpm@...ux-foundation.org, mtk.manpages@...il.com,
	eranian@...glemail.com, juan.villacis@...el.com,
	"Andi Kleen" <andi@...stfloor.org>
Subject: Re: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype

Hi Markus,

2008/11/25 Markus Metzger <markus.t.metzger@...el.com>:
> +static enum print_line_t bts_trace_print_line(struct trace_iterator *iter)
> +{
> +       struct trace_entry *entry = iter->ent;
> +       struct trace_seq *seq = &iter->seq;
> +       struct bts_entry *it;
> +
> +       trace_assign_type(it, entry);
> +
> +       if (entry->type == TRACE_BTS) {
> +               int ret;
> +#ifdef CONFIG_KALLSYMS
> +               char function[KSYM_SYMBOL_LEN];
> +               sprint_symbol(function, it->from);
> +#else
> +               char *function = "<unknown>";
> +#endif
> +
> +               ret = trace_seq_printf(seq, "%4d  0x%lx -> 0x%lx [%s]\n",
> +                                      entry->cpu, it->from, it->to, function);


You can use seq_print_ip_sym() which handles the ifdef and the sprint_symbol...


> +void trace_bts(struct trace_array *tr, unsigned long from, unsigned long to)
> +{
> +       struct ring_buffer_event *event;
> +       struct bts_entry *entry;
> +       unsigned long irq;
> +
> +       event = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry), &irq);
> +       if (!event)
> +               return;
> +       entry   = ring_buffer_event_data(event);
> +       tracing_generic_entry_update(&entry->ent, 0, from);
> +       entry->ent.type = TRACE_BTS;
> +       entry->ent.cpu = smp_processor_id();


If you look at the struct trace_entry, you will see find the cpu
field. It is already inserted automatically :-)
--
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