From patchwork Wed Nov 22 19:32:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 168531 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1563331vqb; Wed, 22 Nov 2023 11:33:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYFTeOvyLbkDiDPtJEQhkgHSmaWH82XO7KA1K8BHlOOURllPT9N5SV8YBTaNrIRxp717ME X-Received: by 2002:a05:6a00:8cc:b0:6cb:a18a:22b5 with SMTP id s12-20020a056a0008cc00b006cba18a22b5mr3802529pfu.2.1700681593637; Wed, 22 Nov 2023 11:33:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700681593; cv=pass; d=google.com; s=arc-20160816; b=AwarOgZ2mN819j5G9kTmuQTTrb5Mem9nHmI2H/cA865zv0oc5CF0oaR9GRV+7WxB3j PqVduy0YlcKE0jzRwBj6QMgW3WRih0culhi1+WKA5g4S1OWG/uWlRchTCExUdvRgjK06 KCZtfTFIGqfu9Plp8PcRtIjzw/ZqPtBtft86YCfSyQ19pKI2h4BfDxwMwS1iiv8MPCQk T3mH5pcDDRG6v/f9A5tc9eZYbZCQX5GtVZS1nZVwAIr4nwgtvmXdJWiVrBkOHCvVC6kg KMxAqwcb6hC265BhPGovsB79bCDLHB2Uhoy+AT2GvSJXJFma/TYOsCSu1kSyjlLozq97 Cebg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Lcw8ubx4/O/7VVkvW5lGzzS4CJMRXDnsGILAAGYHdLc=; fh=lBBaLJko1QugYzFKdQRCcg/1umbDT+qI/sM7W6WplGU=; b=ovvpyHYNwzjOUCang44els1Tn1UP4z8K+LKKdBZ2LrCZ4TzLc23VQv+EojuDw3/hu9 kOsRkD0yCeWveDGfFbW0nQkhgXAq9DeX932Zx4V/Ms8icpWYyH4rEWRbcuyp00vMzzuX Xq5z5OHat39/rFbxdnLdf9ZxS6B+18TMopkf6G51SXd8rlRvVotKxY+acCPondOW53+2 5kVdLt/TpOJMX2lVkuNKrwqt+C/aM50ooEpXe0dHnJVA1H0Np9rLEUH3Lp8yRKbSQ28i kqOeD03B0UUcO+M4wTwbWWJWawBMlbw8l58I7Y6yd60Wb/UlXSY3AOm8oSxKo0ya7bwm vj2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hTprqL5O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o7-20020a056a0015c700b006cb894c66edsi179938pfu.93.2023.11.22.11.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:33:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hTprqL5O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BBADB8274AD1; Wed, 22 Nov 2023 11:32:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343554AbjKVTcx (ORCPT + 99 others); Wed, 22 Nov 2023 14:32:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231430AbjKVTcw (ORCPT ); Wed, 22 Nov 2023 14:32:52 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D41D419D; Wed, 22 Nov 2023 11:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IFh1iUnHmVG9fM/Tidmt32bYq1K9yyhF/cd7Nld5KUsKd7DXwV7zzPC/PEJ4CGk1H9MTE4eQYWPGWUuH4fBo/adjM36/BPksBJPjAbJAAhLVwWfGFrEJQpkLRQX5AuLQn+OeJhUq+o4URuPCaZ0BrjJkCwYWLBQX0Yw2CYZ1TnSa6kBzm0cz9Xh6GftAjcLSryy6ouq9mIRmkxxsgOw17dsPnmyad0WIOwAzx5PMwYH0EaPRopOlPbQd3W8jXtExm93WrkxLy4GOFlumC4kRTmqyTXGT1OI0vpBvU8CtHBwpjKwcsPXFnPYuTnhvObTczDqAd22bDopmEkeLEJsQ7A== 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=Lcw8ubx4/O/7VVkvW5lGzzS4CJMRXDnsGILAAGYHdLc=; b=Xfl3QFAud0DloKzQhUDpBcvKrjMNgX1o8CfrCpJlckAN4OKs3eWtjV9qg1o/2gATnQXnWdR892wb/9rdiOlEVsbbOfeE8XZ0tGbO0ClZRr5eBKH9JSKYUUh7eLvtExZ1kkaIpmguf7e9fz5nzq3YZLYk1whW63a6Hxinh2X1ZKBDRvYbcpd58dPIqES+YfxIh16TIvYFg52MrQpln57+wi+Wd7tbAqlhJBsJxvPmTT+lpQx53zRviMDYTQbmN46ZlJN7BSNweAgR0ui/8y6Q9nY0fBZfpUFeK3FderjyyAcolN9eaBcs7BgEE9ikjQddNUv62Yf5KJSEsV5DuoaT6Q== 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=Lcw8ubx4/O/7VVkvW5lGzzS4CJMRXDnsGILAAGYHdLc=; b=hTprqL5OW/zSD1GqakINLUvQwOCIB/TEXieBKGuuke3XTyhA/dlKcur1bte+Eck7BCLIzH0g3uwEld6y5+MqzL2MH0Pdf4aOLcZ+TF9j8atOWsNMQKWDlUlUs3lYfojHvRCb7ldJO8nnIHnnkQvjG5VLMp1JjtDrfohis1hb7PY= Received: from BN9PR03CA0854.namprd03.prod.outlook.com (2603:10b6:408:13d::19) by DM6PR12MB4371.namprd12.prod.outlook.com (2603:10b6:5:2a3::23) 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:32:43 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:408:13d:cafe::a) by BN9PR03CA0854.outlook.office365.com (2603:10b6:408:13d::19) 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:32:43 +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 SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) 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:32:43 +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:32:16 -0600 From: Brett Creeley To: , , , , , , CC: , Subject: [PATCH vfio 1/2] vfio/mlx5: Change reset_lock to mutex_lock Date: Wed, 22 Nov 2023 11:32:02 -0800 Message-ID: <20231122193203.26127-2-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231122193203.26127-1-brett.creeley@amd.com> References: <20231122193203.26127-1-brett.creeley@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636D:EE_|DM6PR12MB4371:EE_ X-MS-Office365-Filtering-Correlation-Id: a5865340-9ccb-41ca-dda5-08dbeb91cc32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OzUs0bSDDnUpkLBE7y2dPNO4VHYtHHUBJENCCeeFlNmKfB6TJJ1CyXunw/dLCHAtcqTAJb/WJJGC+ZQNWsJUfqkUvu6rHtR+1Wx2P8/zn8jzqjv8KucgXmq/6efwVF/aZMx6fMTC3SM05vp3Xr4MZkJTTgzhFIyaBeueok9pzIUgsMjL7T4217QPa6RRX7OyuWudzy93zmyHT9iClwK5kYdY9JE3Bpf2EKf5F1YaKo+cDP6SmzVCGYY252XphQSAMUELONhjWIkqYKZ7FTVJsUU8pszcb3/g9taEXgl4XHURWQV7z5rzuCFE07UJ7J+VsKCXseze5WQGEevBupP6kFelzf8ZMyvzF+oI5T7vigkHwmQAtl4VZ5d8RiQyHiHBwj2N9xyOnHuDbgJC4cnUOWPtJGWLZoHEO2ylVINiW9GdQydU5kiVdKYPfMWY6L8y9e3CWr/uoXHEjVrM3CSYioheclh8dxjaSjdNRBpoTkf56wOsg0ZycurWZmX9AMzBF31BERtwyU2kjAdhpBf9n+Edd82GgNvbvGYnS1gJwtf+GuZruI+rw6dxBGkN2y0rnaE/7wiEMy9CEy4HlWHsuzXNjr49il8g3hTZQEG7jxrD+5dbhIaZMnRdd4rjCEG2zakAfBm60NrYI6J9BZSPRlbM0bhAMU0Z/4SAqT/K9xZOJSzFJl9yD0ZfvGoCAMWrHwDWky0GoshjS8MpriEc1rMs7EHQIr9Gi3iDt2WCl3PG5VuC7UD1vNeeGn3KR6WYQbzpg3/OBDFGBAvwFc7fNg== 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)(39860400002)(376002)(396003)(136003)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(40470700004)(46966006)(36840700001)(316002)(2616005)(426003)(336012)(16526019)(1076003)(26005)(36860700001)(82740400003)(81166007)(356005)(86362001)(36756003)(83380400001)(40460700003)(47076005)(54906003)(8936002)(4326008)(70586007)(70206006)(110136005)(5660300002)(41300700001)(44832011)(2906002)(8676002)(6666004)(40480700001)(966005)(45080400002)(478600001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 19:32:43.1102 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a5865340-9ccb-41ca-dda5-08dbeb91cc32 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4371 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 11:32:52 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783293902910020567 X-GMAIL-MSGID: 1783293902910020567 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 --- drivers/vfio/pci/mlx5/cmd.c | 3 ++- drivers/vfio/pci/mlx5/cmd.h | 3 +-- drivers/vfio/pci/mlx5/main.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/vfio/pci/mlx5/cmd.c b/drivers/vfio/pci/mlx5/cmd.c index efd1d252cdc9..5cf68ab2bbd7 100644 --- a/drivers/vfio/pci/mlx5/cmd.c +++ b/drivers/vfio/pci/mlx5/cmd.c @@ -202,6 +202,7 @@ void mlx5vf_cmd_remove_migratable(struct mlx5vf_pci_core_device *mvdev) mlx5_sriov_blocking_notifier_unregister(mvdev->mdev, mvdev->vf_id, &mvdev->nb); destroy_workqueue(mvdev->cb_wq); + mutex_destroy(&mvdev->reset_mutex); } void mlx5vf_cmd_set_migratable(struct mlx5vf_pci_core_device *mvdev, @@ -238,7 +239,7 @@ void mlx5vf_cmd_set_migratable(struct mlx5vf_pci_core_device *mvdev, goto end; mutex_init(&mvdev->state_mutex); - spin_lock_init(&mvdev->reset_lock); + mutex_init(&mvdev->reset_mutex); mvdev->nb.notifier_call = mlx5fv_vf_event; ret = mlx5_sriov_blocking_notifier_register(mvdev->mdev, mvdev->vf_id, &mvdev->nb); diff --git a/drivers/vfio/pci/mlx5/cmd.h b/drivers/vfio/pci/mlx5/cmd.h index f2c7227fa683..1cfd126724a2 100644 --- a/drivers/vfio/pci/mlx5/cmd.h +++ b/drivers/vfio/pci/mlx5/cmd.h @@ -183,8 +183,7 @@ struct mlx5vf_pci_core_device { /* protect migration state */ struct mutex state_mutex; enum vfio_device_mig_state mig_state; - /* protect the reset_done flow */ - spinlock_t reset_lock; + struct mutex reset_mutex; /* protect the reset_done flow */ struct mlx5_vf_migration_file *resuming_migf; struct mlx5_vf_migration_file *saving_migf; struct mlx5_vhca_page_tracker tracker; diff --git a/drivers/vfio/pci/mlx5/main.c b/drivers/vfio/pci/mlx5/main.c index b6ac66c5008d..689edfd750e1 100644 --- a/drivers/vfio/pci/mlx5/main.c +++ b/drivers/vfio/pci/mlx5/main.c @@ -1284,16 +1284,16 @@ mlx5vf_pci_step_device_state_locked(struct mlx5vf_pci_core_device *mvdev, void mlx5vf_state_mutex_unlock(struct mlx5vf_pci_core_device *mvdev) { again: - spin_lock(&mvdev->reset_lock); + mutex_lock(&mvdev->reset_mutex); if (mvdev->deferred_reset) { mvdev->deferred_reset = false; - spin_unlock(&mvdev->reset_lock); + mutex_unlock(&mvdev->reset_mutex); mvdev->mig_state = VFIO_DEVICE_STATE_RUNNING; mlx5vf_disable_fds(mvdev); goto again; } mutex_unlock(&mvdev->state_mutex); - spin_unlock(&mvdev->reset_lock); + mutex_unlock(&mvdev->reset_mutex); } static struct file * @@ -1372,13 +1372,13 @@ static void mlx5vf_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(&mvdev->reset_lock); + mutex_lock(&mvdev->reset_mutex); mvdev->deferred_reset = true; if (!mutex_trylock(&mvdev->state_mutex)) { - spin_unlock(&mvdev->reset_lock); + mutex_unlock(&mvdev->reset_mutex); return; } - spin_unlock(&mvdev->reset_lock); + mutex_unlock(&mvdev->reset_mutex); mlx5vf_state_mutex_unlock(mvdev); } From patchwork Wed Nov 22 19:32:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 168532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1563385vqb; Wed, 22 Nov 2023 11:33:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IF58W3t71OoWW7HZurbYCsVbGbFlTlpu1/VkW9bb7s5VsE3qcGgxgakA8eatPhCTVeOZbOY X-Received: by 2002:a05:6a00:2d89:b0:68f:d1a7:1a3a with SMTP id fb9-20020a056a002d8900b0068fd1a71a3amr3968850pfb.8.1700681597555; Wed, 22 Nov 2023 11:33:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700681597; cv=pass; d=google.com; s=arc-20160816; b=F80qgBWer3GNxiEuTi6iYi0uvwUnyzUU1SZPjS0MTMLyUUbB0YDiTvzEAxu3lZm3/F aD4ZXmH85yA8VT6d0y2O3i+ch8Kc9gybVg40h7KqA1WSG3mWHiQrC7DQNGDHIIwxDavB Xv4PLXn+qw3GmN2eboWJ1n+U4rJQk1TgmB3zGy2Qbb+jEdZrXqbQ1mKYXJDOIzrIlzAv LhFsCWDnUXXkV8LZQoKfq5IkqyxQHttuCtpth6KizpDp73I8l66tjzLFpqfEPtmr8o8V 4qcssUpgKI0SI2+WLHkBLI4VVd1NS9Vu8VlJ8ix2PFyWu6H7TYBxJuKd7d9d+YBJ1lSL DpVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=7DuhM4Gik8C4Gpzu/tFt4Op3SrlDCB6Fy52QG6z+0OM=; fh=lBBaLJko1QugYzFKdQRCcg/1umbDT+qI/sM7W6WplGU=; b=BRPdl8Yw2TmAdT60soBwk+aVgwYjY0DKVwJMJK5/xBNb50H8wNyK8HfPjtug4hKHaF 22bhy6mFtjEXZfQBMM6kq8OmU8g/7Cfa3R7Q5xJ/JgTTtQTIwzW0QWsaPK8DK70tg1XM q81qeRtHiw+RnFph7gi10l3bJISrvQhrMdRcM+oP2Id+OMsDzWdoMrsgdPGozow1VBsN 9MBTdz7hDzp3LFArv7Uu4ZGvL12q72a80Snb9OMmvXmbwPzMDSyg6UodmcfcN4C/qiTz Kd4J8Q3tKv55XVPbL+AEAcJJn0h75QtBssgraYfpNibq6bpcemCctNwFNakJjGlqYyIu yrbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NBcHUG4I; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id n26-20020a6563da000000b005b74ce91e9fsi88565pgv.672.2023.11.22.11.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:33:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=NBcHUG4I; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7E3A38274AEA; Wed, 22 Nov 2023 11:32:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344371AbjKVTcz (ORCPT + 99 others); Wed, 22 Nov 2023 14:32:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232105AbjKVTcw (ORCPT ); Wed, 22 Nov 2023 14:32:52 -0500 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2075.outbound.protection.outlook.com [40.107.244.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 052741A4; Wed, 22 Nov 2023 11:32:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gZD6F19C1ldYpHCzsQEdQuP4sHJmpnH7eu2U70ByzftUnT4ubkPMswS/LOh8//uBdYHObyJR+fuJZBnjqBD2DuQCELXwL8v0z1TAG9YER4OwqyU9Wjf9lDcqABaniR3FOf2w2OofkW7GgIV2bgUHSyPTCVy2MJ+xf6ES1KF0M1R8RInp8isHVrPzsvqNJ2D01W4IZoaoSIehWmeQ3ISAuQjnc8NtN1J6N5rfrtBOypqjXbcTPozoYc2N1eHwlUQvNrf4LBJ2sOSIN5DBesfivjpcEM5ezZ9ttDjq8FU70SHel/i9L6RD7+RdT4+ZkgdAGYGVYxFKkjXh/ujsuoL5lQ== 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=7DuhM4Gik8C4Gpzu/tFt4Op3SrlDCB6Fy52QG6z+0OM=; b=hKBJiSoxaT8Ebb62ONUStYjTHe0DU6b8Xg4hL1AcZ4rZxHGVK6NYSGtf7Avc4TBJ1i2e7/SKYYCuV5QNCO+x9R5aUjwgDwSgYJgVDyHrmpF+0XYaODjAkgmKWKHR6Clt5MvGP9HOcGzWTYmWvi7tvk/J99nhHLdZS+mgT0SDnfnhR7hWC6m6Gnbiob7P7sU4teNcWEmauaBiomOyp9md/5Enj8PuKg9TtcZpaaSFmHgt4S0n0A9FS81E5RlWaJNoV7gXfjVaLj7ERJKrtbt6rl2lpwquz6J5gdh5gTXDbr0fl0aRRF4pRtKL4qxC5yYakCrLBxHcdNCJ7e/xPTXk0g== 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=7DuhM4Gik8C4Gpzu/tFt4Op3SrlDCB6Fy52QG6z+0OM=; b=NBcHUG4I8Psn3S9yTwDG4mCQGeWH6M0UjepvCxLvBeqORQxjyr8XwvPOyYNOdnOdyLvoNVkP3BkBhw4qCOchwY3OaKDXy595MDmsgMchKypyhlHf0KajRIk3kAotW65f4DIm+JqJIe8vGbe8q+gd+ySijW925HmerxxMqTcnTng= Received: from BN9PR03CA0850.namprd03.prod.outlook.com (2603:10b6:408:13d::15) by DM4PR12MB8476.namprd12.prod.outlook.com (2603:10b6:8:17e::15) 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:32:45 +0000 Received: from SN1PEPF0002636D.namprd02.prod.outlook.com (2603:10b6:408:13d:cafe::88) by BN9PR03CA0850.outlook.office365.com (2603:10b6:408:13d::15) 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:32:45 +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 SN1PEPF0002636D.mail.protection.outlook.com (10.167.241.138) 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:32:45 +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:32:39 -0600 From: Brett Creeley To: , , , , , , CC: , Subject: [PATCH vfio 2/2] vfio/mlx5: Destroy the state_mutex on release Date: Wed, 22 Nov 2023 11:32:03 -0800 Message-ID: <20231122193203.26127-3-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231122193203.26127-1-brett.creeley@amd.com> References: <20231122193203.26127-1-brett.creeley@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636D:EE_|DM4PR12MB8476:EE_ X-MS-Office365-Filtering-Correlation-Id: ae19381b-b9a3-4e40-7f9d-08dbeb91cd79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HT+QIutJrjXPoZBAE0cpsc3hSc5iVtNDNXtMobQOajj1FefPKWMvl6bL8a3Bg6DixVCxK5he9paSbvDLBmVmarN35W7qr6PVHtl02DjViIZXa6yar52EJFp+TESZAjt0j5WsDprCgEu5O1bW5DQHHZknnHCdNh8RQVF3wG/NmFd5FWzE8sRETCGKWgWCvk7Nn3ecIan0McOTKhBlo6EZ8MQOXJ6sq6l9XTjovQmcfUkz2o8mHCq6CIgVro1+my5W3UOrdnRUwLteVffiMo28pgVfJcms1pjIStp+aQTnYaCdngIH128e1P45mdjTvYd2b0pUjOF/jjEfysoaAWdqD0XKJPpyG4pV1rQx0xbjP6T9U5xB+7orAk4YbKtWbXB1FPRHHMVc9SjhkpfX9BPpJL9wmrU4ux8UV38+qIffgGjJyWD2bdYnL4348YQw2s5hsJTojNIT1zzz2l6ybLxUS0IIQbyGthf+MY9aXCZCay23ur6vbwl7jiSqHOrPdkVnrBU5jjONniwQcaBLK4wUNc24kyIqrNpv/XsI93EszDbEKOk83mw5h2xRULLZITlwL0o7NYawQ1IbvoFneyt+BEeznUaFWr892qwhxPwSsA+NresnKUZwy+hylT7u9Bl19GOMyiBh8/9EivsBw31cmSLMqBwio5R4XaYIR3coUo0bwdmuaIRcJbfNQ9ttuU4f6avwxlJMav2/TA/V9v08/JRxoUi17DJgqA6S7PBlExRGwVlQ7+9nzQxLOiHozcnW7JsRWqpLfN0s6S+0R0oL1Q== 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)(376002)(39860400002)(136003)(396003)(230922051799003)(451199024)(1800799012)(82310400011)(64100799003)(186009)(36840700001)(46966006)(40470700004)(40480700001)(82740400003)(83380400001)(336012)(426003)(1076003)(2616005)(16526019)(26005)(8936002)(8676002)(4326008)(44832011)(36860700001)(47076005)(356005)(81166007)(40460700003)(6666004)(478600001)(316002)(110136005)(54906003)(70586007)(70206006)(41300700001)(36756003)(2906002)(4744005)(86362001)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2023 19:32:45.2509 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ae19381b-b9a3-4e40-7f9d-08dbeb91cd79 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: SN1PEPF0002636D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8476 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 11:32:57 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783293906998567273 X-GMAIL-MSGID: 1783293906998567273 The state_mutex is 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. No fixes tag is added as it doesn't seem worthwhile for such a trivial and debug only change. Signed-off-by: Brett Creeley --- drivers/vfio/pci/mlx5/cmd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/pci/mlx5/cmd.c b/drivers/vfio/pci/mlx5/cmd.c index 5cf68ab2bbd7..4ae5295757b4 100644 --- a/drivers/vfio/pci/mlx5/cmd.c +++ b/drivers/vfio/pci/mlx5/cmd.c @@ -203,6 +203,7 @@ void mlx5vf_cmd_remove_migratable(struct mlx5vf_pci_core_device *mvdev) &mvdev->nb); destroy_workqueue(mvdev->cb_wq); mutex_destroy(&mvdev->reset_mutex); + mutex_destroy(&mvdev->state_mutex); } void mlx5vf_cmd_set_migratable(struct mlx5vf_pci_core_device *mvdev,