From patchwork Tue Oct 9 07:32:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 981071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42TprR4Gg6z9s9G for ; Tue, 9 Oct 2018 18:33:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="RG0bQzIA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="oU+BS/Pe"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42TprR2hYCzF3CT for ; Tue, 9 Oct 2018 18:33:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="RG0bQzIA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="oU+BS/Pe"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=aj.id.au (client-ip=66.111.4.27; helo=out3-smtp.messagingengine.com; envelope-from=andrew@aj.id.au; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="RG0bQzIA"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="oU+BS/Pe"; dkim-atps=neutral Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42TpqG69cHzF3Bg for ; Tue, 9 Oct 2018 18:32:58 +1100 (AEDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3DC2221F75; Tue, 9 Oct 2018 03:32:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 09 Oct 2018 03:32:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:in-reply-to:references; s=fm3; bh=+3cyiBHfV3OAXA5HeMzI0Jc7kOPS+BebRDB0/RpZOy4=; b=RG0bQzIAHyLG g8qwWNWOetIpH5v41gb/TJjv5M7z6K6uRh5B9fqShwrunA9c7HSHgkdA0ev9iXkr tCa7yBIE6hEFleuI2KdpxKK8L5In+tXgcG1GiCqBA8m3KNyHKX2TDQEpWw83sEtv 1wgoO3jbdl+BV+whgujz2Zltn9cQ/BWXbC5fnLNt0GcPH1rga58qbh5mFqzTYArJ W9y6g9Pi08myooeK6ZDhiWrHOmsGp3zK1Y0MGkHtNSwJUgc97/87VbAf9qX7dXo0 ayXHUAxyfMTBo5PMrTfHxP9HxSXMsFG/Xm7Aqcip0mH1z75BOCK2V0IAb38P+0Wl pGyNQ+wYyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=+3cyiBHfV3OAXA5HeMzI0Jc7kOPS+ BebRDB0/RpZOy4=; b=oU+BS/Pew+RyBC2tVoydQyRHR9WV9rIkBREQdCW35/OpX tGS/rEBwWbCxBqnhLxxvVPwAhRKIAIVs6DGOrCJKH2nqpwfOvoxinJ+oh0i+Urut ZrYKhdatW1uNeOIIZncd7UIVtgnkEDIzXm0Yz2Xi6b3bbnSDgyrLa4Dpe8s2y/kx mC2hvDXWDp6xXKCXtIvZ/JtdVV1QlVRrJev1Q7O6a0JvH/+tbwgjmjU9gR1xbWMm PH5a9T/CfVmc4Fih8PX6SdzZSNWhVSRi74SCoHFxpbqFrVRSacgI6LpkYBAhRPpz hc9qfrvhCjsTRlXlvkzuvW87J80pHqmuU6/wDCg+A== X-ME-Sender: X-ME-Proxy: Received: from dave.ibm.com (50-203-181-99-static.hfc.comcastbusiness.net [50.203.181.99]) by mail.messagingengine.com (Postfix) with ESMTPA id EFA0CE454F; Tue, 9 Oct 2018 03:32:54 -0400 (EDT) From: Andrew Jeffery To: skiboot@lists.ozlabs.org Date: Tue, 9 Oct 2018 00:32:29 -0700 Message-Id: <20181009073237.16251-4-andrew@aj.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181009073237.16251-1-andrew@aj.id.au> References: <20181009073237.16251-1-andrew@aj.id.au> Subject: [Skiboot] [PATCH v3 03/11] core/flash: Only lock around flashes update in flash_register() X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dkodihal@in.ibm.com, Andrew Jeffery , anoo@linux.ibm.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Previously in flash_register() held flash_lock across ffs_init(), which calls through the blocklevel layer to read the flash. This is unhelpful with the IPMI HIOMAP protocol transport as LPC interrupts have not yet been enabled and we are relying on polling to progress. The held lock stalls the boot as we take the nopoll path in time_wait() while completing ipmi_queue_msg_sync() in libflash/ipmi-flash.c Signed-off-by: Andrew Jeffery --- core/flash.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/flash.c b/core/flash.c index 8e7b90e672c4..15eb7443faac 100644 --- a/core/flash.c +++ b/core/flash.c @@ -406,13 +406,9 @@ int flash_register(struct blocklevel_device *bl) prlog(PR_INFO, "FLASH: registering flash device %s " "(size 0x%llx, blocksize 0x%x)\n", name ?: "(unnamed)", size, block_size); - - lock(&flash_lock); - flash = malloc(sizeof(struct flash)); if (!flash) { prlog(PR_ERR, "FLASH: Error allocating flash structure\n"); - unlock(&flash_lock); return OPAL_RESOURCE; } @@ -423,8 +419,6 @@ int flash_register(struct blocklevel_device *bl) flash->block_size = block_size; flash->id = num_flashes(); - list_add(&flashes, &flash->list); - rc = ffs_init(0, flash->size, bl, &ffs, 1); if (rc) { /** @@ -445,6 +439,8 @@ int flash_register(struct blocklevel_device *bl) if (ffs) ffs_close(ffs); + lock(&flash_lock); + list_add(&flashes, &flash->list); unlock(&flash_lock); return OPAL_SUCCESS;