From: Sean Christopherson <seanjc@google.com>
To: cheng.lin130@zte.com.cn
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, jiang.yong5@zte.com.cn,
wang.liang82@zte.com.cn, jiang.xuexin@zte.com.cn
Subject: Re: [PATCH] KVM: introduce vm's max_halt_poll_ns to debugfs
Date: Thu, 9 May 2024 07:59:26 -0700 [thread overview]
Message-ID: <Zjzkzu3gVUQt8gJG@google.com> (raw)
In-Reply-To: <202405091030597804KUqLDPPj2FpTIBrZZ5Eo@zte.com.cn>
On Thu, May 09, 2024, cheng.lin130@zte.com.cn wrote:
> > From: seanjc <seanjc@google.com>
> > > From: Cheng Lin <cheng.lin130@zte.com.cn>
> > >
> > > Introduce vm's max_halt_poll_ns and override_halt_poll_ns to
> > > debugfs. Provide a way to check and modify them.
> > Why?
> If a vm's max_halt_poll_ns has been set using KVM_CAP_HALT_POLL,
> the module parameter kvm.halt_poll.ns will no longer indicate the maximum
> halt pooling interval for that vm. After introducing these two attributes into
> debugfs, it can be used to check whether the individual configuration of the
> vm is enabled and the working value.
But why is max_halt_poll_ns special enough to warrant debugfs entries? There is
a _lot_ of state in KVM that is configurable per-VM, it simply isn't feasible to
dump everything into debugfs.
I do think it would be reasonable to capture the max allowed polling time in
the existing tracepoint though, e.g.
diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index 74e40d5d4af4..7e66e9b2e497 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -41,24 +41,26 @@ TRACE_EVENT(kvm_userspace_exit,
);
TRACE_EVENT(kvm_vcpu_wakeup,
- TP_PROTO(__u64 ns, bool waited, bool valid),
- TP_ARGS(ns, waited, valid),
+ TP_PROTO(__u64 ns, __u32 max_ns, bool waited, bool valid),
+ TP_ARGS(ns, max_ns, waited, valid),
TP_STRUCT__entry(
__field( __u64, ns )
+ __field( __u32, max_ns )
__field( bool, waited )
__field( bool, valid )
),
TP_fast_assign(
__entry->ns = ns;
+ __entry->max_ns = max_ns;
__entry->waited = waited;
__entry->valid = valid;
),
- TP_printk("%s time %lld ns, polling %s",
+ TP_printk("%s time %llu ns (max poll %u ns), polling %s",
__entry->waited ? "wait" : "poll",
- __entry->ns,
+ __entry->ns, __entry->max_ns,
__entry->valid ? "valid" : "invalid")
);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 2e388972d856..f093138f3cd7 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -3846,7 +3846,8 @@ void kvm_vcpu_halt(struct kvm_vcpu *vcpu)
}
}
- trace_kvm_vcpu_wakeup(halt_ns, waited, vcpu_valid_wakeup(vcpu));
+ trace_kvm_vcpu_wakeup(halt_ns, max_halt_poll_ns, waited,
+ vcpu_valid_wakeup(vcpu));
}
EXPORT_SYMBOL_GPL(kvm_vcpu_halt);
next prev parent reply other threads:[~2024-05-09 14:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 10:47 [PATCH] KVM: introduce vm's max_halt_poll_ns to debugfs cheng.lin130
2024-05-08 15:58 ` Sean Christopherson
2024-05-09 2:30 ` cheng.lin130
2024-05-09 14:59 ` Sean Christopherson [this message]
2024-05-10 3:18 ` cheng.lin130
2024-05-10 14:07 ` Sean Christopherson
2024-05-11 2:34 ` cheng.lin130
2024-05-14 22:00 ` Sean Christopherson
2024-05-15 4:03 ` cheng.lin130
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zjzkzu3gVUQt8gJG@google.com \
--to=seanjc@google.com \
--cc=cheng.lin130@zte.com.cn \
--cc=jiang.xuexin@zte.com.cn \
--cc=jiang.yong5@zte.com.cn \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=wang.liang82@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).