From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E6E718C322 for ; Mon, 25 Nov 2024 17:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732555896; cv=none; b=QTn8c860BC4/Gq57ScITpDdC+2x1IrYZ7rmkD78jmrT2QQva6N8mQWifq0uRedvbSuiU0txRC5oIeBcu61UpNWqi0WOLYJViWKBSxjSXUQwNYJ1zzpCKDogkPhO/s623PRAUSJG/yNNS2xthgoXYrE8Sm8W1frq2FLGNbx07eOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732555896; c=relaxed/simple; bh=NSPn1hzGa9OZb8JLDuKChwPi0UyS1W7DAaEpqlsDjBg=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=KijywsDmZ6pCrX4pf6VX6YvdlsjCuWtZjnKLo4YfQlxHS6phBjcpgcKG70a8kFoeEDHTYML5bZ0t8CW3+x5LTcldOW7A7AARbAacl9zUgozl+w87ZHvmxb7SuPGstWOx5hLkggjHenNRWyJQeid6WhaLJgGk9AasL3WTQvL9eJY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QJHG6ec7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QJHG6ec7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E600C4CECE; Mon, 25 Nov 2024 17:31:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732555894; bh=NSPn1hzGa9OZb8JLDuKChwPi0UyS1W7DAaEpqlsDjBg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QJHG6ec7AF9DCiXjLBYqTUfHKYH2UrcTAHst9bXw3m4M6CcTMM5L+d5x5thzq46H7 9z7e9c6rgYQZj/AcvsR1mKwEE8kGFguoh6RIMyfg24vaXs2+VDJrqGrp2JtlyCcdye yhVIxqxeAyJjQEjYUOeYTuyp+dBi/xeJZwCqAgmZnU5BZEKZiLOXxGLOhiUteMy2Ma 2BazTJlyIi+c0vKvYKObhPbzDPMN+FAXCZ3jXSbYNseBoRwk1Eurv87O2/QpOD25jg +vXSVY4LXJXiscU1MAVhwDpR7x8wQZBvgEUoMSPn5/Xk0/6KOm2EegkC0nA4+pn3ZB M9mmPUt1LkTxw== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tFcvs-00Flzb-Hk; Mon, 25 Nov 2024 17:31:32 +0000 Date: Mon, 25 Nov 2024 17:31:32 +0000 Message-ID: <86h67vusnf.wl-maz@kernel.org> From: Marc Zyngier To: Bernhard Kauer Cc: Paolo Bonzini , kvm@vger.kernel.org Subject: Re: [PATCH] KVM: make uevents configurable In-Reply-To: <20241122095806.4034415-1-bk@alpico.io> References: <20241122095806.4034415-1-bk@alpico.io> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.4 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: bk@alpico.io, pbonzini@redhat.com, kvm@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Fri, 22 Nov 2024 09:58:02 +0000, Bernhard Kauer 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 read-only module parameter here due to its simplicity and > ease of maintenance. > > Signed-off-by: Bernhard Kauer > --- > 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 609e0bd68e8e..6139cd67a96a 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, 0444); > + > /* > * Ordering of locks: > * > @@ -6276,7 +6279,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); Thanks for this. It was on my list of things to investigate, as this is a bottleneck when running a lot of concurrent syzkaller tests which create and destroy VMs repeatedly. I'm not overly keen on the command-line flag though, as this is the sort of things you'd like to be able to control more finely. Or at least without having to trigger a reboot. How about something such as a sysctl? with the kvm namespace? Thanks, M. -- Without deviation from the norm, progress is not possible.