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 84D5AC5479D for ; Wed, 11 Jan 2023 08:05:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4BD70856C3; Wed, 11 Jan 2023 09:05:16 +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=1673424316; bh=hXjoJaYgxoAK7z+LnWZtXa8hf04WCCE607N1IGC6XPw=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ghCKGVaXB/nIFFSGWdqcmg2XN9QpdtC/vbwRDjN5KW9M+3GLlr7KuU8t/2UG/Q1jn pMZGovk9yk/Kbsnp0nBdTPD0Q1uyKpyVOWSdhxYguHrpAL80KylZKFK3esMc/msDPI EscD7/Ryk3PrwcdpI5B3jj0Z1XLwsqP4KAhoPGLMM/p9dEOePKijuc6Ilvqm4nafxs NeCSlbAztJ/TdFoURnO77F6KuhEvt2i/FgGztEpiM+7mfZc8olq4wFStAsNgq729gy LSgJ5VG3KlG7cD0SxoeLh/DJ1aVp9XwuJ+7LdECexUQhIi85VeO8mTKq135CO6BBJJ yLQAR11xw1X6Q== Received: by phobos.denx.de (Postfix, from userid 109) id 4BBEC856C1; Wed, 11 Jan 2023 09:05:14 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [IPv6:2001:67c:2050:101:465::107]) (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 5461D856D1 for ; Wed, 11 Jan 2023 09:05:09 +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 smtp1.mailbox.org (smtp1.mailbox.org [10.196.197.1]) (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 4NsKwf1twdz9sxx; Wed, 11 Jan 2023 09:05:06 +0100 (CET) Message-ID: Date: Wed, 11 Jan 2023 09:05:05 +0100 MIME-Version: 1.0 Subject: Re: [RFC PATCH] disk: Don't loop over MAX_SEARCH_PARTITIONS in part_create_block_devices() Content-Language: en-US To: AKASHI Takahiro , u-boot@lists.denx.de, Simon Glass , Heinrich Schuchardt References: <20230110080038.180628-1-sr@denx.de> <20230111013241.GA42466@laputa> From: Stefan Roese In-Reply-To: <20230111013241.GA42466@laputa> Content-Type: text/plain; charset=UTF-8; format=flowed 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 On 1/11/23 02:32, AKASHI Takahiro wrote: > Hi, > > Thank you for catching this issue. > > On Tue, Jan 10, 2023 at 09:00:38AM +0100, Stefan Roese wrote: >> 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. > > I'm afraid that this fix won't work for all the partition types, > especially for those in which entries in a partition table can be sparsely filled, > or in other words, valid partition numbers may not always be contiguous > even if they don't reach a maximum number. So what is the maximum number? Where originates the MAX_SEARCH_PARTITIONS = 128 from? > I somehow confirmed this against a GPT partition by using gdisk. How exactly did you confirm this? Thanks, Stefan > -Takahiro Akashi > >> --- >> 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 >> Viele Grüße, Stefan Roese -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de