[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87hc5wcdwu.fsf@basil.nowhere.org>
Date: Tue, 25 Nov 2008 11:12:33 +0100
From: Andi Kleen <andi@...stfloor.org>
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
Subject: Re: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype
Markus Metzger <markus.t.metzger@...el.com> writes:
Basic idea looks very useful. Thanks.
> +static void bts_trace_cpuinit(struct cpuinfo_x86 *c)
That should be somewhere generic I think. Doesn't ptrace have it too?
-Andi
> +{
> + switch (c->x86) {
> + case 0x6:
> + switch (c->x86_model) {
> + case 0x0 ... 0xC:
> + break;
> + case 0xD:
> + case 0xE: /* Pentium M */
> + sizeof_field = sizeof(long);
> + debugctl_mask = (1<<6)|(1<<7);
> + break;
> + default:
> + sizeof_field = 8;
> + debugctl_mask = (1<<6)|(1<<7);
> + break;
> + }
> + break;
> + case 0xF:
> + switch (c->x86_model) {
> + case 0x0:
> + case 0x1:
> + case 0x2: /* Netburst */
> + sizeof_field = sizeof(long);
> + debugctl_mask = (1<<2)|(1<<3);
> + break;
> + default:
> + /* sorry, don't know about them */
> + break;
> + }
> + break;
> + default:
> + /* sorry, don't know about them */
> + break;
> + }
> +}
> +
> +static inline void bts_enable(void)
> +{
> + unsigned long debugctl;
> +
> + rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
> + wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl | debugctl_mask);
> +}
> +
> +static inline void bts_disable(void)
> +{
> + unsigned long debugctl;
> +
> + rdmsrl(MSR_IA32_DEBUGCTLMSR, debugctl);
> + wrmsrl(MSR_IA32_DEBUGCTLMSR, debugctl & ~debugctl_mask);
> +}
> +
> +static void bts_trace_reset(struct trace_array *tr)
> +{
> + int cpu;
> +
> + tr->time_start = ftrace_now(tr->cpu);
> +
--
ak@...ux.intel.com
--
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