From patchwork Fri Dec 6 09:33:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: liulongfang X-Patchwork-Id: 13896735 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 9BF401DF74F; Fri, 6 Dec 2024 09:36:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733477774; cv=none; b=cseSverBUwlG6+w2NsxbfGW6IdpdMokBjqD4fphF08BykmXre3vDMQTAzuIl0m1KiKqqmml2QqgopcLjrHVMwnxwp4rMY1/toPs5fQLv3CLBaPU7nmZ/qNnP7kKh8cnIQ9s79Ip663aeU9P1r0N4MjRTJhPCVUMOGuJLik4JOJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733477774; c=relaxed/simple; bh=WPf162rmBKG8k2G+p3Wh1o7qaZYe2Sa+dkSJprlxk4I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OVBfMtqWdIJzIZzHiUuvJUe6HW7aWVXEGopO8gO2J1ANQPG3pn+6JnOs0oF9wB9yiYJysicdj2MMFt9GZUnJe7AuyC9hwjK95hTYPr6nKXo6qtMJNOqf/PV9/1P46/ytSZtloLA/xW+miYL+raoKLWr16q0vAghzYXusyF4vsk8= 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.191 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.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Y4R0G6nSXz1kvVM; Fri, 6 Dec 2024 17:33:50 +0800 (CST) Received: from dggemv703-chm.china.huawei.com (unknown [10.3.19.46]) by mail.maildlp.com (Postfix) with ESMTPS id 201B31401DC; Fri, 6 Dec 2024 17:36:10 +0800 (CST) Received: from kwepemn100017.china.huawei.com (7.202.194.122) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Fri, 6 Dec 2024 17:36:09 +0800 Received: from huawei.com (10.50.165.33) by kwepemn100017.china.huawei.com (7.202.194.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 6 Dec 2024 17:36:09 +0800 From: Longfang Liu To: , , , CC: , , , Subject: [PATCH 4/5] hisi_acc_vfio_pci: bugfix the problem of uninstalling driver Date: Fri, 6 Dec 2024 17:33:11 +0800 Message-ID: <20241206093312.57588-5-liulongfang@huawei.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20241206093312.57588-1-liulongfang@huawei.com> References: <20241206093312.57588-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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemn100017.china.huawei.com (7.202.194.122) 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. Signed-off-by: Longfang Liu --- 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 c057c0e24693..8d9e07ebf4fd 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1501,6 +1501,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);