Re: [PATCH] KVM: irqchip: synchronize srcu only if needed

From: Yi Wang
Date: Tue Jan 16 2024 - 19:47:17 EST


On Wed, Jan 17, 2024 at 12:50 AM Christian Borntraeger
<borntraeger@xxxxxxxxxxxxx> wrote:
>
>
>
> Am 15.01.24 um 17:01 schrieb Yi Wang:
> > Many thanks for your such kind and detailed reply, Sean!
> >

...

> >>
> >> So instead of special casing x86, what if we instead have KVM setup an empty
> >> IRQ routing table during kvm_create_vm(), and then avoid this mess entirely?
> >> That way x86 and s390 no longer need to set empty/dummy routing when creating
> >> an IRQCHIP, and the worst case scenario of userspace misusing an ioctl() is no
> >> longer a NULL pointer deref.
>
> Sounds like a good idea. This should also speedup guest creation on s390 since
> it would avoid one syncronize_irq.
> >
> > To setup an empty IRQ routing table during kvm_create_vm() sounds a good idea,
> > at this time vCPU have not been created and kvm->lock is held so skipping
> > synchronization is safe here.
> >
> > However, there is one drawback, if vmm wants to emulate irqchip
> > itself, e.g. qemu
> > with command line '-machine kernel-irqchip=off' may not need irqchip
> > in kernel. How
> > do we handle this issue?
>
> I would be fine with wasted memory. The only question is does it have a functional
> impact or can we simply ignore the dummy routing.
>

Thanks for your reply, I will update the patch.


--
---
Best wishes
Yi Wang