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: 168543 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b82:b0:430:37f2:e94a with SMTP id ip2csp1583860vqb; Wed, 22 Nov 2023 11:38:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQg9nfTHrCWmyoX/EYfpuvopdLYBy8ON4uRQEk452w6sSOHhRmwu6rZ8OSLo39ZEQkmi5C X-Received: by 2002:a17:90b:4d8b:b0:27e:277:3014 with SMTP id oj11-20020a17090b4d8b00b0027e02773014mr3714190pjb.11.1700681907385; Wed, 22 Nov 2023 11:38:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700681907; cv=pass; d=google.com; s=arc-20160816; b=fmm+T8tIIWLQHOQ4Wr/G0zxpdoEk3Yz+KkPJBgpednrfAt6bL0eWZGv6ma13WsEwdp YgBjwEo1d2nPp2xTPXOnHCf6T+beOJ0HELBTpyNpjv/00knsxPA4M2KogQAt8SlrzpU0 /B/oet3E44SaFjto6MJrmEJEwVOpts/8GXTteFvT/ruSii6KC/UKG7pnztLdao1EppRE xfvKi0JOoT83bxIqZDO5h0mqUCeo4eBmkw4oYaN82KzehVt9T8Ktek6rxIErYqgoJSJt R59bp4vDZx15829YjzLiAqiaGGPrQtXznnnnt42cqdaHSMDzCMdoSsW8JHQaOHP1DgwF wq4w== 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=VtrPayVZQXBw67d+4Vj1Zu1D6nFAfbDFFmIDnkhafRo=; fh=JXZ0TW43EdnVFwbt5vXVEauRHba7vUgLs8JGIigqe/A=; b=aE4/MbUX0/hJ4hWlKrN6gfioYxt6icPkyCbc2DB57oOoUON3WNHpje6FCIyuCXFFf5 A5vf1QVOPN1nuxNfDuHqU1bPJrv7Ul3F/NLhdUHH7wmw+sPSyTRCzfRk9LtYZu3Mqov7 bxPiRUZPjXxmoVn5UOY+NUFaOIAmfwHYP8DqPde06zKiivmNYElfYQ+0Mr/z3/84ZC/0 CUKx3c7N9jtownUIgbGs0RiBZIBAWOQYvKeX/IkpK032VqlSPhMBQENCQ7GltuByjOQr 6JTLldZklxGODVZyLXmZgmKVGcy/Ac/AbJ0QEAPrmPJW73LTuLwpzdqja3wK7uGj9rqa HoIg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=If7gDa2o; 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.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x17-20020a17090a789100b002791baa4729si210116pjk.57.2023.11.22.11.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:38:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=If7gDa2o; 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.35 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 groat.vger.email (Postfix) with ESMTP id C7223827033B; Wed, 22 Nov 2023 11:38:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344665AbjKVThd (ORCPT + 99 others); Wed, 22 Nov 2023 14:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344545AbjKVThN (ORCPT ); Wed, 22 Nov 2023 14:37:13 -0500 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> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] 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 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Wed, 22 Nov 2023 11:38:10 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783294231660735872 X-GMAIL-MSGID: 1783294231660735872 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: 168540 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp1565669vqb; Wed, 22 Nov 2023 11:38:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzSkUktoOPFEIDC5l/NDNfanZYahUHZTHGSNAMs2djTU6NxarYeqgV5zDUEYuleZRVXm9C X-Received: by 2002:a05:6830:2649:b0:6c0:ef3c:5ab4 with SMTP id f9-20020a056830264900b006c0ef3c5ab4mr4353670otu.0.1700681888862; Wed, 22 Nov 2023 11:38:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700681888; cv=pass; d=google.com; s=arc-20160816; b=0UROCeeFOtozgHj8N1d+RTf154VgvKK87YVil4TZMFYfjuUlEpEmmKEERR4O0zd3pS u2HqrLbPRzXrX2k+mxjCqgbqkuzLIcLpeMBY7DNwbfsKlvg5WbPBEMPu4B8REaECXtM5 eEAGVxUwk62+IrrcTGGVXV+opsWGQghQHdgB/0uWz3TTO0fJk/niKoMtzfk18zdoxuBm aLWuxH5e7RSUlbM3oj8hK1XpgtiMF+C/6YBIXOU61ZIs6Zk+sSlywSNBIr8LA5X5IhMU 0RHBIroQqriw20gvU6j0sR3XuSyIo84SXUG0zHj9A0ams2XdqhL0RCmeOKmPKpcUBSKd r9cQ== 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=INO2GNW01En2yUeBMP6tNMjlCNPfa/LvvS0Zyo3Sg8k=; fh=JXZ0TW43EdnVFwbt5vXVEauRHba7vUgLs8JGIigqe/A=; b=kIfD+HF5RrQyZY7sfXX0w20aGsGixP48vM7sxZw2FCll7pz57nfWiQGNzpYzGCPrF4 CLlH30Mz3mm0xJerF6Aw6OFXk1JsRMm7AjitT0iEOVppDUxNzCdhvpw/5aqFBSlQoBq2 iLs1TnAVcgpNPvb3blv3RykkEUH3oMNutlOhfHoIaEWbLxx5KZFaJTn1Q8A9XRurPFaq NkjRalRhlcEsGA648zZjVAQX7i+wFAZkCgbXCVG7Zeo0wyxX8OPc3jQ/TpwXA+R4R2Fv NDzFIuxzaEH1g0xmFrKBgr4rpMJJAMGV1BLDv3gp5680uAGCmW3vdGp/uSx0ErixQzpe uogQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1wy3sRJR; 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 bg3-20020a056a02010300b005be31178051si126846pgb.281.2023.11.22.11.37.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 11:38:08 -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=1wy3sRJR; 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 657B9827DFA8; Wed, 22 Nov 2023 11:37:55 -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 S1344486AbjKVThg (ORCPT + 99 others); Wed, 22 Nov 2023 14:37:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344558AbjKVThN (ORCPT ); Wed, 22 Nov 2023 14:37:13 -0500 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> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] 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 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:37:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783294212370430579 X-GMAIL-MSGID: 1783294212370430579 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,