[Skiboot] [PATCH v3 3/3] PHB3: Introduce busy flag instead of lock in load_resources path

Michael Neuling mikey at neuling.org
Sat Mar 28 02:29:25 AEDT 2015


On Thu, 2015-03-12 at 13:52 +0530, Vasant Hegde wrote:
> ..that way we can avoid "Poller running with lock issue".

As was suggested in another thread, do the download earlier.

> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> cc: Michael Neuling <mikey at neuling.org>

No I'm not!  Please don't say I'm cced when I'm not.

Mikey

> ---
>  hw/phb3.c |   15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/phb3.c b/hw/phb3.c
> index e7127bc..31c41b0 100644
> --- a/hw/phb3.c
> +++ b/hw/phb3.c
> @@ -2173,6 +2173,7 @@ static int64_t capp_lid_download(struct phb3 *p)
>  {
>  	struct proc_chip *chip = get_chip(p->chip_id);
>  
> +	static bool lid_download_busy = false;
>  	size_t size = CAPP_UCODE_MAX_SIZE;
>  	int64_t ret;
>  	uint32_t index;
> @@ -2188,7 +2189,16 @@ static int64_t capp_lid_download(struct phb3 *p)
>  	/* Keep ChipID and Major/Minor EC.  Mask out the Location Code. */
>  	index = index & 0xf0fff;
>  
> -	lock(&capi_lock);
> +	for (;;) {
> +		lock(&capi_lock);
> +		if (!lid_download_busy) {
> +			lid_download_busy = true;
> +			unlock(&capi_lock);
> +			break;
> +		}
> +		unlock(&capi_lock);
> +		cpu_relax();
> +	}
>  
>  	if (capp_ucode_info.lid) {
>  		ret = OPAL_SUCCESS;
> @@ -2230,7 +2240,8 @@ static int64_t capp_lid_download(struct phb3 *p)
>  	capp_ucode_info.lid = lid;
>  	ret = OPAL_SUCCESS;
>  end:
> -	unlock(&capi_lock);
> +	lwsync();
> +	lid_download_busy = false;
>  	return ret;
>  }
>  
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot



More information about the Skiboot mailing list