Hi Stefano,
On 22/12/16 02:15, Stefano Stabellini wrote:
Always take the vgic lock of the old vcpu. When more than one irq
migration is requested before the first one completes, take the vgic
lock of the oldest vcpu.
Write the new vcpu id into the rank from vgic_migrate_irq, protected by
the oldest vgic vcpu lock.
Use barriers to ensure proper ordering between clearing inflight and
MIGRATING and setting vcpu to GIC_INVALID_VCPU.
The field p->status was designed to be accessed without any lock using
*_bit helpers.
Currently vgic_migrate_irq is protected by the rank lock (an ASSERT
would probably useful for documentation) and can only be called once at
the time.
Let's take the following example to describe the problem:
1) IRQ has been injected into vCPU A (e.g present in the LR)
2) IRQ is migrated to vCPU B
3) IRQ is migrated to vCPU C
4) IRQ is EOIed by the guest
When vgic_irq_migrate_irq is called for the first time (step 2), the
vCPU A vgic lock will be taken and GIC_IRQ_GUEST_MIGRATED will be set at
the end. The second time (step 3), GIC_IRQ_GUEST_MIGRATING is already
set, so the function will return directly no lock needed.
So, I think the vgic lock taken is already correct.
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel