Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02C83C54EBE for ; Tue, 10 Jan 2023 08:00:48 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 54B4184C58; Tue, 10 Jan 2023 09:00:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1673337646; bh=+vQ4wrTeq8leA8WGRe7/C9zltx4uDmmBLi6/l5MaWYw=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=LR84Dh2IxKCbqlsY7l+OquaOQ0LURwqQPa3qpaTieWDjeBaI5zUwUuRSOVG7ovMia Mv7bFjv5fnvWklXqpmXfdgKsP4TAZs4aPn8x/XwXA7fWIohsUMCee3vMms97sPmar0 fknpcuAjxdugKwHb4i+uAsw9ISRYSGSf0OPwgT9LJCxW9JF+UtgfZYZVxppfIPFOJ1 PRgsfHrKIWK0TgnZIKkV41DyaU7a+nBgg6FqHCxt73CnzhbtXPCw/tkvBKG00A0wpU CGpbZ19zw8RO/YTcKpbbhIdm5fyg/O7ymt8PQz0vsm1x943qSQxYCFzrGoj4YilkP9 7CbpzwU0kY9Ig== Received: by phobos.denx.de (Postfix, from userid 109) id 7595D84DDE; Tue, 10 Jan 2023 09:00:44 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1AB3F84BD0 for ; Tue, 10 Jan 2023 09:00:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4Nrjsz5CnCz9syj; Tue, 10 Jan 2023 09:00:39 +0100 (CET) From: Stefan Roese To: u-boot@lists.denx.de Cc: Simon Glass , AKASHI Takahiro , Heinrich Schuchardt Subject: [RFC PATCH] disk: Don't loop over MAX_SEARCH_PARTITIONS in part_create_block_devices() Date: Tue, 10 Jan 2023 09:00:38 +0100 Message-Id: <20230110080038.180628-1-sr@denx.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean I've noticed that the first ext4 file loading from a MMC partition for ZynqMP takes quite some time (~ 1 second). Debugging showed, that the MMC driver reads the partition info 128 time (MAX_SEARCH_PARTITIONS) resulting in this boot delay. To fix this, let's just end creating the block drives in part_create_block_devices() when no more valid partition is found. This reduces the first file reading from ~0.9s to ~0.3s. Signed-off-by: Stefan Roese Cc: Simon Glass Cc: AKASHI Takahiro Cc: Heinrich Schuchardt --- Reasoning for RFC: I did not dig into the current disk / partition stuff too deeply, so I'm not 100% sure that this patch does not break anything. --- disk/disk-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/disk/disk-uclass.c b/disk/disk-uclass.c index d32747e2242d..2999f7285b5a 100644 --- a/disk/disk-uclass.c +++ b/disk/disk-uclass.c @@ -36,7 +36,7 @@ int part_create_block_devices(struct udevice *blk_dev) /* Add devices for each partition */ for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { if (part_get_info(desc, part, &info)) - continue; + break; snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name, part); -- 2.39.0