Message ID | 20220415201542.1496582-3-oupton@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: Clean up debugfs+stats init/destroy | expand |
On Fri, Apr 15, 2022, Oliver Upton wrote: > Again, the stats_id is only ever used by the stats code; put it where it > belongs with the rest of the stats initialization. Heh, again, no? Ah, but here you've conflated debugfs and stats in the changelog. They are two different things. And most critically, stats is not dependent on debugfs.
On Mon, May 16, 2022 at 2:01 PM Sean Christopherson <seanjc@google.com> wrote: > > On Fri, Apr 15, 2022, Oliver Upton wrote: > > Again, the stats_id is only ever used by the stats code; put it where it > > belongs with the rest of the stats initialization. > > Heh, again, no? Ah, but here you've conflated debugfs and stats in the changelog. > They are two different things. And most critically, stats is not dependent on debugfs. Agreed. Patch 1 and 2 arise from being bitter that struct kvm and struct kvm_vcpu fields are initialized out of line with other fields. I'll yank these into kvm_create_vm() and kvm_vcpu_init(), respectively. -- Thanks, Oliver
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ec9c6aad041b..aaf8de62b897 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3711,6 +3711,10 @@ static void kvm_create_vcpu_debugfs(struct kvm_vcpu *vcpu) struct dentry *debugfs_dentry; char dir_name[ITOA_MAX_LEN * 2]; + /* Fill the stats id string for the vcpu */ + snprintf(vcpu->stats_id, sizeof(vcpu->stats_id), "kvm-%d/vcpu-%d", + task_pid_nr(current), vcpu->vcpu_id); + if (!debugfs_initialized()) return; @@ -3786,10 +3790,6 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id) if (r) goto unlock_vcpu_destroy; - /* Fill the stats id string for the vcpu */ - snprintf(vcpu->stats_id, sizeof(vcpu->stats_id), "kvm-%d/vcpu-%d", - task_pid_nr(current), id); - /* Now it's all set up, let userspace reach it */ kvm_get_kvm(kvm); r = create_vcpu_fd(vcpu);
Again, the stats_id is only ever used by the stats code; put it where it belongs with the rest of the stats initialization. No functional change intended. Signed-off-by: Oliver Upton <oupton@google.com> --- virt/kvm/kvm_main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)