cpu/x86: Make MP init timeout configurable

The current MP init timeout is hardcoded as 1s. To support
platform with many cpus, the timeout needs to be adjusted.
The number of cpus is calculated as:
number of sockets * number of cores per socket *
  number of threads per core

How long the timeout should be set to, is heuristic.
It needs to be set long enough to ensure reboot stability,
but not unreasonable so that real failures can be detected
soon enough, especially for smaller systems.

This patch sets timeout to be minimum as 1 second, while each
cpu adds 0.1 second.

Signed-off-by: Jonathan Zhang <jonzhang@fb.com>
Signed-off-by: Reddy Chagam <anjaneya.chagam@intel.com>
Change-Id: Ibc079fc6aa8641d4ac8d8e726899b6c8d055052e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/38546
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
This commit is contained in:
Jonathan Zhang 2020-01-16 11:11:09 -08:00 committed by Patrick Georgi
parent 3d2e18ad50
commit 6ec322ec7c
1 changed files with 6 additions and 4 deletions

View File

@ -13,6 +13,7 @@
*/
#include <console/console.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <rmodule.h>
@ -518,11 +519,12 @@ static int bsp_do_flight_plan(struct mp_params *mp_params)
int i;
int ret = 0;
/*
* Set time-out to wait for APs to a huge value (=1 second) since it
* could take a longer time for APs to check-in as the number of APs
* increases (contention for resources like UART also increases).
* Set time out for flight plan to a huge minimum value (>=1 second).
* CPUs with many APs may take longer if there is contention for
* resources such as UART, so scale the time out up by increments of
* 100ms if needed.
*/
const int timeout_us = 1000000;
const int timeout_us = MAX(1000000, 100000 * mp_params->num_cpus);
const int step_us = 100;
int num_aps = mp_params->num_cpus - 1;
struct stopwatch sw;