* [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment
@ 2026-03-09 9:21 lirongqing
2026-03-09 15:36 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: lirongqing @ 2026-03-09 9:21 UTC (permalink / raw)
To: seanjc, pbonzini, kvm, linux-kernel; +Cc: Li RongQing
From: Li RongQing <lirongqing@baidu.com>
The synchronize_srcu_expedited() call in kvm_irqfd_assign() is unnecessary
when adding a new irqfd to the resampler list. The list insertion is
already RCU-safe, and existing readers will either see the old or the
updated list without inconsistency. Removing this call reduces latency
during resampling irqfd setup.
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
virt/kvm/eventfd.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 3201f60..facfeab 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -450,7 +450,6 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
}
list_add_rcu(&irqfd->resampler_link, &irqfd->resampler->list);
- synchronize_srcu_expedited(&kvm->irq_srcu);
mutex_unlock(&kvm->irqfds.resampler_lock);
}
--
2.9.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment
2026-03-09 9:21 [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment lirongqing
@ 2026-03-09 15:36 ` Sean Christopherson
2026-03-10 1:37 ` 答复: [????] " Li,Rongqing(ACG CCN)
0 siblings, 1 reply; 4+ messages in thread
From: Sean Christopherson @ 2026-03-09 15:36 UTC (permalink / raw)
To: lirongqing; +Cc: pbonzini, kvm, linux-kernel
On Mon, Mar 09, 2026, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> The synchronize_srcu_expedited() call in kvm_irqfd_assign() is unnecessary
> when adding a new irqfd to the resampler list. The list insertion is
> already RCU-safe, and existing readers will either see the old or the
> updated list without inconsistency.
It's not required for kernel safety, but I do think it's required for KVM's ABI,
e.g. to ensure the resampler is visible to readers before KVM_IRQFD returns to
userspace.
> Removing this call reduces latency during resampling irqfd setup.
May I ask why you're micro-optimizing VMs with an in-kernel I/O APIC?
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> virt/kvm/eventfd.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
> index 3201f60..facfeab 100644
> --- a/virt/kvm/eventfd.c
> +++ b/virt/kvm/eventfd.c
> @@ -450,7 +450,6 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
> }
>
> list_add_rcu(&irqfd->resampler_link, &irqfd->resampler->list);
> - synchronize_srcu_expedited(&kvm->irq_srcu);
>
> mutex_unlock(&kvm->irqfds.resampler_lock);
> }
> --
> 2.9.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* 答复: [????] Re: [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment
2026-03-09 15:36 ` Sean Christopherson
@ 2026-03-10 1:37 ` Li,Rongqing(ACG CCN)
2026-03-10 14:12 ` Sean Christopherson
0 siblings, 1 reply; 4+ messages in thread
From: Li,Rongqing(ACG CCN) @ 2026-03-10 1:37 UTC (permalink / raw)
To: Sean Christopherson
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
> On Mon, Mar 09, 2026, lirongqing wrote:
> > From: Li RongQing <lirongqing@baidu.com>
> >
> > The synchronize_srcu_expedited() call in kvm_irqfd_assign() is
> > unnecessary when adding a new irqfd to the resampler list. The list
> > insertion is already RCU-safe, and existing readers will either see
> > the old or the updated list without inconsistency.
>
> It's not required for kernel safety, but I do think it's required for KVM's ABI, e.g.
> to ensure the resampler is visible to readers before KVM_IRQFD returns to
> userspace.
>
Thanks for explanation, It would be best if a comment could be added.
> > Removing this call reduces latency during resampling irqfd setup.
>
> May I ask why you're micro-optimizing VMst with an in-kernel I/O APIC?
Few devices use it anymore; I just think the kernel ABI shouldn't require synchronize_srcu_expedited.
Thanks
[Li,Rongqing]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: 答复: [????] Re: [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment
2026-03-10 1:37 ` 答复: [????] " Li,Rongqing(ACG CCN)
@ 2026-03-10 14:12 ` Sean Christopherson
0 siblings, 0 replies; 4+ messages in thread
From: Sean Christopherson @ 2026-03-10 14:12 UTC (permalink / raw)
To: Li,Rongqing(ACG CCN)
Cc: pbonzini@redhat.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
On Tue, Mar 10, 2026, Li,Rongqing(ACG CCN) wrote:
> > > Removing this call reduces latency during resampling irqfd setup.
> >
> > May I ask why you're micro-optimizing VMst with an in-kernel I/O APIC?
>
> Few devices use it anymore; I just think the kernel ABI shouldn't require
> synchronize_srcu_expedited.
That's a *very* broad stance to take. For all intents and purposes, eliminating
SRCU synchronization in KVM means eliminating SRCU usage entirely. That's not
completely infeasible, but I don't see it happening anytime soon given how much
KVM relies on the properties of SRCU to avoid unnecessary serialization.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-10 14:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 9:21 [PATCH] KVM: eventfd: Remove redundant synchronize_srcu_expedited from irqfd assignment lirongqing
2026-03-09 15:36 ` Sean Christopherson
2026-03-10 1:37 ` 答复: [????] " Li,Rongqing(ACG CCN)
2026-03-10 14:12 ` Sean Christopherson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox