All of lore.kernel.org
 help / color / mirror / Atom feed
* arch/x86/kvm/debugfs.c:27:0-23: WARNING: vcpu_guest_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
@ 2021-08-12 16:21 kernel test robot
  2021-08-12 16:21 ` [PATCH] KVM: nVMX: nSVM: fix debugfs_simple_attr.cocci warnings kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-08-12 16:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Krish Sadhukhan <krish.sadhukhan@oracle.com>
CC: Paolo Bonzini <pbonzini@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1746f4db513563bb22e0ba0c419d0c90912dfae1
commit: d5a0483f9f3250fe359224327ca1b4a29d106981 KVM: nVMX: nSVM: Add a new VCPU statistic to show if VCPU is in guest mode
date:   8 weeks ago
:::::: branch date: 10 hours ago
:::::: commit date: 8 weeks ago
config: i386-randconfig-c001-20210812 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> arch/x86/kvm/debugfs.c:27:0-23: WARNING: vcpu_guest_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
   arch/x86/kvm/debugfs.c:18:0-23: WARNING: vcpu_timer_advance_ns_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
   arch/x86/kvm/debugfs.c:36:0-23: WARNING: vcpu_tsc_offset_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
   arch/x86/kvm/debugfs.c:45:0-23: WARNING: vcpu_tsc_scaling_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
   arch/x86/kvm/debugfs.c:53:0-23: WARNING: vcpu_tsc_scaling_frac_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32005 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] KVM: nVMX: nSVM: fix debugfs_simple_attr.cocci warnings
  2021-08-12 16:21 arch/x86/kvm/debugfs.c:27:0-23: WARNING: vcpu_guest_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
@ 2021-08-12 16:21 ` kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-08-12 16:21 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 5272 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Krish Sadhukhan <krish.sadhukhan@oracle.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
CC: Sean Christopherson <seanjc@google.com>
CC: Vitaly Kuznetsov <vkuznets@redhat.com>
CC: Wanpeng Li <wanpengli@tencent.com>
CC: Jim Mattson <jmattson@google.com>
CC: Joerg Roedel <joro@8bytes.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>

From: kernel test robot <lkp@intel.com>

arch/x86/kvm/debugfs.c:27:0-23: WARNING: vcpu_guest_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/x86/kvm/debugfs.c:18:0-23: WARNING: vcpu_timer_advance_ns_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/x86/kvm/debugfs.c:36:0-23: WARNING: vcpu_tsc_offset_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/x86/kvm/debugfs.c:45:0-23: WARNING: vcpu_tsc_scaling_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/x86/kvm/debugfs.c:53:0-23: WARNING: vcpu_tsc_scaling_frac_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE

 Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
 for debugfs files.

Semantic patch information:
 Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
 imposes some significant overhead as compared to
 DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Fixes: d5a0483f9f32 ("KVM: nVMX: nSVM: Add a new VCPU statistic to show if VCPU is in guest mode")
CC: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1746f4db513563bb22e0ba0c419d0c90912dfae1
commit: d5a0483f9f3250fe359224327ca1b4a29d106981 KVM: nVMX: nSVM: Add a new VCPU statistic to show if VCPU is in guest mode
:::::: branch date: 10 hours ago
:::::: commit date: 8 weeks ago

Please take the patch only if it's a positive warning. Thanks!

 debugfs.c |   41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

--- a/arch/x86/kvm/debugfs.c
+++ b/arch/x86/kvm/debugfs.c
@@ -15,7 +15,8 @@ static int vcpu_get_timer_advance_ns(voi
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vcpu_timer_advance_ns_fops, vcpu_get_timer_advance_ns, NULL, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vcpu_timer_advance_ns_fops,
+			 vcpu_get_timer_advance_ns, NULL, "%llu\n");
 
 static int vcpu_get_guest_mode(void *data, u64 *val)
 {
@@ -24,7 +25,8 @@ static int vcpu_get_guest_mode(void *dat
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vcpu_guest_mode_fops, vcpu_get_guest_mode, NULL, "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vcpu_guest_mode_fops, vcpu_get_guest_mode, NULL,
+			 "%lld\n");
 
 static int vcpu_get_tsc_offset(void *data, u64 *val)
 {
@@ -33,7 +35,8 @@ static int vcpu_get_tsc_offset(void *dat
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_offset_fops, vcpu_get_tsc_offset, NULL, "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_offset_fops, vcpu_get_tsc_offset, NULL,
+			 "%lld\n");
 
 static int vcpu_get_tsc_scaling_ratio(void *data, u64 *val)
 {
@@ -42,7 +45,8 @@ static int vcpu_get_tsc_scaling_ratio(vo
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_scaling_fops, vcpu_get_tsc_scaling_ratio, NULL, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_scaling_fops, vcpu_get_tsc_scaling_ratio,
+			 NULL, "%llu\n");
 
 static int vcpu_get_tsc_scaling_frac_bits(void *data, u64 *val)
 {
@@ -50,26 +54,27 @@ static int vcpu_get_tsc_scaling_frac_bit
 	return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(vcpu_tsc_scaling_frac_fops, vcpu_get_tsc_scaling_frac_bits, NULL, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(vcpu_tsc_scaling_frac_fops,
+			 vcpu_get_tsc_scaling_frac_bits, NULL, "%llu\n");
 
 void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu, struct dentry *debugfs_dentry)
 {
-	debugfs_create_file("guest_mode", 0444, debugfs_dentry, vcpu,
-			    &vcpu_guest_mode_fops);
-	debugfs_create_file("tsc-offset", 0444, debugfs_dentry, vcpu,
-			    &vcpu_tsc_offset_fops);
+	debugfs_create_file_unsafe("guest_mode", 0444, debugfs_dentry, vcpu,
+				   &vcpu_guest_mode_fops);
+	debugfs_create_file_unsafe("tsc-offset", 0444, debugfs_dentry, vcpu,
+				   &vcpu_tsc_offset_fops);
 
 	if (lapic_in_kernel(vcpu))
-		debugfs_create_file("lapic_timer_advance_ns", 0444,
-				    debugfs_dentry, vcpu,
-				    &vcpu_timer_advance_ns_fops);
+		debugfs_create_file_unsafe("lapic_timer_advance_ns", 0444,
+					   debugfs_dentry, vcpu,
+					   &vcpu_timer_advance_ns_fops);
 
 	if (kvm_has_tsc_control) {
-		debugfs_create_file("tsc-scaling-ratio", 0444,
-				    debugfs_dentry, vcpu,
-				    &vcpu_tsc_scaling_fops);
-		debugfs_create_file("tsc-scaling-ratio-frac-bits", 0444,
-				    debugfs_dentry, vcpu,
-				    &vcpu_tsc_scaling_frac_fops);
+		debugfs_create_file_unsafe("tsc-scaling-ratio", 0444,
+					   debugfs_dentry, vcpu,
+					   &vcpu_tsc_scaling_fops);
+		debugfs_create_file_unsafe("tsc-scaling-ratio-frac-bits",
+					   0444, debugfs_dentry, vcpu,
+					   &vcpu_tsc_scaling_frac_fops);
 	}
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-12 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 16:21 arch/x86/kvm/debugfs.c:27:0-23: WARNING: vcpu_guest_mode_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
2021-08-12 16:21 ` [PATCH] KVM: nVMX: nSVM: fix debugfs_simple_attr.cocci warnings kernel test robot

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.