Skip to content

Commit a7b4031

Browse files
committed
xen/x86: add diagnostic printout to xen_mc_flush() in case of error
Failure of an element of a Xen multicall is signalled via a WARN() only if the kernel is compiled with MC_DEBUG. It is impossible to know which element failed and why it did so. Change that by printing the related information even without MC_DEBUG, even if maybe in some limited form (e.g. without information which caller produced the failing element). Move the printing out of the switch statement in order to have the same information for a single call. Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Juergen Gross <jgross@suse.com>
1 parent f2a5fef commit a7b4031

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

arch/x86/xen/multicalls.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ void xen_mc_flush(void)
6969

7070
trace_xen_mc_flush(b->mcidx, b->argidx, b->cbidx);
7171

72+
#if MC_DEBUG
73+
memcpy(b->debug, b->entries,
74+
b->mcidx * sizeof(struct multicall_entry));
75+
#endif
76+
7277
switch (b->mcidx) {
7378
case 0:
7479
/* no-op */
@@ -87,32 +92,34 @@ void xen_mc_flush(void)
8792
break;
8893

8994
default:
90-
#if MC_DEBUG
91-
memcpy(b->debug, b->entries,
92-
b->mcidx * sizeof(struct multicall_entry));
93-
#endif
94-
9595
if (HYPERVISOR_multicall(b->entries, b->mcidx) != 0)
9696
BUG();
9797
for (i = 0; i < b->mcidx; i++)
9898
if (b->entries[i].result < 0)
9999
ret++;
100+
}
100101

102+
if (WARN_ON(ret)) {
103+
pr_err("%d of %d multicall(s) failed: cpu %d\n",
104+
ret, b->mcidx, smp_processor_id());
105+
for (i = 0; i < b->mcidx; i++) {
106+
if (b->entries[i].result < 0) {
101107
#if MC_DEBUG
102-
if (ret) {
103-
printk(KERN_ERR "%d multicall(s) failed: cpu %d\n",
104-
ret, smp_processor_id());
105-
dump_stack();
106-
for (i = 0; i < b->mcidx; i++) {
107-
printk(KERN_DEBUG " call %2d/%d: op=%lu arg=[%lx] result=%ld\t%pF\n",
108-
i+1, b->mcidx,
108+
pr_err(" call %2d: op=%lu arg=[%lx] result=%ld\t%pF\n",
109+
i + 1,
109110
b->debug[i].op,
110111
b->debug[i].args[0],
111112
b->entries[i].result,
112113
b->caller[i]);
114+
#else
115+
pr_err(" call %2d: op=%lu arg=[%lx] result=%ld\n",
116+
i + 1,
117+
b->entries[i].op,
118+
b->entries[i].args[0],
119+
b->entries[i].result);
120+
#endif
113121
}
114122
}
115-
#endif
116123
}
117124

118125
b->mcidx = 0;
@@ -126,8 +133,6 @@ void xen_mc_flush(void)
126133
b->cbidx = 0;
127134

128135
local_irq_restore(flags);
129-
130-
WARN_ON(ret);
131136
}
132137

133138
struct multicall_space __xen_mc_entry(size_t args)

0 commit comments

Comments
 (0)