mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen: Modify domain_crash() to take a print string
There are two problems with domain_crash(). First, that it is frequently not preceded by a printk() at all, or only by a dprintk(). Either way, critical diagnostic information is missing for an event which is fatal to the guest. Second, the embedded __LINE__ is an issue for livepatching, creating unwanted churn in the binary diff. This is the final __LINE__ remaining in livepatching-relevant contexts. The end goal is to have domain_crash() require a print string which gets fed to printk(), making it far less easy to omit relevant diagnostic information. However, modifying all callers at once is far too big and complicated, so use some macro magic to tolerate the old API (no print string) in the short term. Adjust two callers in load_segments() to demonstrate the new API. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Julien Grall <jgrall@amazon.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
bc3c133841
commit
d7aaecd3e1
2 files changed
+13
-14
No files matched your search
+4
-10
@@ -1704,11 +1704,8 @@ static void load_segments(struct vcpu *n)
|
||||
put_guest(uregs->fs, esp - 5) |
|
||||
put_guest(uregs->es, esp - 6) |
|
||||
put_guest(uregs->ds, esp - 7) )
|
||||
{
|
||||
gprintk(XENLOG_ERR,
|
||||
"error while creating compat failsafe callback frame\n");
|
||||
domain_crash(n->domain);
|
||||
}
|
||||
domain_crash(n->domain,
|
||||
"Error creating compat failsafe callback frame\n");
|
||||
|
||||
if ( n->arch.pv.vgc_flags & VGCF_failsafe_disables_events )
|
||||
vcpu_info(n, evtchn_upcall_mask) = 1;
|
||||
@@ -1743,11 +1740,8 @@ static void load_segments(struct vcpu *n)
|
||||
put_guest(uregs->ds, rsp - 9) |
|
||||
put_guest(regs->r11, rsp - 10) |
|
||||
put_guest(regs->rcx, rsp - 11) )
|
||||
{
|
||||
gprintk(XENLOG_ERR,
|
||||
"error while creating failsafe callback frame\n");
|
||||
domain_crash(n->domain);
|
||||
}
|
||||
domain_crash(n->domain,
|
||||
"Error creating failsafe callback frame\n");
|
||||
|
||||
if ( n->arch.pv.vgc_flags & VGCF_failsafe_disables_events )
|
||||
vcpu_info(n, evtchn_upcall_mask) = 1;
|
||||
|
||||
@@ -766,10 +766,15 @@ void vcpu_end_shutdown_deferral(struct vcpu *v);
|
||||
* from any processor.
|
||||
*/
|
||||
void __domain_crash(struct domain *d);
|
||||
#define domain_crash(d) do { \
|
||||
printk("domain_crash called from %s:%d\n", __FILE__, __LINE__); \
|
||||
__domain_crash(d); \
|
||||
} while (0)
|
||||
#define domain_crash(d, ...) \
|
||||
do { \
|
||||
if ( count_args(__VA_ARGS__) == 0 ) \
|
||||
printk(XENLOG_ERR "domain_crash called from %s:%d\n", \
|
||||
__FILE__, __LINE__); \
|
||||
else \
|
||||
printk(XENLOG_ERR __VA_ARGS__); \
|
||||
__domain_crash(d); \
|
||||
} while ( 0 )
|
||||
|
||||
/*
|
||||
* Called from assembly code, with an optional address to help indicate why
|
||||
|
||||