diff mbox

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

Message ID 20150312082239.26283.74659.stgit@localhost.localdomain
State Rejected
Headers show

Commit Message

Vasant Hegde March 12, 2015, 8:22 a.m. UTC
..that way we can avoid "Poller running with lock issue".

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
cc: Michael Neuling <mikey@neuling.org>
---
 hw/phb3.c |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Michael Neuling March 27, 2015, 3:29 p.m. UTC | #1
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@linux.vnet.ibm.com>
> cc: Michael Neuling <mikey@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@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Vasant Hegde March 30, 2015, 10:26 a.m. UTC | #2
On 03/27/2015 08:59 PM, Michael Neuling wrote:
> 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@linux.vnet.ibm.com>
>> cc: Michael Neuling <mikey@neuling.org>
> 
> No I'm not!  Please don't say I'm cced when I'm not.

Sorry for that.. I didn't realize that you were not CCed.

Looks like something went wrong while sending patches.. Next time will take care
of it.

-Vasant
diff mbox

Patch

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;
 }