kvm-trace help
I am trying to add a trace marker and the data is coming out all 0's. e.g.,
0 (+ 0) PTE_WRITE vcpu = 0x00000001 pid = 0x0000240d [ gpa =0x00000000 00000000 gpte = 0x00000000 00000000 ]
Patch is attached. I know the data is non-zero as I added an if check before calling the trace to only do the trace if the data is non-zero. Anyone have suggestions on what I am missing?
thanks,
david
kernel/include/asm/kvm.h +2 -0
@@ -221,12 +221,14 @@#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) +#define KVM_TRC_PTE_WRITE (KVM_TRC_HANDLER + 0x15) +#define KVM_TRC_PTE_FLOODED (KVM_TRC_HANDLER + 0x16)#endif
kernel/include/asm-x86/kvm.h +2 -0
@@ -221,12 +221,14 @@#define KVM_TRC_MSR_READ (KVM_TRC_HANDLER + 0x0B)#define KVM_TRC_MSR_WRITE (KVM_TRC_HANDLER + 0x0C)#define KVM_TRC_CPUID (KVM_TRC_HANDLER + 0x0D)#define KVM_TRC_INTR (KVM_TRC_HANDLER + 0x0E)#define KVM_TRC_NMI (KVM_TRC_HANDLER + 0x0F)#define KVM_TRC_VMMCALL (KVM_TRC_HANDLER + 0x10)#define KVM_TRC_HLT (KVM_TRC_HANDLER + 0x11)#define KVM_TRC_CLTS (KVM_TRC_HANDLER + 0x12)#define KVM_TRC_LMSW (KVM_TRC_HANDLER + 0x13)#define KVM_TRC_APIC_ACCESS (KVM_TRC_HANDLER + 0x14) +#define KVM_TRC_PTE_WRITE (KVM_TRC_HANDLER + 0x15) +#define KVM_TRC_PTE_FLOODED (KVM_TRC_HANDLER + 0x16)#endif
kernel/mmu.c +4 -1
@@ -1662,20 +1662,22 @@if (r)return ;memcpy ((void *)&gpte + (gpa %8 ), new,4 ); }else if ((bytes ==8 ) && (gpa %8 ==0 )) {memcpy ((void *)&gpte, new,8 ); } }else {if ((bytes ==4 ) && (gpa %4 ==0 ))memcpy ((void *)&gpte, new,4 ); } +KVMTRACE_4D (PTE_WRITE , vcpu, (u32 ) gpa, (u32)(gpa>>32 ), + (u32 ) gpte, (u32)(gpte>>32 ), handler);if (!is_present_pte (gpte))return ; gfn = (gpte &PT64_BASE_ADDR_MASK ) >>PAGE_SHIFT ;down_read (¤t->mm->mmap_sem);if (is_large_pte (gpte) &&is_largepage_backed (vcpu, gfn)) { gfn &= ~(KVM_PAGES_PER_HPAGE -1 ); vcpu->arch.update_pte.largepage =1 ; } pfn =gfn_to_pfn (vcpu->kvm, gfn);
@@ -1711,21 +1713,22 @@pgprintk ("%s: gpa %llx bytes %d\n" , __func__, gpa, bytes);mmu_guess_page_from_pte_write (vcpu, gpa, new, bytes);spin_lock (&vcpu->kvm->mmu_lock);kvm_mmu_free_some_pages (vcpu); ++vcpu->kvm->stat.mmu_pte_write;kvm_mmu_audit (vcpu,"pre pte write" );if (gfn == vcpu->arch.last_pt_write_gfn && !last_updated_pte_accessed (vcpu)) { ++vcpu->arch.last_pt_write_count; -if (vcpu->arch.last_pt_write_count >=3 ) +if (vcpu->arch.last_pt_write_count >=4 ) +KVMTRACE_0D (PTE_FLOODED , vcpu, handler); flooded =1 ; }else { vcpu->arch.last_pt_write_gfn = gfn; vcpu->arch.last_pt_write_count =1 ; vcpu->arch.last_pte_updated =NULL ; } index =kvm_page_table_hashfn (gfn); bucket = &vcpu->kvm->arch.mmu_page_hash[index];hlist_for_each_entry_safe (sp, node, n, bucket, hash_link) {if (sp->gfn != gfn || sp->role.metaphysical)
user/formats +2 -0
@@ -15,10 +15,12 @@ 0x0002000B %(tsc)d (+%(reltsc)8d) MSR_READ vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ MSR# = 0x%(1)08x, data = 0x%(3)08x %(2)08x ] 0x0002000C %(tsc)d (+%(reltsc)8d) MSR_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ MSR# = 0x%(1)08x, data = 0x%(3)08x %(2)08x ] 0x0002000D %(tsc)d (+%(reltsc)8d) CPUID vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ func = 0x%(1)08x, eax = 0x%(2)08x, ebx = 0x%(3)08x, ecx = 0x%(4)08x edx = 0x%(5)08x] 0x0002000E %(tsc)d (+%(reltsc)8d) INTR vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ vector = 0x%(1)02x ] 0x0002000F %(tsc)d (+%(reltsc)8d) NMI vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x 0x00020010 %(tsc)d (+%(reltsc)8d) VMMCALL vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ func = 0x%(1)08x ] 0x00020011 %(tsc)d (+%(reltsc)8d) HLT vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x 0x00020012 %(tsc)d (+%(reltsc)8d) CLTS vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x 0x00020013 %(tsc)d (+%(reltsc)8d) LMSW vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ value = 0x%(1)08x ] 0x00020014 %(tsc)d (+%(reltsc)8d) APIC_ACCESS vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ offset = 0x%(1)08x ] +0x00020015 %(tsc)d (+%(reltsc)8d) PTE_FLOODED vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x +0x00020016 %(tsc)d (+%(reltsc)8d) PTE_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ gpa = 0x%(2)08x %(1)08x gpte = 0x%(4)08x %(3)08x ]
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
Quoted 6 lines · David S. Ahern
I am trying to add a trace marker and the data is coming out all 0's. e.g.,
0 (+ 0)
PTE_WRITEvcpu =0x00000001pid =0x0000240d[
gpa =0x0000000000000000 gpte =0x0000000000000000 ]
Quoted 7 lines
Patch is attached. I know the data is non-zero as I added an if check before calling the trace to only do the trace if the data is non-zero. Anyone have suggestions on what I am missing?
thanks,
david
Hi, david
I read your patch and find this:
+#define KVM_TRC_PTE_WRITE (KVM_TRC_HANDLER +0x15)
+#define KVM_TRC_PTE_FLOODED (KVM_TRC_HANDLER +0x16)
but in your formats file
+0x00020015 %(tsc)d (+%(reltsc)8d) PTE_FLOODED vcpu
= 0x%(vcpu)08x pid = 0x%(pid)08x
+0x00020016 %(tsc)d (+%(reltsc)8d) PTE_WRITE vcpu
= 0x%(vcpu)08x pid = 0x%(pid)08x [ gpa = 0x%(2)08x %(1)08x gpte = 0x%(4)08x %(3)08x ]
You mistake the value, right?
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
inline.
Quoted 23 lines · Eric E
Quoted 6 lines · David S. Ahern
I am trying to add a trace marker and the data is coming out all 0's. e.g.,
0 (+ 0)
PTE_WRITEvcpu =0x00000001pid =0x0000240d[
gpa =0x0000000000000000 gpte =0x0000000000000000 ]Quoted 7 lines
Patch is attached. I know the data is non-zero as I added an if check before calling the trace to only do the trace if the data is non-zero. Anyone have suggestions on what I am missing?
thanks,
david
Hi, david
I read your patch and find this:
+#defineKVM_TRC_PTE_WRITE(KVM_TRC_HANDLER+0x15)
+#defineKVM_TRC_PTE_FLOODED(KVM_TRC_HANDLER+0x16)
but in your formats file
+0x00020015 %(tsc)d (+%(reltsc)8d)PTE_FLOODEDvcpu
= 0x%(vcpu)08x pid = 0x%(pid)08x
Quoted 5 lines
+0x00020016 %(tsc)d (+%(reltsc)8d) PTE_WRITE vcpu= 0x%(vcpu)08x pid = 0x%(pid)08x [ gpa = 0x%(2)08x %(1)08x gpte = 0x%(4)08x %(3)08x ]
You mistake the value, right?
Which value? Do you mean the 0x00020015 and0x00020016?
kvm.h shows KVM_TRC_APIC_ACCESS as KVM_TRC_HANDLER + 0x14. I added the PTE_WRITE and PTE_FLOODED after that in kvm.h with the values 0x15 and 0x16. Then in the formats file it shows APIC_ACCESS as 0x00020014, and I added the new PTE entries after that as 20015 and 20016. The kvmtrace_format tool does show those lines in its output which makes me believe these values are ok.
What has me puzzled is the 0 values for gpa and gpte. I believe they are not 0 because I added "if (gpa || gpte) before the KVMTRACE_4D(PTE_WRITE, ...) line and the lines still show up in the trace output.
david
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Quoted 20 lines · David S. Ahern
inline.
Quoted 17 lines · Eric E
Quoted 6 lines · David S. Ahern
I am trying to add a trace marker and the data is coming out all 0's. e.g.,
0 (+ 0)
PTE_WRITEvcpu =0x00000001pid =0x0000240d[
gpa =0x0000000000000000 gpte =0x0000000000000000 ]Quoted 7 lines
Patch is attached. I know the data is non-zero as I added an if check before calling the trace to only do the trace if the data is non-zero. Anyone have suggestions on what I am missing?
thanks,
david
Hi, david
I read your patch and find this:
+#defineKVM_TRC_PTE_WRITE(KVM_TRC_HANDLER+
0x15)
Quoted 1 line
Quoted 1 line
+#define
KVM_TRC_PTE_FLOODED(KVM_TRC_HANDLER+
0x16)
Quoted 8 lines
Quoted 7 lines
but in your formats file
+0x00020015 %(tsc)d (+%(reltsc)8d)PTE_FLOODEDvcpu
= 0x%(vcpu)08x pid = 0x%(pid)08x+0x00020016 %(tsc)d (+%(reltsc)8d) PTE_WRITE vcpu = 0x%(vcpu)08x pid = 0x%(pid)08x [ gpa = 0x%(2)08x %(1)08x gpte = 0x%(4)08x %(3)08x ] You mistake the value, right?
Quoted 9 lines
Which value? Do you mean the
0x00020015and0x00020016?
kvm.hshowsKVM_TRC_APIC_ACCESSasKVM_TRC_HANDLER+0x14. I added thePTE_WRITEandPTE_FLOODEDafter that inkvm.hwith the values0x15and0x16. Then in the formats file it showsAPIC_ACCESSas0x00020014, and I added the new PTE entries after that as 20015 and 20016. Thekvmtrace_formattool does show those lines in its output which makes me believe these values are ok.
I mean the value of PTE_WRITE you write in the formats file ( 0x00020016 )should be same with KVM_TRC_PTE_WRITE you define in kvm.h, but now it is 0x00020015. if not what you get in the text file will be disordered.
Quoted 6 lines
What has me puzzled is the 0 values for gpa and gpte. I believe they are not 0 because I added "if (gpa || gpte) before the
KVMTRACE_4D(PTE_WRITE, ...)line and the lines still show up in the trace output.david
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
DOH. I had the 2 new ones backwards in the formats file.
thanks for pointing that out,
david
Quoted 6 lines · Eric E
I mean the value of
PTE_WRITEyou write in the formats file (0x00020016)should be same withKVM_TRC_PTE_WRITEyou define inkvm.h, but now it is0x00020015. if not what you get in the text file will be disordered.
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone