mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tangnianyao <tangnianyao@huawei.com>
To: Marc Zyngier <maz@kernel.org>, <kvmarm@lists.linux.dev>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"guoyang (C)" <guoyang2@huawei.com>,
	jiangkunkun <jiangkunkun@huawei.com>,
	wangwudi <wangwudi@hisilicon.com>
Subject: Re: [PATCH 0/3] irqchip/gic-v4: Fix VMAPP/VMOVP races
Date: Mon, 8 Jul 2024 10:02:01 +0800	[thread overview]
Message-ID: <ce1c797f-1b00-2f14-de1d-b3524acf3c1f@huawei.com> (raw)
In-Reply-To: <20240705093155.871070-1-maz@kernel.org>



On 7/5/2024 17:31, Marc Zyngier wrote:
> In 20240701072305.4129823-1-tangnianyao@huawei.com, Nianyao reports
> a number of possible races that can trigger on GICv4 implementations
> using the ITSList feature.
>
> These races involve concurrent VMOVP and VMAPP, the former happening
> on vcpu load, while the latter is triggered on the first device being
> MAPTI'd on a given ITS for this particular guest.
>
> The main issue is that we want to establish the affinity at VMAPP time,
> while vcpu_load wants to set the affinity where the vcpu actually runs.
> Lock ordering constraints mean that we can't lock the VPE on VMAPP,
> so things are modified without any lock. What could possibly go wrong?
>
> THe fix is a bit involved, and relies on 3 things:
>
> - Making sure that the initial affinity of a VPE is fixed at activate
>   time, which is done early in the life of the vcpup, before it can run.
>
> - Add a per-VM lock that can be taken instead of the global vmovp_lock,
>   paving the way for a more manageable lock order.
>
> - Take the per-VPE lock whenever modifying the VPE affinity, as expected
>   everywhere else in the code.
>
> With that, VMAPP and VMOVP can now run concurrently and still lead to
> sensible results.
>
> Marc Zyngier (3):
>   irqchip/gic-v4: Always configure affinity on VPE activation
>   irqchip/gic-v4: Substitute vmovp_lock for a per-VM lock
>   irqchip/gic-v4: Make sure a VPE is locked when VMAPP is issued
>
>  drivers/irqchip/irq-gic-v3-its.c   | 48 ++++++++++++++----------------
>  include/linux/irqchip/arm-gic-v4.h |  8 +++++
>  2 files changed, 30 insertions(+), 26 deletions(-)
>

I've tested this patch series. It works.

Tested-by: Nianyao Tang <tangnianyao@huawei.com>

  parent reply	other threads:[~2024-07-08  2:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-05  9:31 Marc Zyngier
2024-07-05  9:31 ` [PATCH 1/3] irqchip/gic-v4: Always configure affinity on VPE activation Marc Zyngier
2024-07-10 16:42   ` [tip: irq/core] " tip-bot2 for Marc Zyngier
2024-07-15 13:20   ` tip-bot2 for Marc Zyngier
2024-07-05  9:31 ` [PATCH 2/3] irqchip/gic-v4: Substitute vmovp_lock for a per-VM lock Marc Zyngier
2024-07-10 16:42   ` [tip: irq/core] " tip-bot2 for Marc Zyngier
2024-07-15 13:20   ` tip-bot2 for Marc Zyngier
2024-07-05  9:31 ` [PATCH 3/3] irqchip/gic-v4: Make sure a VPE is locked when VMAPP is issued Marc Zyngier
2024-07-10 16:42   ` [tip: irq/core] " tip-bot2 for Marc Zyngier
2024-07-15 13:20   ` tip-bot2 for Marc Zyngier
2024-07-19  9:42   ` [PATCH 3/3] " Zhou Wang
2024-07-19 11:31     ` Marc Zyngier
2024-07-23  1:51       ` Zhou Wang
2024-07-23 17:56         ` Marc Zyngier
2024-07-24  1:13           ` Zhou Wang
2024-07-08  2:02 ` Tangnianyao [this message]
2024-07-17  8:41   ` [PATCH 0/3] irqchip/gic-v4: Fix VMAPP/VMOVP races Tangnianyao
2024-07-17  9:21     ` Marc Zyngier

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=ce1c797f-1b00-2f14-de1d-b3524acf3c1f@huawei.com \
    --to=tangnianyao@huawei.com \
    --cc=guoyang2@huawei.com \
    --cc=jiangkunkun@huawei.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wangwudi@hisilicon.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®