From e51f76f1c0f8fa4affb5fac538df12a83095721d Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Wed, 30 Jul 2014 20:06:57 +0300 Subject: gpu: nvgpu: Use noinline_for_stack to avoid GCOV build break If code coverage is enabled on GCC 4.7, the kernel build fails in gk20a_init_kind_attr() since GCC decides to inline almost everything in this file into it, leading to a massive stack frame with over kilobyte's worth of temporary variables generated by gcov, leading to this error: kind_gk20a.c: In function 'gk20a_init_kind_attr': kind_gk20a.c:424:1: error: the frame size of 1232 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] (Just removing the inline keyword doesn't work, as GCC still decides to inline it, so noinline_for_stack is actually required.) Change-Id: I819fd2a5b20581f0ac60e1ee490899c977379151 Signed-off-by: Tuomas Tynkkynen Reviewed-on: http://git-master/r/448914 Reviewed-by: Juha Tukkinen Tested-by: Juha Tukkinen Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/kind_gk20a.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/kind_gk20a.c b/drivers/gpu/nvgpu/gk20a/kind_gk20a.c index b0a74056..b76fdfcf 100644 --- a/drivers/gpu/nvgpu/gk20a/kind_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/kind_gk20a.c @@ -3,7 +3,7 @@ * * GK20A memory kind management * - * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -19,6 +19,7 @@ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. */ #include +#include #include "hw_gmmu_gk20a.h" #include "kind_gk20a.h" @@ -41,8 +42,14 @@ static inline bool gk20a_kind_work_creation(u8 k) gk20a_kind_work_creation_host(k); } +/* + * Use noinline_for_stack for these huge functions, otherwise GCC 4.7 will + * blow up when building a coverage-enabled kernel. (error: the frame size of + * 1232 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]) + */ + /* note: taken from the !2cs_compression case */ -static inline bool gk20a_kind_supported(u8 k) +static noinline_for_stack bool gk20a_kind_supported(u8 k) { return gk20a_kind_work_creation(k) || (k == gmmu_pte_kind_invalid_v()) || @@ -91,7 +98,7 @@ static inline bool gk20a_kind_supported(u8 k) (k == gmmu_pte_kind_pitch_no_swizzle_v()); } -static inline bool gk20a_kind_z(u8 k) +static noinline_for_stack bool gk20a_kind_z(u8 k) { return (k >= gmmu_pte_kind_z16_v() && k <= gmmu_pte_kind_v8z24_ms8_vc24_v()) || @@ -112,7 +119,7 @@ static inline bool gk20a_kind_z(u8 k) k <= gmmu_pte_kind_xf32_x24s8_ms16_2cs_v())*/; } -static inline bool gk20a_kind_c(u8 k) +static noinline_for_stack bool gk20a_kind_c(u8 k) { return gk20a_kind_work_creation(k) || (k == gmmu_pte_kind_pitch_v()) || @@ -127,7 +134,7 @@ static inline bool gk20a_kind_c(u8 k) k <= gmmu_pte_kind_pitch_no_swizzle_v()); } -static inline bool gk20a_kind_compressible(u8 k) +static noinline_for_stack bool gk20a_kind_compressible(u8 k) { return (k >= gmmu_pte_kind_z16_2c_v() && k <= gmmu_pte_kind_z16_ms16_4cz_v()) || @@ -165,7 +172,7 @@ static inline bool gk20a_kind_compressible(u8 k) k <= gmmu_pte_kind_c128_ms8_ms16_2cr_v()); } -static inline bool gk20a_kind_zbc(u8 k) +static noinline_for_stack bool gk20a_kind_zbc(u8 k) { return (k >= gmmu_pte_kind_z16_2c_v() && k <= gmmu_pte_kind_z16_ms16_2c_v()) || -- cgit v1.2.2