public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] KVM: make uevents configurable
@ 2024-12-02  9:06 Bernhard Kauer
  2024-12-02 10:40 ` Marc Zyngier
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Kauer @ 2024-12-02  9:06 UTC (permalink / raw)
  To: Paolo Bonzini, Marc Zyngier; +Cc: kvm, Bernhard Kauer

Handling of uevents in userlevel is a bottleneck for tiny VMs.

Running 10_000 VMs keeps one and a half cores busy for 5.4 seconds to let
systemd-udevd handle all messages.  That is roughly 27x longer than
the 0.2 seconds needed for running the VMs without them.

We choose a module parameter here due to its simplicity and ease of
maintenance.

v1->v2:  make the parameter read-write to avoid reboots on ARM

Signed-off-by: Bernhard Kauer <bk@alpico.io>
---
 virt/kvm/kvm_main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 38620c16739b..9e714cf45617 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -97,6 +97,9 @@ EXPORT_SYMBOL_GPL(halt_poll_ns_shrink);
 bool debugfs_per_vm = true;
 module_param(debugfs_per_vm, bool, 0644);
 
+bool disable_uevent_notify;
+module_param(disable_uevent_notify, bool, 0644);
+
 /*
  * Allow direct access (from KVM or the CPU) without MMU notifier protection
  * to unpinned pages.
@@ -6141,7 +6144,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
 	struct kobj_uevent_env *env;
 	unsigned long long created, active;
 
-	if (!kvm_dev.this_device || !kvm)
+	if (!kvm_dev.this_device || !kvm || disable_uevent_notify)
 		return;
 
 	mutex_lock(&kvm_lock);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-02 11:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02  9:06 [PATCH v2] KVM: make uevents configurable Bernhard Kauer
2024-12-02 10:40 ` Marc Zyngier
2024-12-02 11:07   ` Bernhard Kauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox