From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9349D1779B1; Tue, 8 Oct 2024 12:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391021; cv=none; b=bfJMwa7qVhxs+ixcW4sGKel2Kee1dUSa/H0kdokGhNCpVa6QWfjP3GaVn10a1Sv25cky12T3Nr0Josw311AQTKxLAD5GDionpi60/SYUOUhrvsybM000u8L4H4ROTL16VGtBAhTHJtD1wpfB6pnw+nhJapH90LjKTetho0thioM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391021; c=relaxed/simple; bh=y0qBjbqnKRibzQoLDPeTR7m4kAeHD3iSvq0t7eQfdPQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ogtC2jOrIl8i5VPnPPc5ufHgVhyUt6jrnuJKeAY9nqSmOI7v0AdpVzZEHA2z2hmpSs0unFb88AVWyU5webe/ZJRFa5IpNPNj/SiPVzKCARBzDPT0JJ8A5TIgxKldL8+0t4Cuivr6KrcGX6RfiCeP1nevemY7oI/7Mnh1v5mjIwI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HhgfC5VZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HhgfC5VZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85CFBC4CEC7; Tue, 8 Oct 2024 12:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391021; bh=y0qBjbqnKRibzQoLDPeTR7m4kAeHD3iSvq0t7eQfdPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HhgfC5VZEomb0b227GbHjQuvIXvHAFwiRzQO43WVTNMlLpzdoDwyVJU0b3bPutadf VzM45bUJJQq8dHQ84ZdY+sWUsaxZYWBVABe46tYqgqTYB/Q+Y0AvnMS2s9E51/b0xz eu3ni8mXqVNSWxejPTfron1lLwy0LleEWTLa9VXQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Matthew Auld , Rodrigo Vivi , Anshuman Gupta , Andi Shyti , Nathan Chancellor , Jani Nikula , Joonas Lahtinen Subject: [PATCH 6.10 435/482] drm/i915/gem: fix bitwise and logical AND mixup Date: Tue, 8 Oct 2024 14:08:18 +0200 Message-ID: <20241008115705.642595887@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115648.280954295@linuxfoundation.org> References: <20241008115648.280954295@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jani Nikula commit 394b52462020b6cceff1f7f47fdebd03589574f3 upstream. CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND is an int, defaulting to 250. When the wakeref is non-zero, it's either -1 or a dynamically allocated pointer, depending on CONFIG_DRM_I915_DEBUG_RUNTIME_PM. It's likely that the code works by coincidence with the bitwise AND, but with CONFIG_DRM_I915_DEBUG_RUNTIME_PM=y, there's the off chance that the condition evaluates to false, and intel_wakeref_auto() doesn't get called. Switch to the intended logical AND. v2: Use != to avoid clang -Wconstant-logical-operand (Nathan) Fixes: ad74457a6b5a ("drm/i915/dgfx: Release mmap on rpm suspend") Cc: Matthew Auld Cc: Rodrigo Vivi Cc: Anshuman Gupta Cc: Andi Shyti Cc: Nathan Chancellor Cc: stable@vger.kernel.org # v6.1+ Reviewed-by: Matthew Auld Reviewed-by: Andi Shyti # v1 Link: https://patchwork.freedesktop.org/patch/msgid/643cc0a4d12f47fd8403d42581e83b1e9c4543c7.1726680898.git.jani.nikula@intel.com Signed-off-by: Jani Nikula (cherry picked from commit 4c1bfe259ed1d2ade826f95d437e1c41b274df04) Signed-off-by: Joonas Lahtinen Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -1131,7 +1131,7 @@ static vm_fault_t vm_fault_ttm(struct vm GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource)); } - if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) + if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0) intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref, msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND));