From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] x86/traps: Misc tweaks to several printk()s
Date: Tue, 14 Jul 2015 18:54:45 +0100 [thread overview]
Message-ID: <1436896485-25577-1-git-send-email-andrew.cooper3@citrix.com> (raw)
* Reword the printk() in do_guest_trap() to avoid
"Unhandled general protection fault fault/trap"
* Drop irrelevant file/line references.
* Make some of the text more concise.
* A trap with an extable entry does not warrant an error level message.
* Use %ps for extable sources to provide extra context.
* Always log emulated rdmsr failures, like wrmsr failures
Sample new messages are:
(XEN) d0v0 attempted WRMSR 0x00000174: 0x000000000000e008 -> 0x0000000000000010
(XEN) Exception [#0, ec=0000] (divide error): do_extreme_debug+0x36/0x51 ffff82d08018ca67 -> ffff82d08023cc4c
(XEN) #GP[0000]: do_general_protection+0x2fbf/0x34e0 ffff82d080193407 -> ffff82d08023cd8f
(XEN) d1v0 attempted RDMSR 0xdead0000
(XEN) d1v0 Unhandled exception [#13, ec=0000] general protection fault
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Jan Beulich <JBeulich@suse.com>
---
xen/arch/x86/traps.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 556c5be..2fef93d 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -521,8 +521,8 @@ static void do_guest_trap(
if ( unlikely(null_trap_bounce(v, tb)) )
gprintk(XENLOG_WARNING,
- "Unhandled %s fault/trap [#%d, ec=%04x]\n",
- trapstr(trapnr), trapnr, regs->error_code);
+ "Unhandled exception [#%d, ec=%04x] %s\n",
+ trapnr, regs->error_code, trapstr(trapnr));
}
static void instruction_done(
@@ -626,8 +626,9 @@ static void do_trap(struct cpu_user_regs *regs, int use_error_code)
if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
{
- dprintk(XENLOG_ERR, "Trap %d: %p -> %p\n",
- trapnr, _p(regs->eip), _p(fixup));
+ printk(XENLOG_INFO "Exception [#%d, ec=%04x] (%s): %ps %p -> %p\n",
+ trapnr, use_error_code ? regs->error_code : 0, trapstr(trapnr),
+ _p(regs->eip), _p(regs->eip), _p(fixup));
this_cpu(last_extable_addr) = regs->eip;
regs->eip = fixup;
return;
@@ -2677,9 +2678,9 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
if ( (rdmsr_safe(regs->ecx, val) != 0) || (msr_content != val) )
invalid:
- gdprintk(XENLOG_WARNING, "Domain attempted WRMSR %p from "
- "0x%016"PRIx64" to 0x%016"PRIx64".\n",
- _p(regs->ecx), val, msr_content);
+ gprintk(XENLOG_WARNING,
+ "attempted WRMSR 0x%08x: 0x%016"PRIx64" -> 0x%016"PRIx64"\n",
+ regs->_ecx, val, msr_content);
break;
}
break;
@@ -2813,10 +2814,11 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
case MSR_EFER:
rdmsr_normal:
/* Everyone can read the MSR space. */
- /* gdprintk(XENLOG_WARNING,"Domain attempted RDMSR %p.\n",
- _p(regs->ecx));*/
if ( rdmsr_safe(regs->ecx, val) )
+ {
+ gprintk(XENLOG_WARNING, "attempted RDMSR 0x%08x\n", regs->_ecx);
goto fail;
+ }
rdmsr_writeback:
regs->eax = (uint32_t)val;
regs->edx = (uint32_t)(val >> 32);
@@ -3283,8 +3285,8 @@ void do_general_protection(struct cpu_user_regs *regs)
if ( likely((fixup = search_exception_table(regs->eip)) != 0) )
{
- dprintk(XENLOG_INFO, "GPF (%04x): %p -> %p\n",
- regs->error_code, _p(regs->eip), _p(fixup));
+ printk(XENLOG_INFO "#GP[%04x]: %ps %p -> %p\n",
+ regs->error_code, _p(regs->eip), _p(regs->eip) , _p(fixup));
this_cpu(last_extable_addr) = regs->eip;
regs->eip = fixup;
return;
--
1.7.10.4
next reply other threads:[~2015-07-14 17:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-14 17:54 Andrew Cooper [this message]
2015-07-15 9:03 ` [PATCH] x86/traps: Misc tweaks to several printk()s Jan Beulich
2015-07-15 9:48 ` Andrew Cooper
2015-07-15 10:01 ` Jan Beulich
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=1436896485-25577-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).