mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
KVM: Support mixed endian machines
Currently kvmtrace is not portable. This will prevent from copying a trace file from big-endian target to little-endian workstation for analysis. In the patch, kernel outputs metadata containing a magic number to trace log, and changes 64-bit words to be u64 instead of a pair of u32s. Signed-off-by: Tan Li <[email protected]> Acked-by: Jerone Young <[email protected]> Acked-by: Hollis Blanchard <[email protected]> Signed-off-by: Avi Kivity <[email protected]>
This commit is contained in:
parent
25be46080f
commit
9ef621d3be
2 changed files with 14 additions and 8 deletions
|
|
@ -72,11 +72,7 @@ static void kvm_add_trace(void *probe_private, void *call_data,
|
|||
rec.cycle_in = p->cycle_in;
|
||||
|
||||
if (rec.cycle_in) {
|
||||
u64 cycle = 0;
|
||||
|
||||
cycle = get_cycles();
|
||||
rec.u.cycle.cycle_lo = (u32)cycle;
|
||||
rec.u.cycle.cycle_hi = (u32)(cycle >> 32);
|
||||
rec.u.cycle.cycle_u64 = get_cycles();
|
||||
|
||||
for (i = 0; i < rec.extra_u32; i++)
|
||||
rec.u.cycle.extra_u32[i] = va_arg(*args, u32);
|
||||
|
|
@ -114,8 +110,18 @@ static int kvm_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
|
|||
{
|
||||
struct kvm_trace *kt;
|
||||
|
||||
if (!relay_buf_full(buf))
|
||||
if (!relay_buf_full(buf)) {
|
||||
if (!prev_subbuf) {
|
||||
/*
|
||||
* executed only once when the channel is opened
|
||||
* save metadata as first record
|
||||
*/
|
||||
subbuf_start_reserve(buf, sizeof(u32));
|
||||
*(u32 *)subbuf = 0x12345678;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
kt = buf->chan->private_data;
|
||||
atomic_inc(&kt->lost_records);
|
||||
|
|
|
|||
Loading…
Reference in a new issue