tools/power turbostat: Increase default buffer size
diff mbox series

Message ID 20190514174621.12227-1-prarit@redhat.com
State Superseded
Delegated to: Len Brown
Headers show
Series
  • tools/power turbostat: Increase default buffer size
Related show

Commit Message

Prarit Bhargava May 14, 2019, 5:46 p.m. UTC
'turbostat -D' fails on INTEL_FAM6_KABYLAKE_DESKTOP systems with a
segfault because the default buffer size is too small.

Increase the default to 1536.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
---
 tools/power/x86/turbostat/turbostat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Prarit Bhargava May 15, 2019, 3:22 p.m. UTC | #1
On 5/14/19 1:46 PM, Prarit Bhargava wrote:
> 'turbostat -D' fails on INTEL_FAM6_KABYLAKE_DESKTOP systems with a
> segfault because the default buffer size is too small.
> 
> Increase the default to 1536.

Self-Nak.  I will post a dynamic allocation solution in a few minutes.

P.

> 
> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
> ---
>  tools/power/x86/turbostat/turbostat.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
> index c7727be9719f..b401d1aec394 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -5135,7 +5135,7 @@ int initialize_counters(int cpu_id)
>  
>  void allocate_output_buffer()
>  {
> -	output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
> +	output_buffer = calloc(1, (1 + topo.num_cpus) * 1536);
>  	outp = output_buffer;
>  	if (outp == NULL)
>  		err(-1, "calloc output buffer");
>

Patch
diff mbox series

diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index c7727be9719f..b401d1aec394 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -5135,7 +5135,7 @@  int initialize_counters(int cpu_id)
 
 void allocate_output_buffer()
 {
-	output_buffer = calloc(1, (1 + topo.num_cpus) * 1024);
+	output_buffer = calloc(1, (1 + topo.num_cpus) * 1536);
 	outp = output_buffer;
 	if (outp == NULL)
 		err(-1, "calloc output buffer");