Skip to content

Commit

Permalink
完善代码
Browse files Browse the repository at this point in the history
  • Loading branch information
nanshuaibo committed Dec 18, 2023
1 parent e76f052 commit 5bcbab6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion eBPF_Supermarket/kvm_watcher/include/kvm_vcpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ static int trace_mark_page_dirty_in_slot(struct kvm *kvm,
gfn_t gfn, void *rb, pid_t vm_pid) {
CHECK_PID(vm_pid) {
u32 flags;
struct kvm_memory_slot *slot;
bpf_probe_read_kernel(&slot, sizeof(memslot), &memslot);
bpf_probe_read_kernel(&flags, sizeof(memslot->flags), &memslot->flags);
if (flags & KVM_MEM_LOG_DIRTY_PAGES) { // 检查memslot是否启用了脏页追踪
if (slot && (flags & KVM_MEM_LOG_DIRTY_PAGES)) { // 检查memslot是否启用了脏页追踪
gfn_t gfnum = gfn;
u32 *count = bpf_map_lookup_elem(&count_dirty_map, &gfnum);
if (count) {
Expand Down

0 comments on commit 5bcbab6

Please sign in to comment.