From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D113E390CB7 for ; Thu, 30 Jul 2026 06:53:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785394394; cv=none; b=YpwfH0MiUCvrE2qkTg/nja2Q+viCizdDI5CrHQtpwZWo7fc/1pc6kjxzN7qh/iieyx3EGQuvXvXW8mSC1eleyX0jsghy+2GoyOwbAmYa4zRg4H5sAzOwPrIpXOA8vE3MNRzNxVPW0e4LwPaNSaXjgUsc2tHc8RAkASa8CobRsUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785394394; c=relaxed/simple; bh=kyq4Mqzqrl2ra4IUF4UXGWP5uLof/LqbTeeX8rQT3c8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=sLYKQsEM0Hu7RP7nojztPI7Q482hs04QrFG7jG4eOxdRGfa3591yov9hw5Dy71UApOQaC7pRe49i8V/KsvRZ24WuzgCj/MY6THsvFXkLjw5Z7epiqrKvr6A1pwAYnB9XJJfliK/dpyoyH49lgw2D82Y94YYRknHrHwBgA7BtX/k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=B4odKLdn; arc=none smtp.client-ip=209.85.208.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="B4odKLdn" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-39c83acb86eso14875281fa.1 for ; Wed, 29 Jul 2026 23:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785394389; x=1785999189; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=XRuFZ6h1uhegR6Sr4/10z/GSPpr/uGFR1omQDwMWmUQ=; b=B4odKLdnhwGFIO/EAJ+AeAxQ9LBx7VmbeNnPzz6CJj0JGq846gy1eE385xdIM73Ylu MVLTBafJn6mxxnkYHsGSx44/iBOTekEVAnAj5uQHLcmPTmArnKMaY5+IEP05SSsFu1Fv 044MwI0TErDXyFBsucMoaD7aQgsP1o0LqXS7DkJcL1dPpM46MHuQmW9vz9FIgbF0pqUb ZAjFMe4hKOqT931FsFHMr9W+yLLt2jyXlquq1Y4YxuDS2xB/Bt61phKPjBfFcSF82IUj sOK8bbXhtvEXcSt04QapKb8uDRuuhAvZ+Wx+MlSo7qR3hwGDxvfLQyM83PAGaIu/2Qoz YJSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785394389; x=1785999189; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=XRuFZ6h1uhegR6Sr4/10z/GSPpr/uGFR1omQDwMWmUQ=; b=lhVipEOIMpGCpOOFeBT0wQLmy8Nf5OPS894sraC9ioYI3dH7z4eu8PJJOP6jVV5kB3 JBknKjYC2mNUc/ta1BgzHNGb2gn+VjdTJE2LBOAtP1BgIYNlbHS7LWQjCpVdo+FYlJTs /etJ7uOd28s/7u4sQBosY245QC3aPxO4bmNOUODteCAEBTwmkEEpZ3RihRCEMsrPZIge 0Hss3Paz6oRNErk8luY7Td02GQaVnNjISj6sDVRfIMb4rKQIPnfOdXcxHjTuV2GgyVfI 49USHbbdX41ImDRD6gIfFNpNWSHmq2Cvan31JBOG2aCbFYP5vwCfBQJeW6gYpfdUYKUl tm1g== X-Forwarded-Encrypted: i=1; AHgh+RqTxFZzCM2f4kA2N9wBcd1mS/1s41+VFubNcfNOph6IkoBLGpOscGGb+yyLMoz5BnKpP2zudyGe9EVf/J8=@vger.kernel.org X-Gm-Message-State: AOJu0Ywl+B4A8rzcIDDB5+b1TSrA67YKPthbSaVtLOv5jj/dbUpNC0zH SXuGlTtZgQCQyJypSq5zxYI4PlK9sXCkLvlcvhRzxm7MCh6Ux4MuoBHS X-Gm-Gg: AR+sD10j8Q77XPIE+X4a0eKHG/5miGDZLU373PD7cGyZVjPhYIVnJr4CTAf23+F7VEU ihUavd2yXjh7SGmE0i1Kr/3pqdBGYw3BlKcAmWE5GhY9X2hiTnq2wVSsvQHp6MbXu41Tn6lTqBX YVIOlVHhJjyb9+cr7E8r4xhr2dkbVQ2JALQlPIE/S9Odz2/vyOTBtp8Eoc6V3S6UQ+iA9OYyqUF YbYosv3Sr/3kzcLSnU7bFydGCLtvK+f4LtQhJHrvl5m7KVdTOsBK2DKCR4MRD6Y4VIo0MHcZ4/R lfMMUCpaBvuk/zi9BIK+OsPlq5CfMedICNbvGl01k3WX6FrvDaAWozexyR8Barawu45MeELvbrr Q1xog7ZddgXWsnEOLsoVzJV8AHzHfkwUBOnrkF7xLfaHATCxcXvAl1KgAA5sdlDJ8lqx9/S6jqr epEE8A6vmQKXToasJqoke+snzq38ji5XrUWrBBqzWF4jFn09ePXdnkx76rN2FA586k9EtiuQBS7 ie+3GZYd70= X-Received: by 2002:a05:6512:2245:b0:5ae:c239:6a2c with SMTP id 2adb3069b0e04-5b2db380b43mr251021e87.53.1785394388845; Wed, 29 Jul 2026 23:53:08 -0700 (PDT) Received: from localhost ([188.234.148.119]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-39f6ac5ea80sm1635701fa.26.2026.07.29.23.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 23:53:07 -0700 (PDT) From: Mikhail Gavrilov To: amd-gfx@lists.freedesktop.org Cc: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Hung , Rafal Ostrowski , Dillon Varone , Bert Karwatzki , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org, Mikhail Gavrilov Subject: [PATCH] drm/amd/display: make DC_RUN_WITH_PREEMPTION_ENABLED misuse a build error Date: Thu, 30 Jul 2026 11:53:00 +0500 Message-ID: <20260730065300.2056809-1-mikhail.v.gavrilov@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Inside an FPU compilation unit DC_FP_START() and DC_FP_END() are defined as BUILD_BUG(), so using them there fails the build. That was done on purpose by commit a574f53ed52e ("drm/amd/display: Permit DC_FP_START/END only in non-FP compilation units"). DC_RUN_WITH_PREEMPTION_ENABLED() was added later by commit 3539437f354b ("drm/amd/display: Move FPU Guards From DML To DC - Part 1") and defined as a plain pass-through in that same branch instead. A wrap placed inside an FPU compilation unit therefore compiles cleanly, reads as correct during review, and does nothing at all. This is not hypothetical. While chasing a "scheduling while atomic" splat in dc_create_plane_state() on PREEMPT_RT, an attempt to place the guard further up the call chain, in dml21_add_phantom_plane() in dc/dml2_0/dml21/dml21_utils.c, had no effect for exactly this reason: dc/dml2_0/Makefile applies CC_FLAGS_FPU to every object under that directory, and the top level Makefile adds -D_LINUX_FPU_COMPILATION_UNIT to CC_FLAGS_FPU. Define the macro as BUILD_BUG() there as well, so that the mistake is a compile error rather than a guard that silently does nothing. The code argument is kept in the expansion so the BUILD_BUG() failure is not accompanied by set-but-unused diagnostics for variables assigned inside it. No current user is affected. dc/core/dc_stream.c and dc/resource/dcn32/dcn32_resource.c are outside the dml directories, and dc/dml2_0/dml2_wrapper.c and dc/dml2_0/dml21/dml21_wrapper.c are built without the FPU flags because dc/dml2_0/Makefile replaces their CFLAGS with CC_FLAGS_NO_FPU and removes CC_FLAGS_FPU. Link: https://lore.kernel.org/all/1ead313022bc62dce1f42af9f855727eb9074443.camel@web.de/ Signed-off-by: Mikhail Gavrilov --- This is a build-time change, so there is nothing to reproduce at runtime. Verified in both directions on x86_64 with CONFIG_DRM_AMD_DC_FP=y, by adding DC_RUN_WITH_PREEMPTION_ENABLED((void)0); to dcn10_resource_construct_fp() in dc/dml/dcn10/dcn10_fpu.c, which is compiled with CC_FLAGS_FPU and already includes dc_fpu.h. Without the patch 'make drivers/gpu/drm/amd/amdgpu/' compiles that file and the whole module links, so the guard is silently ineffective. With the patch the build stops there: dcn10_fpu.c: In function 'dcn10_resource_construct_fp': include/linux/compiler_types.h:702:45: error: call to '__compiletime_assert_524' declared with attribute error: BUILD_BUG failed dc_fpu.h:56:17: note: in expansion of macro 'BUILD_BUG' dcn10_fpu.c:129:9: note: in expansion of macro 'DC_RUN_WITH_PREEMPTION_ENABLED' No set-but-unused diagnostics accompany it. Removing the added line builds cleanly again. drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h index 5e95419d3798..e89b39a4aa83 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.h @@ -51,7 +51,11 @@ void dc_fpu_end(const char *function_name, const int line); #else #define DC_FP_START() BUILD_BUG() #define DC_FP_END() BUILD_BUG() -#define DC_RUN_WITH_PREEMPTION_ENABLED(code) code +#define DC_RUN_WITH_PREEMPTION_ENABLED(code) \ + do { \ + BUILD_BUG(); \ + code; \ + } while (0) #endif // !_LINUX_FPU_COMPILATION_UNIT #endif /* __DC_FPU_H__ */ -- 2.55.0