Skip to contentSkip to conversation

tools/power turbostat: Increase default buffer size

PATCH In review Prarit Bhargava 1 participant 2 messages May 14, 2019 – May 15, 2019 Turbostat utility

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/power turbostat: Increase default buffer size

'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.

---
 tools/power/x86/turbostat/turbostat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +1 -1
index c7727be9719f..b401d1aec394 100644
@@ -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");
Signature · 1 line
2.21.0
#1 lore raw
Quoted 4 lines · Prarit Bhargava

'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.

Quoted 20 lines
---
 tools/power/x86/turbostat/turbostat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/power/x86/turbostat/turbostat.c +1 -1
index c7727be9719f..b401d1aec394 100644
@@ -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");