From patchwork Thu Mar 12 08:22:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vasant Hegde X-Patchwork-Id: 449343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CDE0A1400B6 for ; Thu, 12 Mar 2015 19:52:02 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id B36321A083A for ; Thu, 12 Mar 2015 19:52:02 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e28smtp04.in.ibm.com (e28smtp04.in.ibm.com [122.248.162.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id C7F791A0701 for ; Thu, 12 Mar 2015 19:51:58 +1100 (AEDT) Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Mar 2015 14:21:53 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Mar 2015 14:21:51 +0530 Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id B0E701258ACA for ; Thu, 12 Mar 2015 13:54:16 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2C8MhY323920658 for ; Thu, 12 Mar 2015 13:52:44 +0530 Received: from d28av03.in.ibm.com (localhost [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2C8MeTD008407 for ; Thu, 12 Mar 2015 13:52:41 +0530 Received: from localhost.localdomain ([9.124.35.19]) by d28av03.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2C8MeEP008367; Thu, 12 Mar 2015 13:52:40 +0530 From: Vasant Hegde To: skiboot@lists.ozlabs.org Date: Thu, 12 Mar 2015 13:52:39 +0530 Message-ID: <20150312082239.26283.74659.stgit@localhost.localdomain> In-Reply-To: <20150312082142.26283.62034.stgit@localhost.localdomain> References: <20150312082142.26283.62034.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15031208-0013-0000-0000-000004253FBD Subject: [Skiboot] [PATCH v3 3/3] PHB3: Introduce busy flag instead of lock in load_resources path X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" ..that way we can avoid "Poller running with lock issue". Signed-off-by: Vasant Hegde cc: Michael Neuling --- 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; }