Re: [PATCH v1 2/4] KVM: arm/arm64: vgic: Improve comment on kvm_vgic_inject_irq

From: Leo Yan
Date: Sun Feb 24 2019 - 19:19:16 EST


On Fri, Feb 22, 2019 at 03:40:50PM +0000, Marc Zyngier wrote:

[...]

> > > The interrupt affinity is either defined by the distributor
> > > configuration (SPIs) or the ITS configuration (LPIs).
> >
> > Given to the up example, I am struggling to understand how you can set
> > the interrupt affinity for virtio device.
> >
> > Do you set the physical interrupt affinity to CPU0/1 in host OS and
> > forward it to guest OS? Or set interrupt affinity in guest OS (I
> > tried on Juno board to set irq affinity in guest OS from
> > '/proc/irq/xxx/smp_affinity' but failed)? Or this is accomplished by
> > user space tool (lkvm or qemu)?
>
> virtio interrupts are purely virtual, and the host plays no part in
> their routing (nor does userspace). As for their affinity, that
> depends on the virtio driver. Some virtio devices allow their affinity
> to be changed, some don't. Here, this is a virtio-net device, which is
> perfectly happy to see its queue interrupts moved to a different vcpu.
>
> I tend to run irqbalance in my guests so that it actually exercises
> the affinity setting in the background.
>
> > Sorry if I am asking a stupid question :)
>
> It's not stupid. You're simply confusing multiple independent layers.

Thanks a lot for explaination, Marc.

Thanks,
Leo Yan