public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Fix obsolete comment about locking for kvm_io_bus_read/write
@ 2025-04-18 11:55 Li RongQing
  2025-04-28 18:09 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Li RongQing @ 2025-04-18 11:55 UTC (permalink / raw)
  To: pbonzini, kvm, linux-kernel; +Cc: Li RongQing

Nobody is actually calling these functions with slots_lock held.
The srcu read lock is required.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 virt/kvm/kvm_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e85b33a..2e591cc 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -5774,7 +5774,7 @@ 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 */
+/* kvm_io_bus_write - called under kvm->srcu read 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 +5795,7 @@ 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 */
+/* kvm_io_bus_write_cookie - called under kvm->srcu read 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 +5845,7 @@ 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 */
+/* kvm_io_bus_read - called under kvm->srcu read 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


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

* Re: [PATCH] KVM: Fix obsolete comment about locking for kvm_io_bus_read/write
  2025-04-18 11:55 [PATCH] KVM: Fix obsolete comment about locking for kvm_io_bus_read/write Li RongQing
@ 2025-04-28 18:09 ` Sean Christopherson
  2025-04-29  2:13   ` 答复: [????] " Li,Rongqing
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Christopherson @ 2025-04-28 18:09 UTC (permalink / raw)
  To: Li RongQing; +Cc: pbonzini, kvm, linux-kernel

On Fri, Apr 18, 2025, Li RongQing wrote:
> Nobody is actually calling these functions with slots_lock held.
> The srcu read lock is required.

I vote to delete the comments entirely, the srcu_dereference() precisely communicates
both what is being protected, and what provides the protection.

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

* 答复: [????] Re: [PATCH] KVM: Fix obsolete comment about locking for kvm_io_bus_read/write
  2025-04-28 18:09 ` Sean Christopherson
@ 2025-04-29  2:13   ` Li,Rongqing
  0 siblings, 0 replies; 3+ messages in thread
From: Li,Rongqing @ 2025-04-29  2:13 UTC (permalink / raw)
  To: Sean Christopherson
  Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org


> 
> On Fri, Apr 18, 2025, Li RongQing wrote:
> > Nobody is actually calling these functions with slots_lock held.
> > The srcu read lock is required.
> 
> I vote to delete the comments entirely, the srcu_dereference() precisely
> communicates both what is being protected, and what provides the protection.


Ok, I will resend this patch

Thank

-Li

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

end of thread, other threads:[~2025-04-29  2:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 11:55 [PATCH] KVM: Fix obsolete comment about locking for kvm_io_bus_read/write Li RongQing
2025-04-28 18:09 ` Sean Christopherson
2025-04-29  2:13   ` 答复: [????] " Li,Rongqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox