[Skiboot] [PATCH] Fix infinite loop in wait_for_resource if CAPP ucode load fails
Alistair Popple
alistair at popple.id.au
Tue May 12 14:35:32 AEST 2015
Stewart,
Looks ok and fixed the problem for me, feel free to add:
Acked-by: Alistair Popple <alistair at popple.id.au>
On Tue, 12 May 2015 14:05:59 Stewart Smith wrote:
> On failing to load CAPP microcode, we would call wait_for_resource_loaded
> for the next PHB but without issuing a new request, thus making
> wait_for_resource spin forever waiting for something that will
> never complete.
>
> Fix is to just track result of load.
>
> Reported-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
> Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
> ---
> hw/phb3.c | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/hw/phb3.c b/hw/phb3.c
> index d9cb57d..eb2ed46 100644
> --- a/hw/phb3.c
> +++ b/hw/phb3.c
> @@ -2182,7 +2182,7 @@ static struct {
> uint32_t ec_level;
> struct capp_lid_hdr *lid;
> size_t size;
> - bool loaded;
> + int load_result;
> } capp_ucode_info = { 0, NULL, 0, false };
>
> #define CAPP_UCODE_MAX_SIZE 0x20000
> @@ -2190,26 +2190,23 @@ static struct {
> static int64_t capp_lid_download(void)
> {
> int64_t ret;
> - int loaded;
>
> - if (capp_ucode_info.loaded == true)
> - return OPAL_SUCCESS;
> + if (capp_ucode_info.load_result != OPAL_EMPTY)
> + return capp_ucode_info.load_result;
>
> - loaded = wait_for_resource_loaded(RESOURCE_ID_CAPP,
> - capp_ucode_info.ec_level);
> + capp_ucode_info.load_result = wait_for_resource_loaded(
> + RESOURCE_ID_CAPP,
> + capp_ucode_info.ec_level);
>
> - if (loaded != OPAL_SUCCESS) {
> + if (capp_ucode_info.load_result != OPAL_SUCCESS) {
> prerror("CAPP: Error loading ucode lid. index=%x\n",
> capp_ucode_info.ec_level);
> ret = OPAL_RESOURCE;
> free(capp_ucode_info.lid);
> capp_ucode_info.lid = NULL;
> - capp_ucode_info.loaded = false;
> goto end;
> }
>
> - capp_ucode_info.loaded = true;
> -
> ret = OPAL_SUCCESS;
> end:
> return ret;
> @@ -4506,7 +4503,7 @@ int phb3_preload_capp_ucode(void)
>
> /* Assert that we're preloading */
> assert(capp_ucode_info.lid == NULL);
> - capp_ucode_info.loaded = false;
> + capp_ucode_info.load_result = OPAL_EMPTY;
>
> capp_ucode_info.ec_level = index;
More information about the Skiboot
mailing list