From patchwork Wed Nov 22 19:36:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 13465424 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="If7gDa2o" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18B6F18E; Wed, 22 Nov 2023 11:37:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YHtzz/2BB3ZawQkVQbrpqRyNK+AhpaPPj9IITuWEIoT71YwPRUNIBKozpmPumBmyXfGeqCMSiq6aE1tOyeH5WSPbmJS3R8R6NbkcLHNo1RwN6jN6/iHesjPUFf1Wn5y6cbrUjOT15bz3wxuX3MO49+WBVQTj3bdIGXCyQe3AzG/F+eAlbpYDF7ZGunJelv0hVTFWxpNaBMTP5TVQqTnyCGZXVkGMK1vT4KAC7DZcoaB8hbwbOhNI3NgPPRtjT6EVjuEOV/pF0dhablpgEVHDuUKXcp/ruHX1HUMfvMQecMH2yZ0ehXacxCdq1KM0S+z9O+lSOiEz1l2qqtwauUmXAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VtrPayVZQXBw67d+4Vj1Zu1D6nFAfbDFFmIDnkhafRo=; b=HY9wSgYnws9agRLFPzrNH38o5SqCx3/0lATXNlwPVkbMj7thGcwKyUILmu78d0t/64dQEa85o5vL6XSDlNV5Y7uBeoWnACK3dXkLP1eeRiOvgQuFMzRY3Nm4I/cQ9nIbcj4NR07qcCVb4iBahGzOBDYxhozxWeNYvAFexCLc1/epsjQ6rwbGFxY7VhpZluxCYRc/MZehar2C7MhU87jCVSLG+qp+Ojdly4rkGJVaDH6ClyW4JKdVkdC3dOdDR/zsRjKpgS9eCalWr+5lYZZABHwP4Q7rXxIVDHPDyczW4y+b2zOR6atuADUFm7bcVcTaDZK+KAlKktXNyP0cTia6Vg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VtrPayVZQXBw67d+4Vj1Zu1D6nFAfbDFFmIDnkhafRo=; b=If7gDa2o4PEl13g0XdAJN7eUKDnCOgJBfxMai2dd4sCSYJKA+Tu6kQOpIJPTvhsfyy4LqMl6V265lTnA7DkQ/geHOAoFsmwkmEWMoIen8UaSpq4D+mh34xzbwshT2LGpqYdNkU3rfQbZovIrj8HuOtL3HGQzKBzusJE4bsUEQi8= Received: from BY5PR16CA0021.namprd16.prod.outlook.com (2603:10b6:a03:1a0::34) by MW4PR12MB7437.namprd12.prod.outlook.com (2603:10b6:303:21a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.19; Wed, 22 Nov 2023 19:37:02 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:a03:1a0:cafe::22) by BY5PR16CA0021.outlook.office365.com (2603:10b6:a03:1a0::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.28 via Frontend Transport; Wed, 22 Nov 2023 19:37:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Wed, 22 Nov 2023 19:37:02 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 22 Nov 2023 13:36:57 -0600 From: Brett Creeley To: , , , , , , , CC: , Subject: [PATCH vfio 1/2] hisi_acc_vfio_pci: Change reset_lock to mutex_lock Date: Wed, 22 Nov 2023 11:36:33 -0800 Message-ID: <20231122193634.27250-2-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231122193634.27250-1-brett.creeley@amd.com> References: <20231122193634.27250-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|MW4PR12MB7437:EE_ X-MS-Office365-Filtering-Correlation-Id: f1ebfa90-00a1-4f7d-35cc-08dbeb926698 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v/qUPyZzXd7QLHLZA1OMo00o3amjtuOYkQzaHq27h/asdzplHRnKTnp1OAvhQT+0aYRN3AKR9LOTnYiwSKjMzXE8ryZiF9bUNozRt9NvONS3lLEV3mHh7JZ6otLFx7aI+CO4MWsK4cr9qXKJUqz7erdrUlR5PRFI5SOy8QOnQeq6WgmdtsOsoPa0oLbKwARfywvcnC8aMcNiAieVTlMiZJ62SW2kDYRVnOa4Qnzb99dCgIBDn/GNzItqhnFXVJl/nuPr6SHoEQ2za2qovHqSCAWWARHS87ccW+NU9Mp0nm3jck/mbmzO2QY/URMtNZYZaktBiE9E7apU4A7ut9Xak9p4nRjOMh4p7F8btsvkxFgSRG1DLTknBHd+b8MF7vyuab/oWzoNB68XfJL9bIK29027Qfo97SgI2LUaxyv3R4LAklfUlBR8TdSBLIAxhM5LoINf+59i6J8U9wKGe4fF/SXV1+n3Aj6I6NSJZNLjjmGknfVBEUVTlaBLeJ7Ec6XDEvFZ+FFDVnJty8w95g3a8dElekd6WSbBkmC/DU9BjVuroA0WjJSyOLQeRSJWs5dAFCSZy1GoxCrGoL1DmVBDJKEAuOQnB4AM67YB/8gbwD565PYA2EhCiiIgtcad/WYyu0wIKd4MEaGCUxL8zheTCGMeEnoAGvMo8V3HFyXbZGMddJ0LIh+QIo9geWbp25VkcRjSIZ4KUq2GF69mO/z3O9OPNyb99x0+jytNwizA9aLv2Eexv2sor5ky6EYJWBHxBDcRkM+uQCf5Bx+zWg+Ztw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(1800799012)(186009)(82310400011)(64100799003)(451199024)(36840700001)(40470700004)(46966006)(41300700001)(2906002)(5660300002)(44832011)(8936002)(316002)(54906003)(4326008)(110136005)(70586007)(70206006)(966005)(478600001)(45080400002)(8676002)(6666004)(40480700001)(426003)(36860700001)(16526019)(336012)(26005)(1076003)(2616005)(40460700003)(83380400001)(47076005)(81166007)(36756003)(86362001)(356005)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 19:37:02.0342 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1ebfa90-00a1-4f7d-35cc-08dbeb926698 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7437 Based on comments from other vfio vendors and the maintainer the vfio/pds driver changed the reset_lock to a mutex_lock. As part of that change it was requested that the other vendor drivers be changed as well. So, make the change. The comment that requested the change for reference: https://lore.kernel.org/kvm/BN9PR11MB52769E037CB356AB15A0D9B88CA0A@BN9PR11MB5276.namprd11.prod.outlook.com/ Also, make checkpatch happy by moving the lock comment. Signed-off-by: Brett Creeley Reviewed-by: Shameer Kolothum --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 13 +++++++------ drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index b2f9778c8366..2c049b8de4b4 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -638,17 +638,17 @@ static void hisi_acc_vf_state_mutex_unlock(struct hisi_acc_vf_core_device *hisi_acc_vdev) { again: - spin_lock(&hisi_acc_vdev->reset_lock); + mutex_lock(&hisi_acc_vdev->reset_mutex); if (hisi_acc_vdev->deferred_reset) { hisi_acc_vdev->deferred_reset = false; - spin_unlock(&hisi_acc_vdev->reset_lock); + mutex_unlock(&hisi_acc_vdev->reset_mutex); hisi_acc_vdev->vf_qm_state = QM_NOT_READY; hisi_acc_vdev->mig_state = VFIO_DEVICE_STATE_RUNNING; hisi_acc_vf_disable_fds(hisi_acc_vdev); goto again; } mutex_unlock(&hisi_acc_vdev->state_mutex); - spin_unlock(&hisi_acc_vdev->reset_lock); + mutex_unlock(&hisi_acc_vdev->reset_mutex); } static void hisi_acc_vf_start_device(struct hisi_acc_vf_core_device *hisi_acc_vdev) @@ -1108,13 +1108,13 @@ static void hisi_acc_vf_pci_aer_reset_done(struct pci_dev *pdev) * In case the state_mutex was taken already we defer the cleanup work * to the unlock flow of the other running context. */ - spin_lock(&hisi_acc_vdev->reset_lock); + mutex_lock(&hisi_acc_vdev->reset_mutex); hisi_acc_vdev->deferred_reset = true; if (!mutex_trylock(&hisi_acc_vdev->state_mutex)) { - spin_unlock(&hisi_acc_vdev->reset_lock); + mutex_unlock(&hisi_acc_vdev->reset_mutex); return; } - spin_unlock(&hisi_acc_vdev->reset_lock); + mutex_unlock(&hisi_acc_vdev->reset_mutex); hisi_acc_vf_state_mutex_unlock(hisi_acc_vdev); } @@ -1350,6 +1350,7 @@ static int hisi_acc_vfio_pci_migrn_init_dev(struct vfio_device *core_vdev) hisi_acc_vdev->pf_qm = pf_qm; hisi_acc_vdev->vf_dev = pdev; mutex_init(&hisi_acc_vdev->state_mutex); + mutex_init(&hisi_acc_vdev->reset_mutex); core_vdev->migration_flags = VFIO_MIGRATION_STOP_COPY | VFIO_MIGRATION_PRE_COPY; core_vdev->mig_ops = &hisi_acc_vfio_pci_migrn_state_ops; diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h index dcabfeec6ca1..ed5ab332d0f3 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.h @@ -109,8 +109,7 @@ struct hisi_acc_vf_core_device { struct hisi_qm vf_qm; u32 vf_qm_state; int vf_id; - /* For reset handler */ - spinlock_t reset_lock; + struct mutex reset_mutex; /* For reset handler */ struct hisi_acc_vf_migration_file *resuming_migf; struct hisi_acc_vf_migration_file *saving_migf; }; From patchwork Wed Nov 22 19:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 13465425 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1wy3sRJR" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2065.outbound.protection.outlook.com [40.107.212.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44571D72; Wed, 22 Nov 2023 11:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeM37m/z5zgFGfGDmAqpyokYZENfJcHCVbwRN/D+fWwD57qFVNHY9lkyTIEAFIfRHUwweJkBDHsN1lO69ieBjpwge0mvASz5OgKG7RTvj8j7o1oDh0NJhjXgs39oMfGYeI2GG0JNLAwMe/Ue5oMiL2NE0WzB+F6BxKw8TaVNSC8JqbdwSuWv6Dvz5vKJRzXRzmBRa8vnVljijxY1vsFXCFiGbUqQgTwPy7997VbfcnPqHxZ3e30OK5HBnTLYDW8lxrpPTXFcDX5KeqFAEY/apG7VHMo4WD1q45Xznnsm5fhhkIpv4aKG8eKSI8+BOSfTNTkbERyvciRzgSgBt/0gpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=INO2GNW01En2yUeBMP6tNMjlCNPfa/LvvS0Zyo3Sg8k=; b=OPyl97fZY0Mh03Z2nYis7R+Eq+fg3nihznq6BAYzW58ctkNp32S85h9HxHmLRDFsRkYV/3I9baLieb81tBc3LRQPH9IVAPVz3aG6lhtiEbYE1eHN642GUATylPLtCMo0gxSVMT+GkdKAmT8lqcMrAPSnIyU28RATONgmD+CD2wPdGeGym4ipqOb+9m6794kvy1pbrxJMSSAKmPxKLzL6FjFAGhVQCkVMVMXHoD24TpMi+ThLkWZAPayrioOSr4LLFKcRYLWV2dGdsRUfOaogrK4Byewr+yLtdC7anLz4oG0KCSRnrZ8WJjrtEKlTLYW0bQOgctpCp1n2aE926kHARQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=ziepe.ca smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=INO2GNW01En2yUeBMP6tNMjlCNPfa/LvvS0Zyo3Sg8k=; b=1wy3sRJRRSxOjKy8U8+ZHgLoX9+VpdKxnTnv2KQg6vIwVo6aJXEcjl02R7Kzx/1DHH0plmQosxtSLHKKj1TmAz2v0/W03ztbcmGR8m0x2N8c3hjBV6kXilcUkEHdSbQa8Ef2be9n4SKRUGqt+IoPLRytb/R25/3dgEzxplTaTC8= Received: from BY5PR16CA0017.namprd16.prod.outlook.com (2603:10b6:a03:1a0::30) by PH0PR12MB5646.namprd12.prod.outlook.com (2603:10b6:510:143::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18; Wed, 22 Nov 2023 19:37:03 +0000 Received: from MWH0EPF000989EC.namprd02.prod.outlook.com (2603:10b6:a03:1a0:cafe::44) by BY5PR16CA0017.outlook.office365.com (2603:10b6:a03:1a0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.18 via Frontend Transport; Wed, 22 Nov 2023 19:37:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by MWH0EPF000989EC.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7025.12 via Frontend Transport; Wed, 22 Nov 2023 19:37:02 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 22 Nov 2023 13:36:59 -0600 From: Brett Creeley To: , , , , , , , CC: , Subject: [PATCH vfio 2/2] hisi_acc_vfio_pci: Destroy the [state|reset]_mutex on release Date: Wed, 22 Nov 2023 11:36:34 -0800 Message-ID: <20231122193634.27250-3-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231122193634.27250-1-brett.creeley@amd.com> References: <20231122193634.27250-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989EC:EE_|PH0PR12MB5646:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a09736e-e3fb-42d3-7e8b-08dbeb926722 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WOAzRlxF74Fqub/mXTHax65w51/FlF4927Ssj8f0Sg86ZLiGgIZ6Yql4OpkABYEq8B8jzt45uWwMlWOjW4cpn80Z28tD3Srpm2lpUfg1NGGYKZsnMEsYjN2eFhj3oTe2swSkq5Ulz07/XhrWep038fBEEQsMpRx4PHytkeQdT/3/DFbxO/g7W+GAYhMhq1QZQ0UedmyS0tXOd6qyzKgyzlkpZOBtQicHoUAx5VUm0DjildPeRPAWbHLkmoikZR7p7WP4d0hAaYVwY/l3BIQrgFouvVCJCE/z7T30rFX5YExg6APQKrEOPtrPgwH+68w9bnp3AB+XkDGePnL9mxh9Zjh37aJw71WvfysdFH0JvH+yd6xn89+X7bPAtNhzdqd0LJ0+VZamWTSSv3c3RzfR76+gDMklWyREwwTS+sR7jb1I81mtnlo2BTUgNsS6Fh7KRXupLLJ9hJwbZaE/R9p2+eIX/IJqjvvJlm239dFHJgKhpdkAtgTy5mMlopLpjC7A7sXuUrrjJ7YEiiPhBJoVcwx44BycBprca1lmMhyKdHbsRafU0bSDmwNDm8bMnbmrxPTursWO0SDxmpdK2t+NYrDJh8sP3TQbCGpJ9WFt99UtwuAc4mOjveYvEEUmhCuDilw4xK/Pg2ybeBXvNOJkyuXts8d5S9Kkh2o1zb8pQfsLm2gxyTTf31HKIeVABH5mnJcwtvkYMPqqFYCnglzntZ54izTrs9zXSHM2Zy7ThPS+nlKGTGgCtCFgz2TizTTBdDdr1I2Uro3pmqw73tHsPQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(136003)(346002)(376002)(39860400002)(230922051799003)(1800799012)(82310400011)(64100799003)(451199024)(186009)(46966006)(40470700004)(36840700001)(40480700001)(40460700003)(82740400003)(26005)(426003)(336012)(6666004)(478600001)(16526019)(1076003)(2616005)(36860700001)(316002)(83380400001)(54906003)(70586007)(70206006)(110136005)(8676002)(8936002)(44832011)(4326008)(2906002)(5660300002)(86362001)(36756003)(41300700001)(47076005)(356005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 19:37:02.9561 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a09736e-e3fb-42d3-7e8b-08dbeb926722 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000989EC.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5646 The [state|reset]_mutex are initialized in vfio init, but never destroyed. This isn't required as mutex_destroy() doesn't do anything unless lock debugging is enabled. However, for completeness, fix it by implementing a driver specific release function. No fixes tag is added as it doesn't seem worthwhile for such a trivial and debug only change. Signed-off-by: Brett Creeley Reviewed-by: Shameer Kolothum --- drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c index 2c049b8de4b4..dc1e376e1b8a 100644 --- a/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c +++ b/drivers/vfio/pci/hisilicon/hisi_acc_vfio_pci.c @@ -1358,10 +1358,20 @@ static int hisi_acc_vfio_pci_migrn_init_dev(struct vfio_device *core_vdev) return vfio_pci_core_init_dev(core_vdev); } +static void hisi_acc_vfio_pci_migrn_release_dev(struct vfio_device *core_vdev) +{ + struct hisi_acc_vf_core_device *hisi_acc_vdev = container_of(core_vdev, + struct hisi_acc_vf_core_device, core_device.vdev); + + mutex_destroy(&hisi_acc_vdev->reset_mutex); + mutex_destroy(&hisi_acc_vdev->state_mutex); + vfio_pci_core_release_dev(core_vdev); +} + static const struct vfio_device_ops hisi_acc_vfio_pci_migrn_ops = { .name = "hisi-acc-vfio-pci-migration", .init = hisi_acc_vfio_pci_migrn_init_dev, - .release = vfio_pci_core_release_dev, + .release = hisi_acc_vfio_pci_migrn_release_dev, .open_device = hisi_acc_vfio_pci_open_device, .close_device = hisi_acc_vfio_pci_close_device, .ioctl = hisi_acc_vfio_pci_ioctl,