All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Bernhard Kauer <bk@alpico.io>,
	kvm@vger.kernel.org, Marc Zyngier <maz@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] KVM: x86: Make the debugfs per VM optional
Date: Wed, 6 Nov 2024 14:52:26 -0800	[thread overview]
Message-ID: <ZyvzKsKlEYvtzI1X@linux.dev> (raw)
In-Reply-To: <ZyUMlFSjNTJdQpU6@google.com>

On Fri, Nov 01, 2024 at 10:15:00AM -0700, Sean Christopherson wrote:
> On Wed, Oct 23, 2024, Bernhard Kauer wrote:
> > Creating a debugfs directory for each virtual machine is a suprisingly
> > costly operation as one has to synchronize multiple cores. However, short
> > living VMs seldom benefit from it.
> > 
> > Since there are valid use-cases we make this feature optional via a
> > module parameter. Disabling it saves 150us in the hello microbenchmark.
> > 
> > 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 a48861363649..760e39cf86a8 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -94,6 +94,9 @@ unsigned int halt_poll_ns_shrink = 2;
> >  module_param(halt_poll_ns_shrink, uint, 0644);
> >  EXPORT_SYMBOL_GPL(halt_poll_ns_shrink);
> >  
> > +bool debugfs_per_vm = true;
> > +module_param(debugfs_per_vm, bool, 0644);
> 
> I'm not opposed to letting userspace say "no debugfs for me", but I don't know
> that a module param is the right way to go.  It's obviously quite easy to
> implement and maintain (in code), but I'm mildly concerned that it'll have limited
> usefulness and/or lead to bad user experiences, e.g. because people turn off debugfs
> for startup latency without entirely realizing what they're sacrificing.

I'd be open to a Kconfig option that disables only KVM debugfs, assuming
there are people out there who want that *and* still need the rest of
debugfs facilities.

Even assuming well-intentioned userspace, a defensive user might want to
hide KVM's debugfs surfaces in case it exposed customer data.

Otherwise !CONFIG_DEBUG_FS would get the job done.

> One potentially terrible idea would be to setup debugfs asynchronously, so that
> the VM is runnable asap, but userspace still gets full debugfs information.  The
> two big wrinkles would be the vCPU debugfs creation and kvm_uevent_notify_change()
> (or at least the STATS_PATH event) would both need to be asynchronous as well.

Sounds like a pile o' bugs waiting to happen in a rather gently tested
part of the KVM, so hopefully we don't need to consider that route :)

-- 
Thanks,
Oliver

  reply	other threads:[~2024-11-06 22:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23  8:32 [PATCH] KVM: x86: Make the debugfs per VM optional Bernhard Kauer
2024-11-01 17:15 ` Sean Christopherson
2024-11-06 22:52   ` Oliver Upton [this message]
2024-11-07 15:10   ` Paolo Bonzini
2024-11-11 19:11     ` Sean Christopherson

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=ZyvzKsKlEYvtzI1X@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=bk@alpico.io \
    --cc=kvm@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.