[PATCH][v2] KVM: Remove obsolete comment about locking for kvm_io_bus_read/write

lirongqing posted 1 patch 7 months, 2 weeks ago
virt/kvm/kvm_main.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH][v2] KVM: Remove obsolete comment about locking for kvm_io_bus_read/write
Posted by lirongqing 7 months, 2 weeks ago
From: Li RongQing <lirongqing@baidu.com>

Nobody is actually calling these functions with slots_lock held, The
srcu_dereference() in kvm_io_bus_read/write() precisely communicates
both what is being protected, and what provides the protection. so the
comments are no longer needed

Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v1: Remove comments, instead of fixing

 virt/kvm/kvm_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e85b33a..d9fe087 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -5774,7 +5774,6 @@ static int __kvm_io_bus_write(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,
 	return -EOPNOTSUPP;
 }
 
-/* kvm_io_bus_write - called under kvm->slots_lock */
 int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
 		     int len, const void *val)
 {
@@ -5795,7 +5794,6 @@ int kvm_io_bus_write(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
 }
 EXPORT_SYMBOL_GPL(kvm_io_bus_write);
 
-/* kvm_io_bus_write_cookie - called under kvm->slots_lock */
 int kvm_io_bus_write_cookie(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx,
 			    gpa_t addr, int len, const void *val, long cookie)
 {
@@ -5845,7 +5843,6 @@ static int __kvm_io_bus_read(struct kvm_vcpu *vcpu, struct kvm_io_bus *bus,
 	return -EOPNOTSUPP;
 }
 
-/* kvm_io_bus_read - called under kvm->slots_lock */
 int kvm_io_bus_read(struct kvm_vcpu *vcpu, enum kvm_bus bus_idx, gpa_t addr,
 		    int len, void *val)
 {
-- 
2.9.4
Re: [PATCH][v2] KVM: Remove obsolete comment about locking for kvm_io_bus_read/write
Posted by Sean Christopherson 7 months, 1 week ago
On Tue, 06 May 2025 09:22:51 +0800, lirongqing wrote:
> Nobody is actually calling these functions with slots_lock held, The
> srcu_dereference() in kvm_io_bus_read/write() precisely communicates
> both what is being protected, and what provides the protection. so the
> comments are no longer needed

Applied to kvm-x86 misc, thanks!

[1/1] KVM: Remove obsolete comment about locking for kvm_io_bus_read/write
      https://github.com/kvm-x86/linux/commit/37d8bad41d2b

--
https://github.com/kvm-x86/linux/tree/next