All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 3/4] arm, vgic_migrate_irq: take the right vgic lock
Date: Wed, 28 Dec 2016 16:42:04 +0000	[thread overview]
Message-ID: <468ab6c5-14f2-ebd7-4674-e4c5c258de31@arm.com> (raw)
In-Reply-To: <1482372913-18366-3-git-send-email-sstabellini@kernel.org>

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

  reply	other threads:[~2016-12-28 16:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-22  2:14 [PATCH v2 0/4] xen/arm: fix rank/vgic lock inversion bug Stefano Stabellini
2016-12-22  2:15 ` [PATCH v2 1/4] xen/arm: fix GIC_INVALID_LR Stefano Stabellini
2016-12-22  2:15   ` [PATCH v2 2/4] arm: store vcpu id in struct irq_pending Stefano Stabellini
2016-12-22 11:52     ` Andrew Cooper
2016-12-22  2:15   ` [PATCH v2 3/4] arm, vgic_migrate_irq: take the right vgic lock Stefano Stabellini
2016-12-28 16:42     ` Julien Grall [this message]
2017-01-03 23:30       ` Stefano Stabellini
2017-01-16 16:31         ` Julien Grall
2016-12-22  2:15   ` [PATCH v2 4/4] The locking order is: first rank lock, then vgic lock. The order is respected everywhere, except for gic_update_one_lr Stefano Stabellini
2016-12-28 16:55     ` Julien Grall
2017-01-03 22:51       ` Stefano Stabellini
2017-01-16 16:55         ` Julien Grall
2017-01-16 19:10           ` Stefano Stabellini
2017-01-19 12:51             ` Julien Grall
2016-12-28 17:30   ` [PATCH v2 1/4] xen/arm: fix GIC_INVALID_LR Julien Grall
2017-01-03 22:52     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468ab6c5-14f2-ebd7-4674-e4c5c258de31@arm.com \
    --to=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.