From patchwork Wed Aug 17 23:05:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 12946566 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A9630C25B08 for ; Wed, 17 Aug 2022 23:09:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E7C4C8B7BC; Wed, 17 Aug 2022 23:09:03 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F53DAE068 for ; Wed, 17 Aug 2022 23:08:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660777708; x=1692313708; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=Q8XazYjtBW+hhugEO6TsKbA7XVDndVLjObZPW5f1X84=; b=RT7U3dIdDfdxTdc+5vBlcDo7thzrJ246hsY95tRyJLPza2fpYlMltO+D NavTn/ooUCSjIPmzZ7OU+4Kic7TqHKaoeMaASqa6rbxHssToZD6WAYGsc Q8kNhc6KzaEWdmWLB2Br2hoYKYZniEZHQ+qAhnstlTnJNrXr7Ml4N7jxx lKDwANTCkhqgWzq3oK7QetWyMM5JulX11J73rCoSL2cDNX3Uzis7diXk0 1Ev5HLrk5Oh5csfQiDSs2++mSpVV4eNnOpljq6zr7stCyH19cFG1qgX8j xRZJ8+J/gBcvbAgf6L/EBA5kGOZRvLawqJrMLa94lTAI5CTMSH2IR2z4U g==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="354361521" X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="354361521" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 16:08:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="853205810" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga006.fm.intel.com with ESMTP; 17 Aug 2022 16:08:27 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:27 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:26 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Wed, 17 Aug 2022 16:08:26 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.103) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YCjUC3HRMI2Racn9LZG0CV8yrTIpBoaEijZ25bfZJnTOxNIzv2MmcJrAMwRG/UTxWJRp+gls6M02MHv93qiA6gwaInA2BkKaGslN+g9/Kplr3prkzduapnQtUjdML0YStLtbGHajdTYUOSe4Tj22fnlBJFaD8wV3M34rGY0MbEA6Mxcl7iH0kwMeg+cQCPnbWl3ak0svJBDAsFk2JOWvN89Kk2DOpuvTvhknWf/aaoxQ7kx5O3R2atS1OGX+HnrP5jH25ao9AS0/xDVUjk01hX2btwQi9103+m3lTIdElQwUREEcXUTYP+xQn6IRXxfhPZXVt8EM9/WJr6vzjvHZ7w== 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=mO+K92HvKstucDSiGaZVWe/A/5/q9niq3GnLv249cZA=; b=Y8MqF0ziYKVIk3oYkqf9+Xda6m1WIALu3AiwzoQ8PohMvJ/XomdRq3m9+t/u26YI34qOonMUNtaGLNVFjZn670mBzPxOgD8pkUB85+uWjmyu3cj8AfiDhY74VXC8J391i50ETCp3G9Hxs70lM0ObisJeONEFODDOYBJw5KkUvC/9E8TfKu7lmPc/HoNyafJIxNXNrL0NE5oQx4MifDf8Ri5jdV2rTkEMn1oTSB0iDgPLog89GYDgxtjUt2nWMb5weczg30rBTZsD203L0TtgMMh1ontxNVd86fp6dLNoNW7Hma+dCKAnwCaSYawzwhOP3szRGDARG8VsRPBU7jMfYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MN2PR11MB4190.namprd11.prod.outlook.com (2603:10b6:208:13e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Wed, 17 Aug 2022 23:08:24 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e%9]) with mapi id 15.20.5525.010; Wed, 17 Aug 2022 23:08:24 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: Subject: [PATCH 1/3] drm: Don't reserve minors for control nodes Date: Thu, 18 Aug 2022 01:05:58 +0200 Message-ID: <20220817230600.272790-2-michal.winiarski@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220817230600.272790-1-michal.winiarski@intel.com> References: <20220817230600.272790-1-michal.winiarski@intel.com> X-ClientProxiedBy: FR3P281CA0161.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a2::20) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2a0402b0-3979-4cfa-584f-08da80a562d7 X-MS-TrafficTypeDiagnostic: MN2PR11MB4190:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ldEmm1mBLPVNlqEWUTWjr46B9qknE4gvfCy4LRkDy1gxO4hPEdPXgqxo69CTjB9OPygjRPWL25n3UM8VZrPLTalIFnavonWHr4Nn04YtoURkyqTP/jTaiC52SFk4YR/KSrqmj2Rb9uGqCFNAIDaDPmPVKdLRDNZnAQAAVbFKFMwi0WQ7I0692PrpcPTDVWaP6exlaZ/Z3aKbfx2tMD/1y4a65nZZZb01rLtQX63dJoETqDKvwpjVApD4RteRajzF71q5emoqnUYahPnT0cvLccqx4liooM5JHCxPNt4OPrNd5TNPYjMTK33GGZdo2rv1S8sI3r4OShu3w3gZ5mHzo6iiFOIQgtJyoiSqMcPm+CgsAPQcRpeV/D0qGdgqO8piZfikC+txEAMQx1DkNa1CJtW/8Im2dWIg2hfiG++ToS2GWwxz+8IW9B3mEUosxH1z/bQkfYXp7zmxUberoTaU4kkusSQTmz2eprReD40dywcGACoCEMpndE/VAMakNVHt9HOYwxFx5iLQbynXaOz42HlF8mB3JOnPafuikTtnH1/qz4oaGaXE0Mn46Ut68dr8+9vvncYLcXtMPeDMJYfKINu6E9vdIT6LZX7d5NBZIUwBaH1Cc1og4UserO0BnjZ52cfbKJSoHacnnzPZl2taffIScekyFjjiBvNvNgHtjzLJ2c+Rya0aal8rQPmo0hBl03v4fV+g1GW58SkBQG/myQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(136003)(396003)(366004)(346002)(376002)(86362001)(82960400001)(38100700002)(316002)(54906003)(6916009)(2906002)(66476007)(66556008)(66946007)(4326008)(8676002)(8936002)(5660300002)(2616005)(1076003)(186003)(83380400001)(478600001)(6486002)(41300700001)(6666004)(6512007)(6506007)(26005)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?bBMUPFfZG320mCV9Y9bwcuXM8zUY?= =?utf-8?q?cA6bg4Ui9Go7i0w/uxB6g2avehBKHs9RGbp8kb5hie6joeJJyUKUfrc9BOeuPeKd4?= =?utf-8?q?tP84KFDj7FwOuxFmcaFC4B4e8F06jV/vS64EOlF2BJHOe72K4q84KH7CQ8CvnOGEl?= =?utf-8?q?U+lGM2o0k4PIx5YEBk4xLPCvM5B76daD+RRnEPTbBEFnbzzJg5/Ezb2WGIHVwgnR1?= =?utf-8?q?HLRk991Co1NeK2IRIQUolQEaV4yaaoaCSh8YZM3iAZ7zAzJ/cz5ITsc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hXnWp?= =?utf-8?q?7VNBmB60uLPUWptNP3UFIeemparkuEguVz8TZFW4sitGun67Ry966WZDUrpa82XzS?= =?utf-8?q?7opDsvydwdMNblQO0pjq1JUnm06TEgnkdkabWMVNjpHDiBdDuaUQG3c6D0zJ3t32r?= =?utf-8?q?Evp4SJICMjVTOPygOjlLDSttMmUEgtQKPbC9puJzFaY+si4yOzTKmR/w//B9BgV2C?= =?utf-8?q?iW2c4ECICEN1kkZfYD+ZXZ1JWXb7v9hKwmiuezlCYCpbRxj4G0ledF8vgxgRZH56j?= =?utf-8?q?9aRc9XIC0H4eYygiTTNfMoBCQuTmVvbP+BaUNohr50SCT2hZhpzNJpnqiG27DB1kf?= =?utf-8?q?0VzPXGb6VME1kyFEmq5DmzAdS9uQni2MayVHdrS6qGhUKM1/djHKWotM+yxDBKKcl?= =?utf-8?q?vMw1qnlL8fGsjZ5R9/VMtiJbXehIEJTfWA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 2a0402b0-3979-4cfa-584f-08da80a562d7 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 23:08:24.4318 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XH+b+5oAPfMU6PhTt1/zK5bHIRFW2H6xhr+z2UJRcfrOVGZEDNy+uogv3RClTAEY7VwBQmy8J7uef4pDVrrLzeT6j8HQGjAuz/kv+IjqdnU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 X-OriginatorOrg: intel.com 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: =?utf-8?q?Micha=C5=82_Winiarski?= , David Airlie , Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Control nodes are no longer with us. While we still need to preserve render nodes numbering, there's no need to reserve the range formerly used for control. Let's repurpose it to be used by primary and remove control remains from the code entirely. References: commit 0d49f303e8a7 ("drm: remove all control node code") References: commit c9ac371d4b59 ("drm: Fix render node numbering regression from control node removal.") Signed-off-by: Michał Winiarski --- drivers/gpu/drm/drm_drv.c | 4 ++-- include/drm/drm_file.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8214a0b1ab7f..d81783f43452 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -126,8 +126,8 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) spin_lock_irqsave(&drm_minor_lock, flags); r = idr_alloc(&drm_minors_idr, NULL, - 64 * type, - 64 * (type + 1), + 128 * type, + 128 * (type + 1), GFP_NOWAIT); spin_unlock_irqrestore(&drm_minor_lock, flags); idr_preload_end(); diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h index d780fd151789..a3be533e99e0 100644 --- a/include/drm/drm_file.h +++ b/include/drm/drm_file.h @@ -54,7 +54,6 @@ struct file; */ enum drm_minor_type { DRM_MINOR_PRIMARY, - DRM_MINOR_CONTROL, DRM_MINOR_RENDER, }; From patchwork Wed Aug 17 23:05:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 12953893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4F9BAC00140 for ; Wed, 24 Aug 2022 18:44:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A048C1266; Wed, 24 Aug 2022 18:44:21 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB619AF42A for ; Wed, 17 Aug 2022 23:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660777715; x=1692313715; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=4dBbHORUIDAzW27or2yZeAAFJcQv15mU0vub2lDevaw=; b=HMF6D4x38ZNBiQLe8ahKBrsb0GLEImsuTafE+Ci6F048Gp+F9BJZKWvP n8p9VFKRkcq1pLZ4SASdzoAIn5UvyN6PzZH0JYOqcyT7fJe1lfazA3JX3 5g4cr9VO8fEcm9cRWpbZxJ6P3YHIAw3RKQWrtcQApoPrLDF5/KkeD4IH+ nzvs27nPN/xX2vaS4u1HqiVR7YgsXirvO3src7MNH00w4Hs8VgbcM+bOy GL9SQMKrvrf+AD4pV3ewXKFDp3SAS+/mtASLsMdg+aJvUg5Q95vxeJJC/ c3JLElCDzt2GYku8hTWDro2liLthiHHirKm0bzbHMxo6Y0CRNd3AxvJzc w==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="293897387" X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="293897387" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 16:08:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="640640884" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga001.jf.intel.com with ESMTP; 17 Aug 2022 16:08:33 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:33 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:32 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Wed, 17 Aug 2022 16:08:32 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.109) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:32 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nf2RzeTT8h0gSZW0Hf55cgpvcVnXC6lpgSSX0qE7qGHWK9EHK33RV893DcHrJSHMt77cZSgUGPf4TjJENc2VGdDLtBzNeSz/gTTVKdZj2JRxGTCje7x42PMpgzXz5cSj6plbsVYZrtufXWXV56Q+dLKE/LKJSl0y+CWHiL7NP2p92R6MF0jJp9x7JKVtq2GCQWWpZlXbgay/H9mhIWIIzmaOGIXv9yECsJL59eg0hoYLJbrIfcuJfqTixmHbsKQJWo8e+dW79JmFo4W1tUpT3HCBEAweFWSeGyNp0NeX1AkxuJPt/VN02rVMiqUD+wPUWRWAOfNp9XeubmJm7kDkdw== 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=Mc6hN/s5TyNE+n2b4bOMB0W4fgtMdjMzfA9CwOwdNp8=; b=HwdrUQ3sYvFg7CQ5kIbq1CR26szVkp9fOQm21UDAKEWPQDZ+Zrw/IR4kJ6MPJJugFwuOh/BfOxE93Vt9BVsWXtcRj6MYq02k530bBp08pQU5oAb7OBHh4e6krAYwd0elqi6B+id95O8KVoRz+VLXGrKCkTFPC7FM4sS0QtBL+8qBIG8gdOHfCkYNOmzz4bCwtkd6OR/WeIEzB082lrL9Nk7AgpWi3FaWCIldTUKzocKvSyppTO8FfoNSgP3Xf7zz3nmDSoQcy3do7Zd9wkuDUJfg3Me9jlCbO75424G+oVVkVtA3az9Kas/6VbfYFTW0htuTNZMtzzp0JYX5L4tlGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MN2PR11MB4190.namprd11.prod.outlook.com (2603:10b6:208:13e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Wed, 17 Aug 2022 23:08:31 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e%9]) with mapi id 15.20.5525.010; Wed, 17 Aug 2022 23:08:31 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: Subject: [PATCH 2/3] drm: Expand max DRM device number to full MINORBITS Date: Thu, 18 Aug 2022 01:05:59 +0200 Message-ID: <20220817230600.272790-3-michal.winiarski@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220817230600.272790-1-michal.winiarski@intel.com> References: <20220817230600.272790-1-michal.winiarski@intel.com> X-ClientProxiedBy: AS9PR01CA0008.eurprd01.prod.exchangelabs.com (2603:10a6:20b:540::10) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 53b285fb-a841-472c-7393-08da80a566f7 X-MS-TrafficTypeDiagnostic: MN2PR11MB4190:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s3O7pnhrBc+gqTxODMufAAFEDKq3mh/L5CSZDybmxzxQbAEhVT91Im/dnbkxOCc0vgxFJtuLqYaH3XD+32U3xAMjN7uM+HOSGnsY54/HrK+w5ZYS/XbBZ5io3CScOa6hfxYZuFVVwvFjBfHc/YU0r9/kOGw6n6X7+PaBI+TSg8ncdUP75xt4fnCmDpfFTZa/UMMm6VBPJBoPN0jzOnisagoyLv2dpSQKAoX5YhHn3DkBtgUclCoNbMKZuj2SGRC/JNh+BVgLWuCn/eHjQqLgQt7YOUy54QmZYP2gXEd+euLM1WeWg33iVbNjHwuMlg3vM7ZPyRPjDx5PvWPtHh/SFYxQtxwD+tHZtU9yt1RT9DGA7brLuvGAsjoZ40pCsEyl/R76DyS/cwsAFil7b4oObiGOLTpCzkqqpN5JULL0H8CBk3/jwmo+h37g14nIHdzUd7t5Ozuf+F50or/kX3OPHhmTx3hdeqp8adEREHIwNuhYalLbI//Z3jybWBvG09pJnrBY7eiv8uC10gvZUUuV/bQC9EWN33mRQmf0l5AGL2SB063cXoyo+ONzHdpsbNVuK8iFoYNaaPQqMtQIOAVN/JoC2sOHCfqP8TOFq8NQjCWZOtP5Xiy4O+tko3KJLHQo1/hTrEqzK9sqp5AbH7kfa+givwr9isEVBtgC57vS0z+N0bsVsC2hLFFN4cR9qZfnYNtFwz24hTbpiBGfECFYpw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(136003)(396003)(366004)(346002)(376002)(86362001)(82960400001)(38100700002)(316002)(54906003)(6916009)(2906002)(66476007)(66556008)(66946007)(4326008)(8676002)(8936002)(5660300002)(2616005)(1076003)(186003)(83380400001)(478600001)(6486002)(41300700001)(6666004)(6512007)(6506007)(26005)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0zTbRSdr4W+7oqAkPwGakMOZQoYd?= =?utf-8?q?Yd4fB+v4awXlIc7baL63vej2JwrmasUaPapUotX/rN9A2AQGfR/KTn7F01jL9GXoJ?= =?utf-8?q?6XPPHmSiHp4ZW17/iJbTE/CgQ1hN07yb1KHIIWHEfvyVp4RlcG/MYpBwx3TQ8ir/J?= =?utf-8?q?hq5cklpLAvyWYqfaBXLeq8+7IEyb4JDuxwv0JHZ0QVQkwXFoSmUHhlJ+RqyjaSFqg?= =?utf-8?q?c4LPSDGWVrDNg1RLu+J1xt2j19ugILlB1rxuQIiYYIWoi367SEC/XuV/YdxXVWTiz?= =?utf-8?q?K2bR0qcXba2XT2lbWPDXglSYvU39JYcPYF7MxeqT4vbXC3muoTzZsC8/nYhswYLzW?= =?utf-8?q?bk7UEhYeUKqCdsV/5kKPGQfJKvEbcKRDu/fZBZ24J8vyHQDhOZKLG9jXDcDyPvwYQ?= =?utf-8?q?VTPECQKd/HC+neCQoco9zHuuXK5tALOoUKlch9kZ2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HUQOdibkP5qQvNgwBtIA?= =?utf-8?q?UdhVuatN9jRWy1y99lN2LBVBtLj0XcmuAHEuMokD2jLjg4RI+KP/36itaUrFTtcBz?= =?utf-8?q?N7pi+XW/OvuJlb7C1bJiyd09qqXmAc2kMBrEq0bUvWhn0bb5V6ZwBJyj8OBlFm6J3?= =?utf-8?q?62+b0Dmyh3/myPWE3yO0fJwVfb3bKCgnoBr16sFpLPTiyefnwE4pw3Q+mk8+Xy6/S?= =?utf-8?q?/C3nkRaajHiXmQXQu5Hdxftt9xHsHQO1oA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 53b285fb-a841-472c-7393-08da80a566f7 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 23:08:31.2736 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GG9X3rTd2MFT0lnnfGtju9Dke8nVj0R1C49hwObzyxXmgFCxs0bHYQ82GPFJXgNynRHC2zfCmvPULuBvMB0Hh7XejecMbwgOqIo5GC4eRoQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 X-OriginatorOrg: intel.com 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: =?utf-8?q?Micha=C5=82_Winiarski?= , David Airlie , Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Even after getting rid of control nodes, we've only bumped max DRM device number from 64 to 128. That's not good enough for modern world where we have multi-GPU servers, SR-IOV virtual functions and virtual devices used for testing. Let's utilize full minor range for DRM devices. To avoid regressing the existing userspace, we're still maintaining the 0-127 for primary, 128-255 for render. This numbering scheme is continued for minors > 256 (256-383 for primary, 384-511 for render, and so on). Signed-off-by: Michał Winiarski --- drivers/gpu/drm/drm_drv.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index d81783f43452..0dab1ef8a98d 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -113,7 +113,7 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) { struct drm_minor *minor; unsigned long flags; - int r; + int r, start, end; minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL); if (!minor) @@ -122,15 +122,19 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) minor->type = type; minor->dev = dev; - idr_preload(GFP_KERNEL); - spin_lock_irqsave(&drm_minor_lock, flags); - r = idr_alloc(&drm_minors_idr, - NULL, - 128 * type, - 128 * (type + 1), - GFP_NOWAIT); - spin_unlock_irqrestore(&drm_minor_lock, flags); - idr_preload_end(); + start = 128 * type; + end = 128 * (type + 1); + + do { + idr_preload(GFP_KERNEL); + spin_lock_irqsave(&drm_minor_lock, flags); + r = idr_alloc(&drm_minors_idr, NULL, start, end, GFP_NOWAIT); + spin_unlock_irqrestore(&drm_minor_lock, flags); + idr_preload_end(); + + start += 256; + end += 256; + } while ((r == -ENOSPC) && end <= (1 << MINORBITS)); if (r < 0) return r; From patchwork Wed Aug 17 23:06:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Micha=C5=82_Winiarski?= X-Patchwork-Id: 12946565 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 226A4C25B08 for ; Wed, 17 Aug 2022 23:09:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3640AFCC1; Wed, 17 Aug 2022 23:08:58 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1A29499579 for ; Wed, 17 Aug 2022 23:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660777720; x=1692313720; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=0oh4f2XqZmhZoOsOvCWOsLdj74DHgeEfOygawLb3HKI=; b=PjrNlg+Bp0kKt5hh9dQXwFNZ9Ajy9VC2p8F2VfSckuIuH/cLXuut0v8O XNxOkxp6kEVxgdFYxayrLTtodIVO7H3uCOh/n86umqWZE/LIs/83BXuMF krAeG9FeT6V7lNzMBNObL9OKzLB2NgAROxItPIZIaKuxvBdbeM8ydUNYi RnzF816O5rV2dnMS3I/eBmtt7u3N0jeCn8O8SR24OWHqXkSzqaSByW97H r3LIIQEYqdomcI4GwXn+LjP9JemvUdIeb2pePN5EUGUH47i3JETCu9rez dchbF6ntoidAeYwEOvtnotRQPjYH1c1KFjd5X0nTJAT0Bjq4cm2007dg3 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="354361542" X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="354361542" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2022 16:08:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,244,1654585200"; d="scan'208";a="733849931" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP; 17 Aug 2022 16:08:38 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:38 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:37 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Wed, 17 Aug 2022 16:08:37 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.28; Wed, 17 Aug 2022 16:08:37 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V4O29w07N1HxoprHsoASzx04JKqqYsf9tq6dufHnBb1h0c0Xw5TFesDG6YOYMG4fN4PvSl+GF1ym3W1R/4yzlq4DJr/84CBv4d13K8eO89LlcFYbvz09l1+L6W6+ZPnACeDw8bS+RE6EpZbZWHTv4lDGmqIxOX0iz45ehARLIMF8utOslx1aNTnZnuv5kZCRSLThPoCGX9zWMWCtEAK1526Li7om09RLi6FoDBrRRe/fQK/FLyOb/VTAwWNeLchinLgoPI2uUoVr+4MryGGpJm2BM2+Aydv9blPJ9LShNHCHjK2ifszMbyYRPQPh6tfdS2zfEj9270ofJ+Q4yubO1A== 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=K4gPzz544GfEVccZ8O50yxCUmK/af4XTBlcrwdMLxw8=; b=n1sWts1FzYOf9MNIvLy6PcrzlJcnzUq9bnvwg4MEqpbI1QiJpN4nchCQQllVdK68U0kJ1CyuiEGUKxZmKKnc+vVFig+Uavrcwmj2TxU1hnt+x0QLOBEYoDRbyF7yfbbCJg0Ctu8Qr6IvPvFfStWUK8vXjZBC2avOcpi+4D8rzY5yyX9uyPkMo2chrZgeP7ui71rqNV79VoYnln3zje6z6051SjTIRWk5a45LAuQHKpruwrIklp8dpt0QvCA9Br0xYF4M9tkSOroGPUHzRZnCt5yQeA6NtDLkbmSJ80bEH8lUwGBrM7nPnmW5RzpJbk7Gn6+nLXYrhEU6n8R6zSn5Hw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) by MN2PR11MB4190.namprd11.prod.outlook.com (2603:10b6:208:13e::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Wed, 17 Aug 2022 23:08:36 +0000 Received: from DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e]) by DM4PR11MB5373.namprd11.prod.outlook.com ([fe80::b04c:807c:4ea0:c62e%9]) with mapi id 15.20.5525.010; Wed, 17 Aug 2022 23:08:36 +0000 From: =?utf-8?q?Micha=C5=82_Winiarski?= To: Subject: [PATCH 3/3] drm: Use mutex for minors Date: Thu, 18 Aug 2022 01:06:00 +0200 Message-ID: <20220817230600.272790-4-michal.winiarski@intel.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220817230600.272790-1-michal.winiarski@intel.com> References: <20220817230600.272790-1-michal.winiarski@intel.com> X-ClientProxiedBy: FR3P281CA0118.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::13) To DM4PR11MB5373.namprd11.prod.outlook.com (2603:10b6:5:394::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6661d225-6c0a-4dfd-9a2f-08da80a569c0 X-MS-TrafficTypeDiagnostic: MN2PR11MB4190:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ILrjiChi2jKbUlqZCwOVnUJl3tbEUw0yjZgmSBXLkFy0Q1hGVeWb0hf+D7BbkCakb9PyV0cUjUQYAA3K5EWRZOShxApuaKUShjR/SZnfuq2mSycvP1NyC/ZlMWFDDJ9XLP9EQkA9dzUKk64BuvkCRUebpgp+6TRhKadYpPbOaCbgJE4raPuMvDpuUi8csAmLDhn2GCsfI3dhOBe9ccDDf0sY3L/cw+vHFzwwFSwg3flWybdaPVtg+VJOOJLyrHXc5dqZ2yR8SiEVg9Uc2nj4hZeWlAySGV4805NKF7MPV5kG0FPhbO5+J01jCbBC74NzbnV2Tdf9AQ4qR8dnK0LtnXspox3rla1HfdTNgRRd9v/n2ec/XrLf0XXSlrduGkhrxnw8jvpzR/dV6yX3ZFolOYaABlSXqBumRkt7KYFhB2WnEEwOoi12KpCaSWt1ToaA0tVkOU0OQNXFMwLhm4vpCzyQ+EIX3H4pNZDJfwXcpKBpIXhAP00lPIygTZovN+C5pc95umzpYoFjMxjto1+JQiBn3bNhuBN0CRXHn47Bq1idK5NjfmHhNoPeQsdDCKb+4fY3WpriLxHA5jTVh64w81daWDHEeDqBJBqVgJUTyi4EzLtQtz2m9a/ZaBPUxEeOA2mlhdfIbs6rknkh3lBUotxkhLeXMWtFdvQ0ReqSssMFX6p2bjx3v2KTqhp/C5yF9HXkw33uvTyJkhYyZ6h2TA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5373.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(136003)(396003)(366004)(346002)(376002)(86362001)(82960400001)(38100700002)(316002)(54906003)(6916009)(2906002)(66476007)(66556008)(66946007)(4326008)(8676002)(8936002)(5660300002)(2616005)(1076003)(186003)(83380400001)(478600001)(6486002)(41300700001)(6666004)(6512007)(6506007)(26005)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?FEp48TuEIQHegPz7FWbBe9AOUjOK?= =?utf-8?q?4o57M4IhlrI9FCjFRpLoZWjMhYbQZmQ3dlNSTxIwRwySjKopGSGkagFkTDe5jxzGe?= =?utf-8?q?YQTlA1bW8TJltvAV9Kt4uBt8MMvGSQD6mm/A6yJtIcql9HQhjkJ2ybmvXc/dCkhjg?= =?utf-8?q?XOBAOBNr1aidQQMw8IxPI137BUxSW676T4XTTsJ78Aj0GpPf7xKQQajtDu8KAPn0e?= =?utf-8?q?to1SmSIi6OGqVWQbKYKSZd9y8O3YtPriRmSmFkg0IhtGHE2Ky/YJFVBldNjRV92rA?= =?utf-8?q?PI1Ir8d2OoUbnUo0aj1VmqGjnl8Zp2kUsFAlMl7UTQYHr41iqPZ1tj7CucBZ8bcPy?= =?utf-8?q?Y8+Z0ZmEKP+TcfapBoht1YXv2QfdRtmTpQKweBrw2cpJX9f0T+WRqKwpxZrCrpAMv?= =?utf-8?q?DwjUI29aIFgUT2N+lvgT7C8iTZYrMTFFuUk4oMNc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sVRnrqKqnOaIi+Ont/WxPCKOJF+6Y?= =?utf-8?q?PPbaOdiDQbqMGiFtalHgm6MTJaFtoPioM+uvgXixhdQR7V0n4Ue2IQ+RtCUw9Lt0s?= =?utf-8?q?bec2k2rDK9KGIy6EvsHjw0UXOhQw1Q5BGO0Iyo30stCMcFw/ehesy6x9fvzXkizJO?= =?utf-8?q?TN8H+MsY0FUhrUJQ6KFY4gX2blf98Lug7n7WVSoJfON5kec5vCVhBAx98UrZKbMER?= =?utf-8?q?Vecmx+BmiVKuP0ZJRtJnd9BOSJ3Rl9Et6Q=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6661d225-6c0a-4dfd-9a2f-08da80a569c0 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5373.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2022 23:08:36.0422 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vvHsh5nW+vQExEIMy4B3eaDmfhpJ8MuKGRA55VtjNg/dJYBhn3/fcdmKFncwclqJxcsePJeQXRmPGYMfhqpfgePYT6JlpiTnc9/3imMXFoE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4190 X-OriginatorOrg: intel.com 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: =?utf-8?q?Micha=C5=82_Winiarski?= , David Airlie , Thomas Zimmermann Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Operating on drm minor is not done in IRQ context, which means that we could safely downgrade to regular non-irq spinlock. But we can also go further and drop the idr_preload tricks by just using a mutex. Signed-off-by: Michał Winiarski --- drivers/gpu/drm/drm_drv.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 0dab1ef8a98d..b31497e28e6a 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -53,7 +53,7 @@ MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl"); MODULE_DESCRIPTION("DRM shared core routines"); MODULE_LICENSE("GPL and additional rights"); -static DEFINE_SPINLOCK(drm_minor_lock); +static DEFINE_MUTEX(drm_minor_lock); static struct idr drm_minors_idr; /* @@ -98,21 +98,19 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, static void drm_minor_alloc_release(struct drm_device *dev, void *data) { struct drm_minor *minor = data; - unsigned long flags; WARN_ON(dev != minor->dev); put_device(minor->kdev); - spin_lock_irqsave(&drm_minor_lock, flags); + mutex_lock(&drm_minor_lock); idr_remove(&drm_minors_idr, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); + mutex_unlock(&drm_minor_lock); } static int drm_minor_alloc(struct drm_device *dev, unsigned int type) { struct drm_minor *minor; - unsigned long flags; int r, start, end; minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL); @@ -126,11 +124,9 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) end = 128 * (type + 1); do { - idr_preload(GFP_KERNEL); - spin_lock_irqsave(&drm_minor_lock, flags); - r = idr_alloc(&drm_minors_idr, NULL, start, end, GFP_NOWAIT); - spin_unlock_irqrestore(&drm_minor_lock, flags); - idr_preload_end(); + mutex_lock(&drm_minor_lock); + r = idr_alloc(&drm_minors_idr, NULL, start, end, GFP_KERNEL); + mutex_unlock(&drm_minor_lock); start += 256; end += 256; @@ -156,7 +152,6 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) static int drm_minor_register(struct drm_device *dev, unsigned int type) { struct drm_minor *minor; - unsigned long flags; int ret; DRM_DEBUG("\n"); @@ -176,9 +171,9 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) goto err_debugfs; /* replace NULL with @minor so lookups will succeed from now on */ - spin_lock_irqsave(&drm_minor_lock, flags); + mutex_lock(&drm_minor_lock); idr_replace(&drm_minors_idr, minor, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); + mutex_unlock(&drm_minor_lock); DRM_DEBUG("new minor registered %d\n", minor->index); return 0; @@ -191,16 +186,15 @@ static int drm_minor_register(struct drm_device *dev, unsigned int type) static void drm_minor_unregister(struct drm_device *dev, unsigned int type) { struct drm_minor *minor; - unsigned long flags; minor = *drm_minor_get_slot(dev, type); if (!minor || !device_is_registered(minor->kdev)) return; /* replace @minor with NULL so lookups will fail from now on */ - spin_lock_irqsave(&drm_minor_lock, flags); + mutex_lock(&drm_minor_lock); idr_replace(&drm_minors_idr, NULL, minor->index); - spin_unlock_irqrestore(&drm_minor_lock, flags); + mutex_unlock(&drm_minor_lock); device_del(minor->kdev); dev_set_drvdata(minor->kdev, NULL); /* safety belt */ @@ -219,13 +213,12 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type) struct drm_minor *drm_minor_acquire(unsigned int minor_id) { struct drm_minor *minor; - unsigned long flags; - spin_lock_irqsave(&drm_minor_lock, flags); + mutex_lock(&drm_minor_lock); minor = idr_find(&drm_minors_idr, minor_id); if (minor) drm_dev_get(minor->dev); - spin_unlock_irqrestore(&drm_minor_lock, flags); + mutex_unlock(&drm_minor_lock); if (!minor) { return ERR_PTR(-ENODEV);