All of lore.kernel.org
 help / color / mirror / Atom feed
From: Longfang Liu <liulongfang@huawei.com>
To: <alex.williamson@redhat.com>, <jgg@nvidia.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<liulongfang@huawei.com>
Subject: [PATCH v3 2/3] hisi_acc_vfio_pci: clear set_reset_flag after reset completed
Date: Mon, 31 Aug 2026 17:09:50 +0800	[thread overview]
Message-ID: <20260831090951.844569-3-liulongfang@huawei.com> (raw)
In-Reply-To: <20260831090951.844569-1-liulongfang@huawei.com>

set_reset_flag is a sticky latch set in reset_prepare() when this driver
acquires the QM_RESETTING lock, but it is never cleared. If a later reset
attempt times out in reset_prepare() because another agent already holds
the lock, aer_reset_done() sees the stale true flag and calls clear_bit()
on QM_RESETTING, prematurely releasing a lock owned by the other agent.

Clear set_reset_flag right after clearing the QM_RESETTING bit in
aer_reset_done(), so every reset cycle is self-contained and a timed-out
reset cannot release a foreign lock.

Fixes: a22099ed7936f ("hisi_acc_vfio_pci: fix VF reset timeout issue")
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
---
 drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c
index e95d0ab0f11a..4abed2e49986 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");
+		}
 	}
 
 	if (!hisi_acc_vdev->core_device.vdev.mig_ops)
-- 
2.43.0


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

Thread overview: 16+ 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-09-11  8:14     ` liulongfang
2026-09-11 17:37   ` Alex Williamson
2026-09-17  6:13     ` liulongfang
2026-09-18  3:10       ` Alex Williamson
2026-09-18  8:39         ` liulongfang
2026-08-31  9:09 ` Longfang Liu [this message]
2026-08-31  9:46   ` [PATCH v3 2/3] hisi_acc_vfio_pci: clear set_reset_flag after reset completed sashiko-bot
2026-09-11  8:07     ` liulongfang
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
2026-09-11  8:02     ` liulongfang
2026-09-11 17:37   ` Alex Williamson
2026-09-17  6:13     ` liulongfang

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=20260831090951.844569-3-liulongfang@huawei.com \
    --to=liulongfang@huawei.com \
    --cc=alex.williamson@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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.