From: Keith Owens <kaos@ocs.com.au>
To: Andi Kleen <ak@suse.de>
Cc: Jan Beulich <jbeulich@novell.com>,
linux-kernel@vger.kernel.org, patches@x86-64.org
Subject: Re: [PATCH] x86: optionally show last exception from/to register contents
Date: Tue, 14 Aug 2007 01:05:17 +1000 [thread overview]
Message-ID: <18110.1187017517@ocs10w.ocs.com.au> (raw)
In-Reply-To: Your message of "Mon, 13 Aug 2007 15:08:45 +0200." <20070813130845.GA3406@bingen.suse.de>
Andi Kleen (on Mon, 13 Aug 2007 15:08:45 +0200) wrote:
>On Mon, Aug 13, 2007 at 12:33:05PM +0100, Jan Beulich wrote:
>
>
>>
>> if (cpu_has_ds) {
>> unsigned int l1;
>> --- linux-2.6.23-rc3/arch/i386/kernel/traps.c 2007-08-13 08:59:45.000000000 +0200
>> +++ 2.6.23-rc3-x86-ler/arch/i386/kernel/traps.c 2007-08-07 10:42:55.000000000 +0200
>> @@ -321,6 +321,13 @@ void show_registers(struct pt_regs *regs
>> unsigned int code_len = code_bytes;
>> unsigned char c;
>>
>> + if (__get_cpu_var(ler_msr)) {
>> + u32 from, to, hi;
>> +
>> + rdmsr(__get_cpu_var(ler_msr), from, hi);
>> + rdmsr(__get_cpu_var(ler_msr) + 1, to, hi);
>> + printk("LER: %08x -> %08x\n", from, to);
>> + }
>
>This seems racy -- AFAIK the MSR will record the last branch
>before an interrupt too, and the trap handlers enable interrupts
>before coming here.
>
>Can't think of a good way to avoid that for page fault at least
>without impacting interrupt latency or reading the MSR always.
KDB used to have a "last branch recording" (lbr) feature. The page
fault handler was modified to disable lbr before entering
do_page_fault(). Nobody seemed to care about the slight slowdown but
also nobody seemed to be using that feature for debugging, we rarely
get wild branches into the middle of nowhere. lbr was messy to
maintain for very little gain, so I removed it from KDB at
2.6.17-i386-2.
prev parent reply other threads:[~2007-08-13 16:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-13 11:33 [PATCH] x86: optionally show last exception from/to register contents Jan Beulich
2007-08-13 13:08 ` Andi Kleen
2007-08-13 13:13 ` Jan Beulich
2007-08-13 14:21 ` Andi Kleen
2007-08-13 16:45 ` Randy Dunlap
2007-08-13 15:05 ` Keith Owens [this message]
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=18110.1187017517@ocs10w.ocs.com.au \
--to=kaos@ocs.com.au \
--cc=ak@suse.de \
--cc=jbeulich@novell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=patches@x86-64.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.