From patchwork Thu Jun 13 10:20:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13696575 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 4A6C6C27C7B for ; Thu, 13 Jun 2024 10:28:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 720B310EA21; Thu, 13 Jun 2024 10:28:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.b="g6bo0wpT"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="O/i5dtYk"; dkim-atps=neutral Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64A9A10EA11; Thu, 13 Jun 2024 10:28:28 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718274506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AA2zfxjtkVY5UVBSS4SHCEYagP/l342CiKwYNj0Le48=; b=g6bo0wpTAx3SpwWMk0Ai6ouTNno1Eez5G0zFr/nt34tPxJBAmFgH8hQ/9QkU9T4f9lHIUu kQt8i5OU5TaioDKCrjOtmFrzn+5q0WJ3lio3v2aAjBhdwH58VgIkg9AuolILykteuC7gnY sRwtEYFGMDLJhDLTC8EYyzvqTe130NhvFzywU1/jyae+ZCCnj46xUH6uk0f+GOgc9Xu/AQ EBc9zbvsfXxsFLYPsYly2togpXYt7KxRjWC2qy3jhGp+WWPGuxRMiI/rVSo7kwSJx2gPfi EccQi08TiAFoyQ5Oj65hJjTGeouKfiZZKa1tqmmf/9W27f+5mqkebZgBMSCsug== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718274506; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AA2zfxjtkVY5UVBSS4SHCEYagP/l342CiKwYNj0Le48=; b=O/i5dtYk9bA9+0YfJNJWCwqvQ/iYEdhuLFyH39wNC8G/Wakdf2i2lIp5agIyhf6T7McBPL xo60bxqbyyHNPkBg== To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Thomas Gleixner , Tvrtko Ursulin , Sebastian Andrzej Siewior , "John B. Wyatt IV" Subject: [PATCH v2 7/8] drm/i915/guc: Consider also RCU depth in busy loop. Date: Thu, 13 Jun 2024 12:20:24 +0200 Message-ID: <20240613102818.4056866-8-bigeasy@linutronix.de> In-Reply-To: <20240613102818.4056866-1-bigeasy@linutronix.de> References: <20240613102818.4056866-1-bigeasy@linutronix.de> MIME-Version: 1.0 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" intel_guc_send_busy_loop() looks at in_atomic() and irqs_disabled() to decide if it should busy-spin while waiting or if it may sleep. Both checks will report false on PREEMPT_RT if sleeping spinlocks are acquired leading to RCU splats while the function sleeps. Check also if RCU has been disabled. Reported-by: "John B. Wyatt IV" Reviewed-by: Rodrigo Vivi Signed-off-by: Sebastian Andrzej Siewior --- drivers/gpu/drm/i915/gt/uc/intel_guc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc.h b/drivers/gpu/drm/i915/gt/uc/intel_guc.h index 57b9031327767..ff213b79ba83d 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc.h +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc.h @@ -362,7 +362,7 @@ static inline int intel_guc_send_busy_loop(struct intel_guc *guc, { int err; unsigned int sleep_period_ms = 1; - bool not_atomic = !in_atomic() && !irqs_disabled(); + bool not_atomic = !in_atomic() && !irqs_disabled() && !rcu_preempt_depth(); /* * FIXME: Have caller pass in if we are in an atomic context to avoid