From patchwork Tue Feb 25 06:27:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Longfang Liu X-Patchwork-Id: 13989360 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3820625A33A; Tue, 25 Feb 2025 06:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740464998; cv=none; b=C561REXg5uBICAS5Jtby6q3u22UFhucgVtqMXkzpVI78RZ+xyb7MmoZtvXvTd39iVnzGxXDLb0Z53Gay86BvYft8ecfS3jP97rUpFhuSjQi9r9VjH9wzk7MZNxy5N+3xGBnFkW9aXYkvCw8f6C6rORxBWCXL0xRV3sZRZxvPCu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740464998; c=relaxed/simple; bh=tJ5FBU+5TMpti3LqxM1ZB6it/0K30EwD+JVo+/Y3HBg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=edFsBqi/NE9eLPw/vyEpRP/6Q5CjVXdkiPjaWlGjXJK/cn7k79wr05GD4eAe9SUkuZe8MBJdKNxaglLa2wG1JlHQQrff8GW9w/E/wKe0cz3A8mvPOWi62XRi4eXc7FmWMmR6BIxpWPBjpB0WThQPt71zf62dVnb96d5v2qbZz5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Z270g59JGzCs9V; Tue, 25 Feb 2025 14:26:27 +0800 (CST) Received: from kwepemg500006.china.huawei.com (unknown [7.202.181.43]) by mail.maildlp.com (Postfix) with ESMTPS id D4CED18032E; Tue, 25 Feb 2025 14:29:53 +0800 (CST) Received: from huawei.com (10.50.165.33) by kwepemg500006.china.huawei.com (7.202.181.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Feb 2025 14:29:53 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH v4 4/5] hisi_acc_vfio_pci: bugfix the problem of uninstalling driver Date: Tue, 25 Feb 2025 14:27:56 +0800 Message-ID: <20250225062757.19692-5-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20250225062757.19692-1-liulongfang@huawei.com> References: <20250225062757.19692-1-liulongfang@huawei.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemg500006.china.huawei.com (7.202.181.43) In a live migration scenario. If the number of VFs at the destination is greater than the source, the recovery operation will fail and qemu will not be able to complete the process and exit after shutting down the device FD. This will cause the driver to be unable to be unloaded normally due to abnormal reference counting of the live migration driver caused by the abnormal closing operation of fd. Fixes: b0eed085903e ("hisi_acc_vfio_pci: Add support for VFIO live migration") Signed-off-by: Longfang Liu Reviewed-by: Shameer Kolothum --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index 54c59c92df13..3f0bcd855839 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1507,6 +1507,7 @@ static void hisi_acc_vfio_pci_close_device(struct vfio_device *core_vdev) struct hisi_acc_vf_core_device *hisi_acc_vdev = hisi_acc_get_vf_dev(core_vdev); struct hisi_qm *vf_qm = &hisi_acc_vdev->vf_qm; + hisi_acc_vf_disable_fds(hisi_acc_vdev); mutex_lock(&hisi_acc_vdev->open_mutex); hisi_acc_vdev->dev_opened = false; iounmap(vf_qm->io_base);