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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Mar 12 19:22:39 AEDT 2015


..that way we can avoid "Poller running with lock issue".

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
cc: Michael Neuling <mikey at neuling.org>
---
 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;
 }
 



More information about the Skiboot mailing list