From: Marc Zyngier <maz@kernel.org>
To: Bernhard Kauer <bk@alpico.io>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH v2] KVM: make uevents configurable
Date: Mon, 02 Dec 2024 10:40:00 +0000 [thread overview]
Message-ID: <86wmgitlkv.wl-maz@kernel.org> (raw)
In-Reply-To: <20241202090628.67919-1-bk@alpico.io>
On Mon, 02 Dec 2024 09:06:28 +0000,
Bernhard Kauer <bk@alpico.io> wrote:
>
> 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
That's also to avoid killing all VMs on *any* architecture, modular or
not, just to switch a parameter.
Also, please don't include this sort of changelogs in the commit
message...
>
> Signed-off-by: Bernhard Kauer <bk@alpico.io>
> ---
... but instead place them *here*.
> 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;
static?
> +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);
<bikeshed-time>
I'd rather have a positive logic. Something like:
+static bool uevent_notify = true;
+module_param(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 || !uevent_notify)
return;
mutex_lock(&kvm_lock);
which is overall more readable.
</bikeshed-time>
I would also expect some form of documentation in
Documentation/admin-guide/kernel-parameters.txt.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
next prev parent reply other threads:[~2024-12-02 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-02 9:06 [PATCH v2] KVM: make uevents configurable Bernhard Kauer
2024-12-02 10:40 ` Marc Zyngier [this message]
2024-12-02 11:07 ` Bernhard Kauer
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=86wmgitlkv.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=bk@alpico.io \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/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