summaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorChristian Ehrhardt <ehrhardt@linux.vnet.ibm.com>2008-07-14 14:00:00 +0200
committerAvi Kivity <avi@qumranet.com>2008-10-15 10:15:14 +0200
commite32c8f2c0720fb21c6f4a5f6ccbebdadc878f707 (patch)
tree75329603864952437757705781520dc52906b51c /virt
parent80e31d4f61f69d0e480ae092cda0e590d6a30aeb (diff)
downloadblackbird-op-linux-e32c8f2c0720fb21c6f4a5f6ccbebdadc878f707.tar.gz
blackbird-op-linux-e32c8f2c0720fb21c6f4a5f6ccbebdadc878f707.zip
KVM: kvmtrace: Remove use of bit fields in kvm trace structure
This patch fixes kvmtrace use on big endian systems. When using bit fields the compiler will lay data out in the wrong order expected when laid down into a file. This fixes it by using one variable instead of using bit fields. Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_trace.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/virt/kvm/kvm_trace.c b/virt/kvm/kvm_trace.c
index 58141f31ea8f..9acb78b3cc9f 100644
--- a/virt/kvm/kvm_trace.c
+++ b/virt/kvm/kvm_trace.c
@@ -54,12 +54,13 @@ static void kvm_add_trace(void *probe_private, void *call_data,
struct kvm_trace *kt = kvm_trace;
struct kvm_trace_rec rec;
struct kvm_vcpu *vcpu;
- int i, extra, size;
+ int i, size;
+ u32 extra;
if (unlikely(kt->trace_state != KVM_TRACE_STATE_RUNNING))
return;
- rec.event = va_arg(*args, u32);
+ rec.rec_val = TRACE_REC_EVENT_ID(va_arg(*args, u32));
vcpu = va_arg(*args, struct kvm_vcpu *);
rec.pid = current->tgid;
rec.vcpu_id = vcpu->vcpu_id;
@@ -67,21 +68,21 @@ static void kvm_add_trace(void *probe_private, void *call_data,
extra = va_arg(*args, u32);
WARN_ON(!(extra <= KVM_TRC_EXTRA_MAX));
extra = min_t(u32, extra, KVM_TRC_EXTRA_MAX);
- rec.extra_u32 = extra;
- rec.cycle_in = p->cycle_in;
+ rec.rec_val |= TRACE_REC_TCS(p->cycle_in)
+ | TRACE_REC_NUM_DATA_ARGS(extra);
- if (rec.cycle_in) {
+ if (p->cycle_in) {
rec.u.cycle.cycle_u64 = get_cycles();
- for (i = 0; i < rec.extra_u32; i++)
+ for (i = 0; i < extra; i++)
rec.u.cycle.extra_u32[i] = va_arg(*args, u32);
} else {
- for (i = 0; i < rec.extra_u32; i++)
+ for (i = 0; i < extra; i++)
rec.u.nocycle.extra_u32[i] = va_arg(*args, u32);
}
- size = calc_rec_size(rec.cycle_in, rec.extra_u32 * sizeof(u32));
+ size = calc_rec_size(p->cycle_in, extra * sizeof(u32));
relay_write(kt->rchan, &rec, size);
}
OpenPOWER on IntegriCloud