* [PATCH] drm/amd/display: Explicitly set stack size to 4
@ 2020-07-21 15:38 Kent Russell
2020-07-21 16:01 ` Kazlauskas, Nicholas
2020-07-21 16:03 ` Felix Kuehling
0 siblings, 2 replies; 4+ messages in thread
From: Kent Russell @ 2020-07-21 15:38 UTC (permalink / raw)
To: amd-gfx; +Cc: Kent Russell
In certain kernels using GCC 8.2, we get compilation errors saying:
-mpreferred-stack-boundary=3 is not between 4 and 12
Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles,
even when SSE2 is enabled
Change-Id: Ic7c4637e2e521af2d0444d3b5886f710131c80ca
Signed-off-by: Kent Russell <kent.russell@amd.com>
---
drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++----
drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++----
drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++----
drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++----
drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++----
drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++----
6 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
index 4674aca8f206..5c519cec9039 100644
--- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
@@ -26,7 +26,9 @@
#
ifdef CONFIG_X86
-calcs_ccflags := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
endif
ifdef CONFIG_PPC64
@@ -40,12 +42,10 @@ endif
endif
ifdef CONFIG_X86
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-calcs_ccflags += -mpreferred-stack-boundary=4
-else
calcs_ccflags += -msse2
endif
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
index 5fcaf78334ff..78d3e0563a4c 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
@@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
DCN20 += dcn20_dsc.o
ifdef CONFIG_X86
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
endif
ifdef CONFIG_PPC64
@@ -24,12 +26,10 @@ endif
endif
ifdef CONFIG_X86
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
-else
CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
endif
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
index 07684d3e375a..6183e8f141bb 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
@@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
dcn21_hwseq.o dcn21_link_encoder.o
ifdef CONFIG_X86
-CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
endif
ifdef CONFIG_PPC64
@@ -20,12 +22,10 @@ endif
endif
ifdef CONFIG_X86
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
-else
CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
endif
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
index 025637a83c3b..0d803486e051 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
@@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
IS_OLD_GCC = 1
endif
endif
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
-else
CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
index 417331438c30..fc5e304c4dac 100644
--- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
@@ -25,8 +25,11 @@
# It provides the general basic services required by other DAL
# subcomponents.
+
ifdef CONFIG_X86
-dml_ccflags := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
endif
ifdef CONFIG_PPC64
@@ -40,12 +43,10 @@ endif
endif
ifdef CONFIG_X86
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-dml_ccflags += -mpreferred-stack-boundary=4
-else
dml_ccflags += -msse2
endif
endif
diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
index ea29cf95d470..98695c66eaf1 100644
--- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
@@ -3,7 +3,9 @@
# Makefile for the 'dsc' sub-component of DAL.
ifdef CONFIG_X86
-dsc_ccflags := -mhard-float -msse
+# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
+# to 4, even if we enable SSE2
+dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
endif
ifdef CONFIG_PPC64
@@ -17,12 +19,10 @@ endif
endif
ifdef CONFIG_X86
-ifdef IS_OLD_GCC
+ifndef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
# (8B stack alignment).
-dsc_ccflags += -mpreferred-stack-boundary=4
-else
dsc_ccflags += -msse2
endif
endif
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: Explicitly set stack size to 4
2020-07-21 15:38 [PATCH] drm/amd/display: Explicitly set stack size to 4 Kent Russell
@ 2020-07-21 16:01 ` Kazlauskas, Nicholas
2020-07-21 16:03 ` Felix Kuehling
1 sibling, 0 replies; 4+ messages in thread
From: Kazlauskas, Nicholas @ 2020-07-21 16:01 UTC (permalink / raw)
To: Kent Russell, amd-gfx
On 2020-07-21 11:38 a.m., Kent Russell wrote:
> In certain kernels using GCC 8.2, we get compilation errors saying:
> -mpreferred-stack-boundary=3 is not between 4 and 12
> Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles,
> even when SSE2 is enabled
>
> Change-Id: Ic7c4637e2e521af2d0444d3b5886f710131c80ca
> Signed-off-by: Kent Russell <kent.russell@amd.com>
Seems reasonable to me. I'd imagine we want this anyway since SIMD
generally wants to be 16-byte aligned anyway and this code has FP in it.
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Regards,
Nicholas Kazlauskas
> ---
> drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++----
> drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++----
> 6 files changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> index 4674aca8f206..5c519cec9039 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> @@ -26,7 +26,9 @@
> #
>
> ifdef CONFIG_X86
> -calcs_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -40,12 +42,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -calcs_ccflags += -mpreferred-stack-boundary=4
> -else
> calcs_ccflags += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> index 5fcaf78334ff..78d3e0563a4c 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> @@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
> DCN20 += dcn20_dsc.o
>
> ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -24,12 +26,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> index 07684d3e375a..6183e8f141bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> @@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
> dcn21_hwseq.o dcn21_link_encoder.o
>
> ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -20,12 +22,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> index 025637a83c3b..0d803486e051 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> @@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
>
> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
>
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> ifdef CONFIG_CC_IS_GCC
> ifeq ($(call cc-ifversion, -lt, 0701, y), y)
> IS_OLD_GCC = 1
> endif
> endif
>
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
> endif
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 417331438c30..fc5e304c4dac 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -25,8 +25,11 @@
> # It provides the general basic services required by other DAL
> # subcomponents.
>
> +
> ifdef CONFIG_X86
> -dml_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -40,12 +43,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -dml_ccflags += -mpreferred-stack-boundary=4
> -else
> dml_ccflags += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> index ea29cf95d470..98695c66eaf1 100644
> --- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> @@ -3,7 +3,9 @@
> # Makefile for the 'dsc' sub-component of DAL.
>
> ifdef CONFIG_X86
> -dsc_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -17,12 +19,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -dsc_ccflags += -mpreferred-stack-boundary=4
> -else
> dsc_ccflags += -msse2
> endif
> endif
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: Explicitly set stack size to 4
2020-07-21 15:38 [PATCH] drm/amd/display: Explicitly set stack size to 4 Kent Russell
2020-07-21 16:01 ` Kazlauskas, Nicholas
@ 2020-07-21 16:03 ` Felix Kuehling
2020-07-21 16:08 ` Kazlauskas, Nicholas
1 sibling, 1 reply; 4+ messages in thread
From: Felix Kuehling @ 2020-07-21 16:03 UTC (permalink / raw)
To: Kent Russell, amd-gfx
Am 2020-07-21 um 11:38 a.m. schrieb Kent Russell:
> In certain kernels using GCC 8.2, we get compilation errors saying:
> -mpreferred-stack-boundary=3 is not between 4 and 12
> Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles,
> even when SSE2 is enabled
As I understand it, -mpreferred-stack-boundary does not affect the stack
size, but the alignment of the stack frame.
The GCC manpage explains that mixing different stack boundary settings
can lead to errors when functions compiled with stack-boundary=3 call
functions with stack-boundary=4. That sounds like setting a different
stack boundary explicitly in only some parts of the code is probably a
bad idea.
Quote from the gcc mangage:
> Warning: When generating code for the x86-64 architecture
> with SSE
> extensions disabled, -mpreferred-stack-boundary=3 can be
> used to
> keep the stack boundary aligned to 8 byte boundary. Since
> x86-64
> ABI require 16 byte stack alignment, this is ABI
> incompatible and
> intended to be used in controlled environment where stack
> space is
> important limitation. This option leads to wrong code when
> functions compiled with 16 byte stack alignment (such as
> functions
> from a standard library) are called with misaligned stack.
> In this
> case, SSE instructions may lead to misaligned memory access
> traps.
> In addition, variable arguments are handled incorrectly for
> 16 byte
> aligned objects (including x87 long double and __int128),
> leading
> to wrong results. You must build all modules with
> -mpreferred-stack-boundary=3, including any libraries. This
> includes the system libraries and startup modules.
Regards,
Felix
>
> Change-Id: Ic7c4637e2e521af2d0444d3b5886f710131c80ca
> Signed-off-by: Kent Russell <kent.russell@amd.com>
> ---
> drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++----
> drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++----
> drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++----
> 6 files changed, 25 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> index 4674aca8f206..5c519cec9039 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> @@ -26,7 +26,9 @@
> #
>
> ifdef CONFIG_X86
> -calcs_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -40,12 +42,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -calcs_ccflags += -mpreferred-stack-boundary=4
> -else
> calcs_ccflags += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> index 5fcaf78334ff..78d3e0563a4c 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> @@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
> DCN20 += dcn20_dsc.o
>
> ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -24,12 +26,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> index 07684d3e375a..6183e8f141bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> @@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
> dcn21_hwseq.o dcn21_link_encoder.o
>
> ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -20,12 +22,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> index 025637a83c3b..0d803486e051 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> @@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
>
> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
>
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
> ifdef CONFIG_CC_IS_GCC
> ifeq ($(call cc-ifversion, -lt, 0701, y), y)
> IS_OLD_GCC = 1
> endif
> endif
>
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
> -else
> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
> endif
>
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 417331438c30..fc5e304c4dac 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -25,8 +25,11 @@
> # It provides the general basic services required by other DAL
> # subcomponents.
>
> +
> ifdef CONFIG_X86
> -dml_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -40,12 +43,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -dml_ccflags += -mpreferred-stack-boundary=4
> -else
> dml_ccflags += -msse2
> endif
> endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> index ea29cf95d470..98695c66eaf1 100644
> --- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> @@ -3,7 +3,9 @@
> # Makefile for the 'dsc' sub-component of DAL.
>
> ifdef CONFIG_X86
> -dsc_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
> endif
>
> ifdef CONFIG_PPC64
> @@ -17,12 +19,10 @@ endif
> endif
>
> ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
> # Stack alignment mismatch, proceed with caution.
> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
> # (8B stack alignment).
> -dsc_ccflags += -mpreferred-stack-boundary=4
> -else
> dsc_ccflags += -msse2
> endif
> endif
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amd/display: Explicitly set stack size to 4
2020-07-21 16:03 ` Felix Kuehling
@ 2020-07-21 16:08 ` Kazlauskas, Nicholas
0 siblings, 0 replies; 4+ messages in thread
From: Kazlauskas, Nicholas @ 2020-07-21 16:08 UTC (permalink / raw)
To: Felix Kuehling, Kent Russell, amd-gfx
On 2020-07-21 12:03 p.m., Felix Kuehling wrote:
> Am 2020-07-21 um 11:38 a.m. schrieb Kent Russell:
>> In certain kernels using GCC 8.2, we get compilation errors saying:
>> -mpreferred-stack-boundary=3 is not between 4 and 12
>> Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles,
>> even when SSE2 is enabled
>
> As I understand it, -mpreferred-stack-boundary does not affect the stack
> size, but the alignment of the stack frame.
>
> The GCC manpage explains that mixing different stack boundary settings
> can lead to errors when functions compiled with stack-boundary=3 call
> functions with stack-boundary=4. That sounds like setting a different
> stack boundary explicitly in only some parts of the code is probably a
> bad idea.
>
> Quote from the gcc mangage:
>
>> Warning: When generating code for the x86-64 architecture
>> with SSE
>> extensions disabled, -mpreferred-stack-boundary=3 can be
>> used to
>> keep the stack boundary aligned to 8 byte boundary. Since
>> x86-64
>> ABI require 16 byte stack alignment, this is ABI
>> incompatible and
>> intended to be used in controlled environment where stack
>> space is
>> important limitation. This option leads to wrong code when
>> functions compiled with 16 byte stack alignment (such as
>> functions
>> from a standard library) are called with misaligned stack.
>> In this
>> case, SSE instructions may lead to misaligned memory access
>> traps.
>> In addition, variable arguments are handled incorrectly for
>> 16 byte
>> aligned objects (including x87 long double and __int128),
>> leading
>> to wrong results. You must build all modules with
>> -mpreferred-stack-boundary=3, including any libraries. This
>> includes the system libraries and startup modules.
>
> Regards,
> Felix
Oh right, I remember that this issue was brought up before.
https://github.com/ClangBuiltLinux/linux/issues/735
I don't think we want to be mixing alignment then. Maybe let's hold off
on this change for now and figure out if we still need this flag set at
all for GCC 8.2 onward.
like
#ifndef GCC82
ccflags += -mpreferred-stack-boundary=3
#endif
Regards,
Nicholas Kazlauskas
>
>
>>
>> Change-Id: Ic7c4637e2e521af2d0444d3b5886f710131c80ca
>> Signed-off-by: Kent Russell <kent.russell@amd.com>
>> ---
>> drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++----
>> drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++----
>> drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++----
>> drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++----
>> drivers/gpu/drm/amd/display/dc/dml/Makefile | 9 +++++----
>> drivers/gpu/drm/amd/display/dc/dsc/Makefile | 8 ++++----
>> 6 files changed, 25 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
>> index 4674aca8f206..5c519cec9039 100644
>> --- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
>> @@ -26,7 +26,9 @@
>> #
>>
>> ifdef CONFIG_X86
>> -calcs_ccflags := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>> endif
>>
>> ifdef CONFIG_PPC64
>> @@ -40,12 +42,10 @@ endif
>> endif
>>
>> ifdef CONFIG_X86
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -calcs_ccflags += -mpreferred-stack-boundary=4
>> -else
>> calcs_ccflags += -msse2
>> endif
>> endif
>> diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
>> index 5fcaf78334ff..78d3e0563a4c 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
>> @@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
>> DCN20 += dcn20_dsc.o
>>
>> ifdef CONFIG_X86
>> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>> endif
>>
>> ifdef CONFIG_PPC64
>> @@ -24,12 +26,10 @@ endif
>> endif
>>
>> ifdef CONFIG_X86
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
>> -else
>> CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
>> endif
>> endif
>> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
>> index 07684d3e375a..6183e8f141bb 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
>> @@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
>> dcn21_hwseq.o dcn21_link_encoder.o
>>
>> ifdef CONFIG_X86
>> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>> endif
>>
>> ifdef CONFIG_PPC64
>> @@ -20,12 +22,10 @@ endif
>> endif
>>
>> ifdef CONFIG_X86
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
>> -else
>> CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
>> endif
>> endif
>> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
>> index 025637a83c3b..0d803486e051 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
>> @@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
>>
>> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
>>
>> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>> ifdef CONFIG_CC_IS_GCC
>> ifeq ($(call cc-ifversion, -lt, 0701, y), y)
>> IS_OLD_GCC = 1
>> endif
>> endif
>>
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
>> -else
>> CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
>> endif
>>
>> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
>> index 417331438c30..fc5e304c4dac 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
>> @@ -25,8 +25,11 @@
>> # It provides the general basic services required by other DAL
>> # subcomponents.
>>
>> +
>> ifdef CONFIG_X86
>> -dml_ccflags := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>> endif
>>
>> ifdef CONFIG_PPC64
>> @@ -40,12 +43,10 @@ endif
>> endif
>>
>> ifdef CONFIG_X86
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -dml_ccflags += -mpreferred-stack-boundary=4
>> -else
>> dml_ccflags += -msse2
>> endif
>> endif
>> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
>> index ea29cf95d470..98695c66eaf1 100644
>> --- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
>> +++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
>> @@ -3,7 +3,9 @@
>> # Makefile for the 'dsc' sub-component of DAL.
>>
>> ifdef CONFIG_X86
>> -dsc_ccflags := -mhard-float -msse
>> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
>> +# to 4, even if we enable SSE2
>> +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>> endif
>>
>> ifdef CONFIG_PPC64
>> @@ -17,12 +19,10 @@ endif
>> endif
>>
>> ifdef CONFIG_X86
>> -ifdef IS_OLD_GCC
>> +ifndef IS_OLD_GCC
>> # Stack alignment mismatch, proceed with caution.
>> # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>> # (8B stack alignment).
>> -dsc_ccflags += -mpreferred-stack-boundary=4
>> -else
>> dsc_ccflags += -msse2
>> endif
>> endif
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-21 16:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-21 15:38 [PATCH] drm/amd/display: Explicitly set stack size to 4 Kent Russell
2020-07-21 16:01 ` Kazlauskas, Nicholas
2020-07-21 16:03 ` Felix Kuehling
2020-07-21 16:08 ` Kazlauskas, Nicholas
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.