From mboxrd@z Thu Jan 1 00:00:00 1970 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 ED832C46467 for ; Wed, 11 Jan 2023 09:04:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F4F885531; Wed, 11 Jan 2023 10:04:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="sspXmiIE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1C3BB85568; Wed, 11 Jan 2023 10:04:50 +0100 (CET) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2BA4F82131 for ; Wed, 11 Jan 2023 10:04:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pl1-x635.google.com with SMTP id c6so16122392pls.4 for ; Wed, 11 Jan 2023 01:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=WHfbNvCfsNCGfP1nOQ+xnV3KGxxAUicokPDa48vTOkA=; b=sspXmiIEUrFZvYHW8VEvGopcxDb/tkjNIq63z9v7q8WCm8hu93Tv646maCFdsOOUdJ raPGhsiHEW2klq9J1gXa310WpUAm7xYiquS19FCmIHZTkA2ZdsrmeyusmCqCCMSX+BDf xVL+dPHPAbHGNoQmThQX78W+Si41lFQ5bp5Sh2C3YFnxUFlm40iXUwYRseh8u3cXCYAF DdkH4MV4ZC64kWbM4kwpYNiw2Lh415ZlJvB285nvs7q+WGoAJvFwM647pPEVeHz0wO5A cndu1/qfm/jLzI0I4vPWWU6iyJWO42+7Sy5Jh+4L/UABvUJlKEjXsonFvSnnJAu6lOvi J21w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WHfbNvCfsNCGfP1nOQ+xnV3KGxxAUicokPDa48vTOkA=; b=OMAHiCwoydA6PZfeRLnIrq1mUlxikAkBif2vcFNRJ4La4Xro7SECUvmZbsBuUy8AA1 JMopLUpBAD5v6RVn6R+qicCnEyVh0GBm7ooyD6t0awvO/OG1l5/ykY4rLK6OiVn7RMmp NTz0tqYr17aygfBxGpUu8ooAQ0ZiIYTDLYojcAP15Sw0WtRobhaBGg2N3o0+Rd+Le2mO XAYYiI/L4Ec9ZFMRryXk+CdsWFdeJIE2ocmxJow3QyadHuXNX5KXSR0PzRkBmjlCf6Ud JkrkqF2KAQswvjgdMsnM03Z7ozL60iZQjNEJpqnFoYP7ezzfx1P4wS73fq5P3MReQRV8 +CNQ== X-Gm-Message-State: AFqh2kpFiIBti0b9xNXMDPj+qPuSXHBExlhbcipFzCwnx7piGF1Xtmcm jIpCGWY1HZnKSHi5z8avlJ3tlg== X-Google-Smtp-Source: AMrXdXsN+SHEKcMfahqV/SDCPBweM2ndSg57GZKLt63lCdPrn5XLLmyuKcf4me84bS+/8MKKQcpv7w== X-Received: by 2002:a17:902:c951:b0:189:f0ac:191d with SMTP id i17-20020a170902c95100b00189f0ac191dmr18508666pla.4.1673427885418; Wed, 11 Jan 2023 01:04:45 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:1912:fb60:84f1:e948]) by smtp.gmail.com with ESMTPSA id l15-20020a170902f68f00b0017f592a7eccsm9477052plg.298.2023.01.11.01.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 01:04:45 -0800 (PST) Date: Wed, 11 Jan 2023 18:04:41 +0900 From: AKASHI Takahiro To: Stefan Roese Cc: u-boot@lists.denx.de, Simon Glass , Heinrich Schuchardt Subject: Re: [RFC PATCH] disk: Don't loop over MAX_SEARCH_PARTITIONS in part_create_block_devices() Message-ID: <20230111090441.GA62864@laputa> Mail-Followup-To: AKASHI Takahiro , Stefan Roese , u-boot@lists.denx.de, Simon Glass , Heinrich Schuchardt References: <20230110080038.180628-1-sr@denx.de> <20230111013241.GA42466@laputa> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Wed, Jan 11, 2023 at 09:05:05AM +0100, Stefan Roese wrote: > 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? commit bc314f8e5f9b ("cmd: part: list all 128 GPT partitions") But GPT may accept arbitrary number of partitions. The GPT header has "num_partition_entries" for the table size. The max depends on partition types. > > I somehow confirmed this against a GPT partition by using gdisk. > > How exactly did you confirm this? Created partitions for, say, #3 and #5 by 'n' command. -Takahiro Akashi > 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