LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Peter Xu <peterx@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v3 1/7] KVM: Allow to have arch-specific per-vm debugfs files
Date: Tue, 3 Aug 2021 13:15:19 +0200	[thread overview]
Message-ID: <YQklR580FbVSiVz6@kroah.com> (raw)
In-Reply-To: <20210730220455.26054-2-peterx@redhat.com>

On Fri, Jul 30, 2021 at 06:04:49PM -0400, Peter Xu wrote:
> Allow archs to create arch-specific nodes under kvm->debugfs_dentry directory
> besides the stats fields.  The new interface kvm_arch_create_vm_debugfs() is
> defined but not yet used.  It's called after kvm->debugfs_dentry is created, so
> it can be referenced directly in kvm_arch_create_vm_debugfs().  Arch should
> define their own versions when they want to create extra debugfs nodes.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  include/linux/kvm_host.h |  1 +
>  virt/kvm/kvm_main.c      | 20 +++++++++++++++++++-
>  2 files changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> index 9d6b4ad407b8..a3ec3271c4c8 100644
> --- a/include/linux/kvm_host.h
> +++ b/include/linux/kvm_host.h
> @@ -1067,6 +1067,7 @@ bool kvm_arch_dy_runnable(struct kvm_vcpu *vcpu);
>  bool kvm_arch_dy_has_pending_interrupt(struct kvm_vcpu *vcpu);
>  int kvm_arch_post_init_vm(struct kvm *kvm);
>  void kvm_arch_pre_destroy_vm(struct kvm *kvm);
> +int kvm_arch_create_vm_debugfs(struct kvm *kvm);
>  
>  #ifndef __KVM_HAVE_ARCH_VM_ALLOC
>  /*
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index a96cbe24c688..327f8fae80a5 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -915,7 +915,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
>  	char dir_name[ITOA_MAX_LEN * 2];
>  	struct kvm_stat_data *stat_data;
>  	const struct _kvm_stats_desc *pdesc;
> -	int i;
> +	int i, ret;
>  	int kvm_debugfs_num_entries = kvm_vm_stats_header.num_desc +
>  				      kvm_vcpu_stats_header.num_desc;
>  
> @@ -960,6 +960,13 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
>  				    kvm->debugfs_dentry, stat_data,
>  				    &stat_fops_per_vm);
>  	}
> +
> +	ret = kvm_arch_create_vm_debugfs(kvm);
> +	if (ret) {
> +		kvm_destroy_vm_debugfs(kvm);
> +		return i;
> +	}
> +
>  	return 0;
>  }
>  
> @@ -980,6 +987,17 @@ void __weak kvm_arch_pre_destroy_vm(struct kvm *kvm)
>  {
>  }
>  
> +/*
> + * Called after per-vm debugfs created.  When called kvm->debugfs_dentry should
> + * be setup already, so we can create arch-specific debugfs entries under it.
> + * Cleanup should be automatic done in kvm_destroy_vm_debugfs() recursively, so
> + * a per-arch destroy interface is not needed.
> + */
> +int __weak kvm_arch_create_vm_debugfs(struct kvm *kvm)

This should be a void function, nothing should matter if creating
debugfs files succeeds or not.

As proof, your one implementation always returned 0 :)

thanks,

greg k-h

  reply	other threads:[~2021-08-03 11:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 22:04 [PATCH v3 0/7] KVM: X86: Some light optimizations on rmap logic Peter Xu
2021-07-30 22:04 ` [PATCH v3 1/7] KVM: Allow to have arch-specific per-vm debugfs files Peter Xu
2021-08-03 11:15   ` Greg KH [this message]
2021-08-03 19:25     ` Peter Xu
2021-07-30 22:04 ` [PATCH v3 2/7] KVM: X86: Introduce pte_list_count() helper Peter Xu
2021-07-30 22:04 ` [PATCH v3 3/7] KVM: X86: Introduce kvm_mmu_slot_lpages() helpers Peter Xu
2021-07-30 22:04 ` [PATCH v3 4/7] KVM: X86: Introduce mmu_rmaps_stat per-vm debugfs file Peter Xu
2021-08-02 15:25   ` Paolo Bonzini
2021-08-03 19:14     ` Peter Xu
2021-08-05 18:19     ` Sean Christopherson
2021-07-30 22:04 ` [PATCH v3 5/7] KVM: X86: MMU: Tune PTE_LIST_EXT to be bigger Peter Xu
2021-07-30 22:06 ` [PATCH v3 6/7] KVM: X86: Optimize pte_list_desc with per-array counter Peter Xu
2021-07-30 22:06 ` [PATCH v3 7/7] KVM: X86: Optimize zapping rmap Peter Xu

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=YQklR580FbVSiVz6@kroah.com \
    --to=greg@kroah.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --subject='Re: [PATCH v3 1/7] KVM: Allow to have arch-specific per-vm debugfs files' \
    /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

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 NNTP newsgroup(s).