From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Fabiano Rosas <farosas@linux.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH kernel] KVM: PPC: Book3S: Merge powerpc's debugfs entry content into generic entry
Date: Sat, 04 Sep 2021 07:57:12 +0000 [thread overview]
Message-ID: <327b1ca9-f05e-dfc0-7d59-7b7b6bda5394@ozlabs.ru> (raw)
In-Reply-To: <87v93hens6.fsf@linux.ibm.com>
On 04/09/2021 00:28, Fabiano Rosas wrote:
> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
>
>> At the moment the generic KVM code creates an "%pid-%fd" entry per a KVM
>> instance; and the PPC HV KVM creates its own at "vm%pid".
>>
>> The rproblems with the PPC entries are:
>> 1. they do not allow multiple VMs in the same process (which is extremely
>> rare case mostly used by syzkaller fuzzer);
>> 2. prone to race bugs like the generic KVM code had fixed in
>> commit 85cd39af14f4 ("KVM: Do not leak memory for duplicate debugfs
>> directories").
>>
>> This defines kvm_arch_create_kvm_debugfs() similar to one for vcpus.
>
> I think kvm_arch_create_vm_debugfs is a bit mode accurate?
ah yes, it is better.
> ^
>> This defines 2 hooks in kvmppc_ops for allowing specific KVM
>> implementations to add necessary entries.
>>
>> This makes use of already existing kvm_arch_create_vcpu_debugfs.
>>
>> This removes no more used debugfs_dir pointers from PPC kvm_arch structs.
>>
>> Suggested-by: Fabiano Rosas <farosas@linux.ibm.com>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
>
> ...
>
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index c8f12b056968..325b388c725a 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -2771,19 +2771,14 @@ static const struct file_operations debugfs_timings_ops = {
>> };
>>
>> /* Create a debugfs directory for the vcpu */
>> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
>> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
>
> This could lose the 'arch' since it is already inside our code and
> accessed only via ops. I see that we already have a
> kvmppc_create_vcpu_debugfs that's used for some BookE processor, this
Ouch, missed kvmppc_create_vcpu_debugfs(). Good eye :)
> would make:
>
> kvmppc_create_vcpu_debugfs
> kvmppc_create_vcpu_debugfs_hv
> kvmppc_create_vcpu_debugfs_pr (possibly)
>
> which perhaps is more consistent.
Or kvm_arch_vm_ioctl_hv(). I really like having "arch" in the name,
tells right away what it is about. "kvmppc" might be excessive. Thanks,
>> {
>> - char buf[16];
>> - struct kvm *kvm = vcpu->kvm;
>> -
>> - snprintf(buf, sizeof(buf), "vcpu%u", id);
>> - vcpu->arch.debugfs_dir = debugfs_create_dir(buf, kvm->arch.debugfs_dir);
>> - debugfs_create_file("timings", 0444, vcpu->arch.debugfs_dir, vcpu,
>> + debugfs_create_file("timings", 0444, debugfs_dentry, vcpu,
>> &debugfs_timings_ops);
>> }
>>
>> #else /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
>> -static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
>> +static void kvmppc_arch_create_vcpu_debugfs_hv(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
>> {
>> }
>> #endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
--
Alexey
prev parent reply other threads:[~2021-09-04 7:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 5:22 [PATCH kernel] KVM: PPC: Book3S: Merge powerpc's debugfs entry content into generic entry Alexey Kardashevskiy
2021-09-03 14:28 ` Fabiano Rosas
2021-09-04 7:57 ` Alexey Kardashevskiy [this message]
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=327b1ca9-f05e-dfc0-7d59-7b7b6bda5394@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=farosas@linux.ibm.com \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).