From patchwork Thu Apr 18 22:37:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13635505 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 4940FC4345F for ; Thu, 18 Apr 2024 22:38:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8669411A04E; Thu, 18 Apr 2024 22:38:07 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="EvrP0U0e"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35E8D10EEF0; Thu, 18 Apr 2024 22:38:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1713479886; x=1745015886; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=CxvJd2pwpEBQKdHDfUFg7JlE8lBAISqpM4cKv+Ova0E=; b=EvrP0U0eVSAWuI9RuZveRkHcLBE70YZDquWygPhKXUX6fN59ZtwnUUg2 iHVxN6LQgLoZqHFnxxbit0buostKzoye7BBot9hzW67ZoLFBkLpKLMrms ztFWe6PIhBdU+Xf89UdEaKOSA740E3stRb0ZU0mhla+zXTuZDWA8nSuri ilP81mhZkNIGQYQYODBGMyX1e4XL9uVNhYRsvo7A6bJHvhjlavEbVGy2z sS1vHDoNGYr/x8cPpwxM0JcCoqds10a7qT3UbJl+7Ury7CoiuzH1qHhdy qe8CRgmyzAv3Tm2TqdjcgWAvqPszy8T/SGgxbZWaKDx1wcSS8wZqU4qXN Q==; X-CSE-ConnectionGUID: 4YePmQ+fSESi/JrGmFfDdw== X-CSE-MsgGUID: R6vESQTkRWu+uCMlVHfv3g== X-IronPort-AV: E=McAfee;i="6600,9927,11047"; a="8920509" X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="8920509" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Apr 2024 15:38:05 -0700 X-CSE-ConnectionGUID: nWPcyUiSSVSQH5UrPkQVjQ== X-CSE-MsgGUID: bXbr/zlXRgWpNBuVDbCNHg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,213,1708416000"; d="scan'208";a="27767539" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa004.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 18 Apr 2024 15:38:04 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2507.35; Thu, 18 Apr 2024 15:38:04 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 18 Apr 2024 15:38:03 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.2507.35 via Frontend Transport; Thu, 18 Apr 2024 15:38:03 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.101) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 18 Apr 2024 15:38:02 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BlE22qU1QTqO66dIQvF3CDy8WrOai3dK9+BKTQevTWEr8YQuZM8EM1ugJFhlJix0pmRg6OfLDiQ2fQKdHHP3Zv9WifWZro1PCTCFOb3tYp0vjwJnS1VS8+75zOFPaty2ZozloIXKjPFrG3O+Mf+VkT/4STS/7E9wRAQjgR79ILlFFuNbv1UYAlzngUdqWRqUX+PigGYkesA7xDPNbzUOnogytXQzyVNQDPK9mTUTOOB80pMavwc9LoNT4pQju3TlKWRWsr0rira+6HtofeSrG6tbTiGc+sR8WUZ4xVPh2uZgUI0CjcjyuVjck6OkMNk1kuSirOmqtfkF01ElDAkorQ== 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=oMoKgZZSn5NHTiEpyFY291M6VL1pudnJ+IBq0HRN1Og=; b=OCDiWy1SXjKc4AlhiO0KsxIa9aQNeSWvICLtOmRmAuN8dmwaUPdHXnhWhKxgzuiJQN8zYqgRiwd2WOVTnzNszjB9wtfZ1G0cJBOceMRmN9bGOsxDyeLI8tu+0LpsQppC2oVAHtAwdiQmR8ctUITYGm0cKQ8pXPG/c4KUejjMOGavGO3hEr0X4cKxQCB6ZmelAfVJMNxZEG3trBRNCaWaFmm0gRtMqKH9O+j7DwKrh95du89LRkXA8T1EOPCWs0RRyKO7fd3MX8n/b6se8LgXtZ5YLtxJKeQB0CN0N0BbBMN7vTc8jCjDAzV4KSvIEHJS06EaVXHLqAVhNP2Ez4DYcg== 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 MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by CY8PR11MB7242.namprd11.prod.outlook.com (2603:10b6:930:95::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7430.46; Thu, 18 Apr 2024 22:38:00 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::cf6f:eb9e:9143:f413]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::cf6f:eb9e:9143:f413%5]) with mapi id 15.20.7472.037; Thu, 18 Apr 2024 22:38:00 +0000 From: Rodrigo Vivi To: CC: , Rodrigo Vivi , Imre Deak , Francois Dugast , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= Subject: [PATCH] drm/i915: Convert intel_runtime_pm_get_noresume towards raw wakeref Date: Thu, 18 Apr 2024 18:37:56 -0400 Message-ID: <20240418223756.68427-1-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: X-ClientProxiedBy: BYAPR11CA0088.namprd11.prod.outlook.com (2603:10b6:a03:f4::29) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|CY8PR11MB7242:EE_ X-MS-Office365-Filtering-Correlation-Id: a904f074-cddb-4b46-9202-08dc5ff833b1 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Os5LtiOe4Yy96XmSil7b4rYJLokV906BukQWx+/hlmjDFSSgG+cfjidlJwktvIWNfz2kKyEJFAndc24MV0cIhl7aYHQgA3N9mUP07s153CNoQaSHJfC0Wxq0U8u5qpPq9zi9JDiCshPXErmYhhm6R9zpYPm5GHLlOxhEdiFCYu5YzjQNMYXostJRWVWkGGRATgrcegbeM5iBtn8OBeBFincqb+f3MOcogkjBlxbIUYzSpjOGapxhO2hdxId9z9mDC7gRqylYaIcyw0uZOO9LCx+GIoQLghYLvhixbGlXR0XFpGtxpFY3VwkpENlx3fBj6TbbYgHlXPTdDFhJbvSxaY7KMfdAr54+vofxRCR7JeZi7Mdnc0x7aGL+3cnd5sETP0lqbqU7Rb6sYi5p5PLzUGTlkZjG+ao7IjX7Lx+wb/8a/LRdvjuttg7ZbnS5yvjEeD9Dok/wsJKWhl/rrz96hzz4Dm+gN4Po2DnGOu5jUwAq5MmEg/LPhavNosOYvMnImv4cfdzd5Z/OCFJ8gMJwyJztB6rbyT/JqaOLAfgL3jJDNsBLf821h66qpbnThfscrWZEB2AB77ah4u12YrRjxwxfoi/J6NdzWf2ao22baYU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(366007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?XtK5yYc7zZ9x3JD/5Pf/tuAH11yO?= =?utf-8?q?eTuIlMhinKPUiutiwm/28r5NTOyyrzS2tbkbYCFdNDhY0Wr2ayJbt3HSQjJlL/RGM?= =?utf-8?q?GxOwstgbEN3XLKF9GQ5zRd3y9FulunXlZ50PdbJYS2E8Y5wFd/Ob1CMiw3M8R9tct?= =?utf-8?q?Ewru7WPJD8AntBcNiccHhwLncU29juNtRGEL9wo0pRNv9jF9YCw5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xgnFhi?= =?utf-8?q?RLfMkM8/GdQBGglTqKNPTkpxCvqj6HncutzEjE4yl4VRuhCrNg+dEabWyrJarupkC?= =?utf-8?q?IQIisRxaGR1IwSLiqhi+aHKoc6e7n8DEw3ATa+cBPlDMxbywg9yBVQz0PzGXpJxkS?= =?utf-8?q?PSgbV9xYlLMTfdATsAGFbaEl8/GBsRhYktb1LamUbSTBAPsThnazbNbS3JU9r7rgF?= =?utf-8?q?GUTuHKMSPQRJJ5n9Z5JRWoHohw6BHt1L42cNCUCid/3UOgHUErKwKUUUy1zVsJSMo?= =?utf-8?q?VIHruocvb+lWOcqQ4I9+drzZbdKRMwZyYixfLiad00sz73eFh4eDI9sYs8bxkrSdj?= =?utf-8?q?5Je9NI472tPNNP5Gv7TjvG6APCS0MJo4oOqXmMArQuelk5aPPEdLFUUlFb7LqvEpX?= =?utf-8?q?n3iJ34x0JjC3bAy4N9gk80hG9eEPydBLUun0fHzVVLgXK1FCc2cOsGtPEb4AyO7YR?= =?utf-8?q?B2a55ZSEb1ss?= X-MS-Exchange-CrossTenant-Network-Message-Id: a904f074-cddb-4b46-9202-08dc5ff833b1 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2024 22:38:00.5226 (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: goNTfTHa1K/nmTSEYbb8kIpEzcT4y/jBpQ/e6FAjEodWnnDtDCZ5XvwDUYcexZzptD0S96KkLB5ltN39EVYdCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7242 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" In the past, the noresume function was used by the GEM code to ensure wakelocks were held and bump its usage. This is no longer the case and this function was totally unused until it started to be used again by display with commit 77e619a82fc3 ("drm/i915/display: convert inner wakeref get towards get_if_in_use") However, on the display code, most of the callers are using the raw wakeref, rather then the wakelock version. What caused a major regression caught by CI. Another option to this patch is to go with the original plan and use the get_if_in_use variant in the display code, what is enough to fulfil our needs. Then, an extra patch to delete the unused _noresume variant. v2: Keep grabbing wakelock but only assert for wakeref. (Imre) Cc: Imre Deak Cc: Francois Dugast Cc: Ville Syrjälä Fixes: 77e619a82fc3 ("drm/i915/display: convert inner wakeref get towards get_if_in_use") Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/10875 Signed-off-by: Rodrigo Vivi Reviewed-by: Imre Deak --- drivers/gpu/drm/i915/display/intel_display_power.c | 6 ------ drivers/gpu/drm/i915/intel_runtime_pm.c | 14 +++++--------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_power.c b/drivers/gpu/drm/i915/display/intel_display_power.c index 048943d0a881..03dc7edcc443 100644 --- a/drivers/gpu/drm/i915/display/intel_display_power.c +++ b/drivers/gpu/drm/i915/display/intel_display_power.c @@ -640,12 +640,6 @@ release_async_put_domains(struct i915_power_domains *power_domains, enum intel_display_power_domain domain; intel_wakeref_t wakeref; - /* - * The caller must hold already raw wakeref, upgrade that to a proper - * wakeref to make the state checker happy about the HW access during - * power well disabling. - */ - assert_rpm_raw_wakeref_held(rpm); wakeref = intel_runtime_pm_get_noresume(rpm); for_each_power_domain(domain, mask) { diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c index d4e844128826..2d0647aca964 100644 --- a/drivers/gpu/drm/i915/intel_runtime_pm.c +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c @@ -272,15 +272,11 @@ intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm) * intel_runtime_pm_get_noresume - grab a runtime pm reference * @rpm: the intel_runtime_pm structure * - * This function grabs a device-level runtime pm reference (mostly used for GEM - * code to ensure the GTT or GT is on). + * This function grabs a device-level runtime pm reference. * - * It will _not_ power up the device but instead only check that it's powered - * on. Therefore it is only valid to call this functions from contexts where - * the device is known to be powered up and where trying to power it up would - * result in hilarity and deadlocks. That pretty much means only the system - * suspend/resume code where this is used to grab runtime pm references for - * delayed setup down in work items. + * It will _not_ resume the device but instead only get an extra wakeref. + * Therefore it is only valid to call this functions from contexts where + * the device is known to be active and with another wakeref previously hold. * * Any runtime pm reference obtained by this function must have a symmetric * call to intel_runtime_pm_put() to release the reference again. @@ -289,7 +285,7 @@ intel_wakeref_t intel_runtime_pm_get_if_active(struct intel_runtime_pm *rpm) */ intel_wakeref_t intel_runtime_pm_get_noresume(struct intel_runtime_pm *rpm) { - assert_rpm_wakelock_held(rpm); + assert_rpm_raw_wakeref_held(rpm); pm_runtime_get_noresume(rpm->kdev); intel_runtime_pm_acquire(rpm, true);