From b3d6c63df059929782b759775fff4b52a2be4462 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 14 Dec 2021 17:22:37 +0000 Subject: [PATCH] more timing debug Let's see how much is in the x86 code waking it up, and how much is just waiting for it. --- kernel/cpu.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 9979f670501b0..971f38a389dac 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -586,20 +586,28 @@ static int bringup_cpu(unsigned int cpu) { struct task_struct *idle = idle_thread_get(cpu); int ret; - + cycles_t t[3]; /* * Some architectures have to walk the irq descriptors to * setup the vector space for the cpu which comes online. * Prevent irq alloc/free across the bringup. */ + t[0] = get_cycles(); irq_lock_sparse(); /* Arch-specific enabling code. */ ret = __cpu_up(cpu, idle); irq_unlock_sparse(); + t[1] = get_cycles(); if (ret) return ret; - return bringup_wait_for_ap(cpu); + + ret = bringup_wait_for_ap(cpu); + t[2] = get_cycles(); + + printk("Bringup CPU %d took %lld, %lld cycles\n", cpu, + t[1] - t[0], t[2] - t[1]); + return ret; } static int finish_cpu(unsigned int cpu) -- 2.50.1