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 <ttynkkynen@nvidia.com>
Reviewed-on: http://git-master/r/448914
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
Tested-by: Juha Tukkinen <jtukkinen@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Tuomas Tynkkynen
2014-07-30 20:06:57 +03:00
committed by Dan Willemsen
parent b3e023a805
commit e51f76f1c0

View File

@@ -3,7 +3,7 @@
* *
* GK20A memory kind management * 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 * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * 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. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/compiler.h>
#include "hw_gmmu_gk20a.h" #include "hw_gmmu_gk20a.h"
#include "kind_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); 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 */ /* 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) || return gk20a_kind_work_creation(k) ||
(k == gmmu_pte_kind_invalid_v()) || (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()); (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() && return (k >= gmmu_pte_kind_z16_v() &&
k <= gmmu_pte_kind_v8z24_ms8_vc24_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())*/; 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) || return gk20a_kind_work_creation(k) ||
(k == gmmu_pte_kind_pitch_v()) || (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()); 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() && return (k >= gmmu_pte_kind_z16_2c_v() &&
k <= gmmu_pte_kind_z16_ms16_4cz_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()); 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() && return (k >= gmmu_pte_kind_z16_2c_v() &&
k <= gmmu_pte_kind_z16_ms16_2c_v()) || k <= gmmu_pte_kind_z16_ms16_2c_v()) ||