Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Longfang Liu" <liulongfang@huawei.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH v3 2/3] hisi_acc_vfio_pci: clear set_reset_flag after reset completed
Date: Mon, 31 Aug 2026 09:46:03 +0000	[thread overview]
Message-ID: <20260831094603.CBC541F00A3E@smtp.kernel.org> (raw)
In-Reply-To: <20260831090951.844569-3-liulongfang@huawei.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Incomplete fix: `set_reset_flag` is not cleared on the error path when `qm` or `qm->io_base` is NULL.
--

commit 20e8953675b36be7d8bfc2a18cb44431bd40084a
Author: Longfang Liu <liulongfang@huawei.com>

hisi_acc_vfio_pci: clear set_reset_flag after reset completed

This patch attempts to make every reset cycle self-contained by clearing
set_reset_flag during aer_reset_done. It addresses an issue where a stale
latch could prematurely release a lock owned by another agent during a
reset timeout.

> diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> index e95d0ab0f11ab..4abed2e49986f 100644
> --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
> @@ -1180,10 +1180,12 @@ static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev)
>  	struct hisi_qm *qm = hisi_acc_vdev->pf_qm;
>  
>  	if (hisi_acc_vdev->set_reset_flag) {
> -		if (qm && qm->io_base)
> +		if (qm && qm->io_base) {
>  			clear_bit(QM_RESETTING, &qm->misc_ctl);
> -		else
> +			hisi_acc_vdev->set_reset_flag = false;
> +		} else {
>  			dev_err(&pdev->dev, "PF QM not available for reset done\n");
> +		}

[Severity: High]
Does this leave set_reset_flag persistently set if qm or qm->io_base
evaluates to false?

If agent A sets set_reset_flag to true and encounters an unavailable PF QM
during hisi_acc_vf_pci_aer_reset_done(), the flag will remain true.

Later, if agent B holds the QM_RESETTING lock and agent A attempts another
reset that times out, could agent A's aer_reset_done() see the stale true
flag and prematurely clear agent B's lock if the QM has since become
available?

Should set_reset_flag be cleared unconditionally in this function, regardless
of whether the PF QM is currently available?

>  	}
>  
>  	if (!hisi_acc_vdev->core_device.vdev.mig_ops)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260831090951.844569-1-liulongfang@huawei.com?part=2

  reply	other threads:[~2026-08-31  9:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:09 [PATCH v3 0/3] hisi_acc_vfio_pci: fix three driver issues Longfang Liu
2026-08-31  9:09 ` [PATCH v3 1/3] hisi_acc_vfio_pci: fix live migration enable conditions for PF passthrough Longfang Liu
2026-08-31  9:35   ` sashiko-bot
2026-08-31  9:09 ` [PATCH v3 2/3] hisi_acc_vfio_pci: clear set_reset_flag after reset completed Longfang Liu
2026-08-31  9:46   ` sashiko-bot [this message]
2026-08-31  9:09 ` [PATCH v3 3/3] hisi_acc_vfio_pci: reject live migration on 64KB page with QM_HW_V3 hardware Longfang Liu
2026-08-31 10:00   ` sashiko-bot

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=20260831094603.CBC541F00A3E@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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