From patchwork Tue Jul 20 17:42:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 12389019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C85A9C07E95 for ; Tue, 20 Jul 2021 17:43:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C64760232 for ; Tue, 20 Jul 2021 17:43:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C64760232 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 33A016E4AA; Tue, 20 Jul 2021 17:43:05 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2058.outbound.protection.outlook.com [40.107.94.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3E2D86E4AA; Tue, 20 Jul 2021 17:43:04 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cog5D0aX1dmEK59zHL73FhKpXF1baIaPstF6rQTAk3U3PVZ+arQYOIGdTKeE6T0sGShCPmKl9cRARMzI4uhqij7Swr5sdsuT8vWLGErSGuQLCrQtpy4iD1y/VqnkH1l6S5W4U4vXmLYQ6dSKouvkrqrx/LUankqCcfT2xUo5Q2UltjLuQYqra6ppUjJJleTmv3oR3bEz99NfjpVtAyLahFx/bhZWnlWtDzJ4uH7/ugQSIFt3boE5mrakPWhZjKRPI6fLSImlMwFxrqS99QhY549wTQ80SeVhu/QP/nJaQAPKqxmxu59wwc/A1P+s1OKxzQyXF1pMhy08rXbZSYITYQ== 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-SenderADCheck; bh=Q+CqPWbRYNbM3kON0iD8CCcWDFjIjT7SkcujZ9stK/M=; b=jeRAHCzys6gy+zDT4eokhn8zS80JwlDJfGK3cs1A/jRsbo8DoOn/x069eNEydI7d+SQquyvnrMkpcRxm7nI4AHCCebGUva2t6nzI8lYqnT6cu/lnF0MoRJ/pVawT76WhMhseOGBA8bqVrajBgov5KzOr4js9TmO0HEZmTbzUKK/sOzUj+hAd/v1HGfpbrLVp1T5AqK+pyIiu2NLGLyNTSQ87z5vbZ01/NN3Xse9ird/l6qL0xW2l41BF002qHYcFZskESSqYU+fPoaZhMI/ifojDIgbJY956BVZat+ZhSOa3ZupR8iiqRkJCi11MpAFMk0E3XAS12XzTzL6N4FB+XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q+CqPWbRYNbM3kON0iD8CCcWDFjIjT7SkcujZ9stK/M=; b=DPHSlkn22cH5IbSknDVzyNKw/AkYuthN2jqN+JMFXO5BidUNTtJSDBwIdDZnqB//keTY+X0+Yh2MpGLNMje228KFcL7Kb8URS5LfJ46OAHcVHNee1ZgZ2hUgMT7nrBCRA7hVT8f9i7A640nlYVA7k077BKISWGnoLYx4KACiv5wGVgRTioknE2U4Cy89Jt8Cjn18+wMW0kX8xQv0bKNPiZFErEHwQKO24gZjxUmuB3+BXy3LQlrGEkHH6Lc/EdPdqvQMDCnKnfUMjQ2DC0j4Gb/b7zvR6T830TS/MMFqa/+soc8/u6S57hUaAim4ZCHvtpGCW0G5qNUsB1fd2keACQ== Authentication-Results: linux.ie; dkim=none (message not signed) header.d=none;linux.ie; dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) by BL1PR12MB5288.namprd12.prod.outlook.com (2603:10b6:208:314::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 17:43:02 +0000 Received: from BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::d017:af2f:7049:5482]) by BL0PR12MB5506.namprd12.prod.outlook.com ([fe80::d017:af2f:7049:5482%5]) with mapi id 15.20.4331.034; Tue, 20 Jul 2021 17:43:02 +0000 From: Jason Gunthorpe To: David Airlie , Tony Krowiak , Alex Williamson , Christian Borntraeger , Cornelia Huck , Jonathan Corbet , Daniel Vetter , Diana Craciun , dri-devel@lists.freedesktop.org, Eric Auger , Eric Farman , Harald Freudenberger , Vasily Gorbik , Heiko Carstens , intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, Jani Nikula , Jason Herne , Joonas Lahtinen , kvm@vger.kernel.org, Kirti Wankhede , linux-doc@vger.kernel.org, linux-s390@vger.kernel.org, Matthew Rosato , Peter Oberparleiter , Halil Pasic , Rodrigo Vivi , Vineeth Vijayan , Zhi Wang Subject: [PATCH v2 01/14] vfio/samples: Remove module get/put Date: Tue, 20 Jul 2021 14:42:47 -0300 Message-Id: <1-v2-b6a5582525c9+ff96-vfio_reflck_jgg@nvidia.com> In-Reply-To: <0-v2-b6a5582525c9+ff96-vfio_reflck_jgg@nvidia.com> References: X-ClientProxiedBy: MN2PR02CA0026.namprd02.prod.outlook.com (2603:10b6:208:fc::39) To BL0PR12MB5506.namprd12.prod.outlook.com (2603:10b6:208:1cb::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mlx.ziepe.ca (142.162.113.129) by MN2PR02CA0026.namprd02.prod.outlook.com (2603:10b6:208:fc::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 17:43:02 +0000 Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1m5tll-0051EY-29; Tue, 20 Jul 2021 14:43:01 -0300 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f86fb051-5233-4dfb-ffeb-08d94ba5d260 X-MS-TrafficTypeDiagnostic: BL1PR12MB5288: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e+1yBJ8wwcHelEz2s6GH38h+Gh6hYnIAt9EpYA/PWXmHP4sUR3P4O6fuE/hrcNCzjoGZgoB9q2EmH3f8J98yybzukmQZW1eVgsRjATjK0nlufXYbjEQinCKJF7IAQrFOxUx1kNl6uZ7Jy8Miai2W9NaPQW+CVKVJTbO2r+X+rzfQrGtLkEvz5zu++Wr4gLQXKll96FQ44v7bjVgK9xiXu4BSlc66C+kP1vwge0PQ9OW5Hu4XUS9/TTSUlVlS0enwcs1C+ZwR36Ppy6RwBCNnSf4e64Ceo9wGnjU3iEL8Lt5FrRr6ULbnJ5gKmWpIKrRpIDp5KL06qev5sEywysK0MGhLO0NTH+CID+ByJSS2LoY83pMg2TvxPJcap0CR+8SxGoJOsIYP7k+M8G56ocSspoJ6k+Q3LifCMAvmBvrV54iLxFWNu9OduUevS4sc0OYXKGYU2j9iUyxiZo3M43WfNZD1MsPxtufJPSNXKo/0A0eb9U/+3li01WYZI/DfD2NSXS3Xkku24fVsvImkdrerm80+ZwBSYGV7nkE0CqjIK9u2V1eMbKMQyI4kZ+j6NvAj+z7RgdNh3dkEEl6dY7aEVAj3V59MpKpQa747iyUevvTSSwm/Bhus14u4gYOvBw4efDKJzg8HCPeMWohTsscddcnoj2EttO4jEqhtzrrdG7fWleqVySZidMXDIIzQ7Y7HzFFvU8OkwbVzdubOutSmYA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR12MB5506.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(366004)(39860400002)(346002)(6666004)(66946007)(7416002)(7406005)(86362001)(2906002)(66476007)(54906003)(38100700002)(83380400001)(8936002)(316002)(110136005)(478600001)(36756003)(66556008)(186003)(26005)(5660300002)(8676002)(921005)(9786002)(9746002)(4326008)(426003)(2616005)(4216001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hPDeo/17EFWnDXIJe0BsEJwx2v1L2N13jTpjzxsKA1zBaxIRo+JVt7O8ZsS0FAVMXwJFvhXZJp3B2K/je871XvMzsMTjETJKmgnbTdQXBOLBbSFRdInEubju13JUkl9rJ70FElFjaodlLBMLNWmLuZv9MjZ5VZY5asmf0s+/7wlGvcJA0FWJQLaC5jRVY1F+gNXEIANe6CwWqE+piH9N3pF7VsO6eCtXYpYdk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ZCO4tfwQ5gVI//9kdQsDVt+E7IsL0qyDmIWq X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f86fb051-5233-4dfb-ffeb-08d94ba5d260 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5506.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 17:43:02.3254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X03RHXVdT9jQ3yyMa+0zkpM1MtM6pR7S5rjO9wPldPsn8A1SZHkk/ImCRYRVkp68 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5288 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Max Gurtovoy , Yishai Hadas , "Raj, Ashok" , Leon Romanovsky , Christoph Hellwig Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The patch to move the get/put to core and the patch to convert the samples to use vfio_device crossed in a way that this was missed. When both patches are together the samples do not need their own get/put. Fixes: 437e41368c01 ("vfio/mdpy: Convert to use vfio_register_group_dev()") Fixes: 681c1615f891 ("vfio/mbochs: Convert to use vfio_register_group_dev()") Reviewed-by: Cornelia Huck Signed-off-by: Jason Gunthorpe --- samples/vfio-mdev/mbochs.c | 4 ---- samples/vfio-mdev/mdpy.c | 4 ---- 2 files changed, 8 deletions(-) diff --git a/samples/vfio-mdev/mbochs.c b/samples/vfio-mdev/mbochs.c index 6c0f229db36a1a..e81b875b4d87b4 100644 --- a/samples/vfio-mdev/mbochs.c +++ b/samples/vfio-mdev/mbochs.c @@ -1274,9 +1274,6 @@ static long mbochs_ioctl(struct vfio_device *vdev, unsigned int cmd, static int mbochs_open(struct vfio_device *vdev) { - if (!try_module_get(THIS_MODULE)) - return -ENODEV; - return 0; } @@ -1300,7 +1297,6 @@ static void mbochs_close(struct vfio_device *vdev) mbochs_put_pages(mdev_state); mutex_unlock(&mdev_state->ops_lock); - module_put(THIS_MODULE); } static ssize_t diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c index 393c9df6f6a010..a7d4ed28d66411 100644 --- a/samples/vfio-mdev/mdpy.c +++ b/samples/vfio-mdev/mdpy.c @@ -611,15 +611,11 @@ static long mdpy_ioctl(struct vfio_device *vdev, unsigned int cmd, static int mdpy_open(struct vfio_device *vdev) { - if (!try_module_get(THIS_MODULE)) - return -ENODEV; - return 0; } static void mdpy_close(struct vfio_device *vdev) { - module_put(THIS_MODULE); } static ssize_t