RE: [patch 9/9] x86, bts, ftrace: a BTS ftrace plug-in prototype

From: Metzger, Markus T
Date: Tue Nov 25 2008 - 05:25:59 EST


>-----Original Message-----
>From: Andi Kleen [mailto:andi@xxxxxxxxxxxxxx]
>Sent: Dienstag, 25. November 2008 11:13
>To: Metzger, Markus T

>Markus Metzger <markus.t.metzger@xxxxxxxxx> 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?

It does. All the BTS bits currently live in ptrace.c - that had been the only user, so far. I will move them into ds.c, but this will take a few patches.

Ingo said its important to have an early prototype. So I did the first version with very restricted functionality and some duplicate code.


regards,
markus.

>
>-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@xxxxxxxxxxxxxxx
>
---------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen Germany
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456 Ust.-IdNr.
VAT Registration No.: DE129385895
Citibank Frankfurt (BLZ 502 109 00) 600119052

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/