[Skiboot] [PATCH] core/cpu: Fix memory allocation for job array

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Sep 3 15:41:49 AEST 2018


On 09/03/2018 11:05 AM, Vasant Hegde wrote:
> On 09/02/2018 03:29 PM, Vaidyanathan Srinivasan wrote:
>> fixes: 7a3f307e core/cpu: parallelise global CPU register setting jobs
>>
>> This bug would result in boot-hang on some configurations due to
>> cpu_wait_job() endlessly waiting for the last bogus jobs[cpu->pir] pointer.
>>
>> Reported-by: Stephanie Swanson <swanman at us.ibm.com>
>> Reported-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
>> Signed-off-by: Vaidyanathan Srinivasan <svaidy at linux.vnet.ibm.com>
> 
> Good catch. I had gone through this code at least twice .. Somehow this didn't 
> strike me.
> 
> Reviewed-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>

We have similar issue in cpu_cleanup_all() as well. Can you include below changes ?


diff --git a/core/cpu.c b/core/cpu.c
index 88477f821..2813360b4 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -1424,7 +1424,7 @@ static int64_t cpu_cleanup_all(void)
         struct cpu_thread *cpu;
         struct cpu_job **jobs;

-       jobs = zalloc(sizeof(struct cpu_job *) * cpu_max_pir + 1);
+       jobs = zalloc(sizeof(struct cpu_job *) * (cpu_max_pir + 1));
         assert(jobs);

         for_each_available_cpu(cpu) {


-Vasant



More information about the Skiboot mailing list