Re: [PATCH v4 09/11] powerpc/perf: add support for the hv 24x7 interface

Ian Munsie
2014-05-22T08:19:40Z

Hi Cody,

I just tried building this with gcc 4.5, which failed with the following
warning (treated as an error):

cc1: warnings being treated as errors
arch/powerpc/perf/hv-24x7.c: In function 'single_24x7_request':
arch/powerpc/perf/hv-24x7.c:346:1: error: the frame size of 8192 bytes is larger than 2048 bytes
make[3]: *** [arch/powerpc/perf/hv-24x7.o] Error 1
make[2]: *** [arch/powerpc/perf] Error 2

My .config has CONFIG_FRAME_WARN=2048 (default on 64bit), but the
alignment constraints in this function may require 8K on the stack -
possibly a bit large?

Notably for some reason this warning no longer seems to trigger on gcc
4.8 (or at least somewhere between 4.5-4.8), though the assembly does
still show it aligning the buffers.

Excerpts from Cody P Schafer's message of 2014-03-06 11:01:08 +1100:
> +static unsigned long single_24x7_request(u8 domain, u32 offset, u16 ix,
<snip>
> + /*
> + * request_buffer and result_buffer are not required to be 4k aligned,
> + * but are not allowed to cross any 4k boundary. Aligning them to 4k is
> + * the simplest way to ensure that.
> + */
> + struct reqb {
> + struct hv_24x7_request_buffer buf;
> + struct hv_24x7_request req;
> + } __packed __aligned(4096) request_buffer = {
<snip>
> + struct resb {
> + struct hv_24x7_data_result_buffer buf;
> + struct hv_24x7_result res;
> + struct hv_24x7_result_element elem;
> + __be64 result;
> + } __packed __aligned(4096) result_buffer = {};
<snip>

Cheers,
-Ian