Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
4cee5764
Commit
4cee5764
authored
Nov 18, 2007
by
Avi Kivity
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
KVM: MMU: Add some mmu statistics
Signed-off-by:
Avi Kivity
<
avi@qumranet.com
>
parent
ba1389b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
drivers/kvm/kvm.h
drivers/kvm/kvm.h
+6
-0
drivers/kvm/mmu.c
drivers/kvm/mmu.c
+8
-1
drivers/kvm/x86.c
drivers/kvm/x86.c
+6
-0
No files found.
drivers/kvm/kvm.h
View file @
4cee5764
...
@@ -362,6 +362,12 @@ struct kvm_memory_slot {
...
@@ -362,6 +362,12 @@ struct kvm_memory_slot {
};
};
struct
kvm_vm_stat
{
struct
kvm_vm_stat
{
u32
mmu_shadow_zapped
;
u32
mmu_pte_write
;
u32
mmu_pte_updated
;
u32
mmu_pde_zapped
;
u32
mmu_flooded
;
u32
mmu_recycled
;
};
};
struct
kvm
{
struct
kvm
{
...
...
drivers/kvm/mmu.c
View file @
4cee5764
...
@@ -755,6 +755,7 @@ static void kvm_mmu_zap_page(struct kvm *kvm,
...
@@ -755,6 +755,7 @@ static void kvm_mmu_zap_page(struct kvm *kvm,
{
{
u64
*
parent_pte
;
u64
*
parent_pte
;
++
kvm
->
stat
.
mmu_shadow_zapped
;
while
(
page
->
multimapped
||
page
->
parent_pte
)
{
while
(
page
->
multimapped
||
page
->
parent_pte
)
{
if
(
!
page
->
multimapped
)
if
(
!
page
->
multimapped
)
parent_pte
=
page
->
parent_pte
;
parent_pte
=
page
->
parent_pte
;
...
@@ -1226,9 +1227,12 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,
...
@@ -1226,9 +1227,12 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,
const
void
*
new
,
int
bytes
,
const
void
*
new
,
int
bytes
,
int
offset_in_pte
)
int
offset_in_pte
)
{
{
if
(
page
->
role
.
level
!=
PT_PAGE_TABLE_LEVEL
)
if
(
page
->
role
.
level
!=
PT_PAGE_TABLE_LEVEL
)
{
++
vcpu
->
kvm
->
stat
.
mmu_pde_zapped
;
return
;
return
;
}
++
vcpu
->
kvm
->
stat
.
mmu_pte_updated
;
if
(
page
->
role
.
glevels
==
PT32_ROOT_LEVEL
)
if
(
page
->
role
.
glevels
==
PT32_ROOT_LEVEL
)
paging32_update_pte
(
vcpu
,
page
,
spte
,
new
,
bytes
,
paging32_update_pte
(
vcpu
,
page
,
spte
,
new
,
bytes
,
offset_in_pte
);
offset_in_pte
);
...
@@ -1263,6 +1267,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
...
@@ -1263,6 +1267,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
int
npte
;
int
npte
;
pgprintk
(
"%s: gpa %llx bytes %d
\n
"
,
__FUNCTION__
,
gpa
,
bytes
);
pgprintk
(
"%s: gpa %llx bytes %d
\n
"
,
__FUNCTION__
,
gpa
,
bytes
);
++
vcpu
->
kvm
->
stat
.
mmu_pte_write
;
kvm_mmu_audit
(
vcpu
,
"pre pte write"
);
kvm_mmu_audit
(
vcpu
,
"pre pte write"
);
if
(
gfn
==
vcpu
->
last_pt_write_gfn
if
(
gfn
==
vcpu
->
last_pt_write_gfn
&&
!
last_updated_pte_accessed
(
vcpu
))
{
&&
!
last_updated_pte_accessed
(
vcpu
))
{
...
@@ -1296,6 +1301,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
...
@@ -1296,6 +1301,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
pgprintk
(
"misaligned: gpa %llx bytes %d role %x
\n
"
,
pgprintk
(
"misaligned: gpa %llx bytes %d role %x
\n
"
,
gpa
,
bytes
,
page
->
role
.
word
);
gpa
,
bytes
,
page
->
role
.
word
);
kvm_mmu_zap_page
(
vcpu
->
kvm
,
page
);
kvm_mmu_zap_page
(
vcpu
->
kvm
,
page
);
++
vcpu
->
kvm
->
stat
.
mmu_flooded
;
continue
;
continue
;
}
}
page_offset
=
offset
;
page_offset
=
offset
;
...
@@ -1344,6 +1350,7 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
...
@@ -1344,6 +1350,7 @@ void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
page
=
container_of
(
vcpu
->
kvm
->
active_mmu_pages
.
prev
,
page
=
container_of
(
vcpu
->
kvm
->
active_mmu_pages
.
prev
,
struct
kvm_mmu_page
,
link
);
struct
kvm_mmu_page
,
link
);
kvm_mmu_zap_page
(
vcpu
->
kvm
,
page
);
kvm_mmu_zap_page
(
vcpu
->
kvm
,
page
);
++
vcpu
->
kvm
->
stat
.
mmu_recycled
;
}
}
}
}
...
...
drivers/kvm/x86.c
View file @
4cee5764
...
@@ -66,6 +66,12 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
...
@@ -66,6 +66,12 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
{
"fpu_reload"
,
VCPU_STAT
(
fpu_reload
)
},
{
"fpu_reload"
,
VCPU_STAT
(
fpu_reload
)
},
{
"insn_emulation"
,
VCPU_STAT
(
insn_emulation
)
},
{
"insn_emulation"
,
VCPU_STAT
(
insn_emulation
)
},
{
"insn_emulation_fail"
,
VCPU_STAT
(
insn_emulation_fail
)
},
{
"insn_emulation_fail"
,
VCPU_STAT
(
insn_emulation_fail
)
},
{
"mmu_shadow_zapped"
,
VM_STAT
(
mmu_shadow_zapped
)
},
{
"mmu_pte_write"
,
VM_STAT
(
mmu_pte_write
)
},
{
"mmu_pte_updated"
,
VM_STAT
(
mmu_pte_updated
)
},
{
"mmu_pde_zapped"
,
VM_STAT
(
mmu_pde_zapped
)
},
{
"mmu_flooded"
,
VM_STAT
(
mmu_flooded
)
},
{
"mmu_recycled"
,
VM_STAT
(
mmu_recycled
)
},
{
NULL
}
{
NULL
}
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment