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 7C17DC54EBC for ; Wed, 11 Jan 2023 01:32:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 461C9855E8; Wed, 11 Jan 2023 02:32:53 +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="L2mQFjYa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1BC32855DD; Wed, 11 Jan 2023 02:32:51 +0100 (CET) Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 6EDD2855DE for ; Wed, 11 Jan 2023 02:32: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-pj1-x1036.google.com with SMTP id dw9so12873674pjb.5 for ; Tue, 10 Jan 2023 17:32:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to: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=Svdqg/piuRftC9925igeeNu2gRPnWQJdSle7e6LouQc=; b=L2mQFjYaOvrZK7rKQOhaBw3BhOXmLUyaktwX6o9l5bwMTyXeWFzk00FFhdznnVrh7N EHS7e1WK1yskCKp93ltvZrxAvgoDNya3qlK1lQ9YutbZvRgCiqYaT0EoAeiu/LsBpITH axwPy3w1xpuah8CBdumF/OwoPuzfHG9n5jhVEwM9sENRZg0fsHIgOXk/ZUpgsFgMe19d ooOG6GQN4mzwzdnKs1PTYB+yeQnkIy3zERa0ZhuCLZt9pDvQkGYWjUEoCpaaDXhUiuyn eM1HVGVhhBci70KzXMjUalcqD69CtHFQl1B26SItuhoN2A5xQUXytGLreGasEjMyWxF6 2fCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to: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=Svdqg/piuRftC9925igeeNu2gRPnWQJdSle7e6LouQc=; b=cv0NX8tZ3gwYMIEW6scS/vpIIZtqUcK12suwpztW97ae5uTx0Hr1CCjW+m8gobIgtt QE6gsaPOlhGIhqHTT+IR0Wdn96P5zXACj/M54pPh9wNQjKShiz76yKyf1wLUbeNM65H6 e+qhqN33bJx99mUlZCUj9pdL88l6J6sWtnJySjS2QVoRsN8mTzfngohirttDZf9vB1jf jENrBw+kMGHfe383Ko/4QXUUtl6R46/qMAojMsKmEU7gZZfrPNc0+6cpP+tBgt6SL/gX ryjr5mTQY96OWq3aObhu07gJj51E2JWf2UhzVXJ7s1GA2CfhomMgPJZ6esmojgkauSlp XIwA== X-Gm-Message-State: AFqh2kpS7+Z4tfidn8jVYORal7NqGKEe3yNZD5cliekVGldofb49PafO E4g3E3c0ZSIONbt7xQ5fMnNxIA== X-Google-Smtp-Source: AMrXdXsgAHTEczO2QKEY8mmZU5mhWvM+1ITQDYVtj2BCuqm7MhBXdtkAGRPXwwfSyrKBO151n6fVFA== X-Received: by 2002:a05:6a20:7d81:b0:b5:f180:6d2c with SMTP id v1-20020a056a207d8100b000b5f1806d2cmr2228313pzj.4.1673400765652; Tue, 10 Jan 2023 17:32:45 -0800 (PST) Received: from laputa ([2400:4050:c3e1:100:1912:fb60:84f1:e948]) by smtp.gmail.com with ESMTPSA id 75-20020a63074e000000b004b5fb50aa6dsm1533770pgh.83.2023.01.10.17.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 17:32:45 -0800 (PST) Date: Wed, 11 Jan 2023 10:32: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: <20230111013241.GA42466@laputa> Mail-Followup-To: AKASHI Takahiro , Stefan Roese , u-boot@lists.denx.de, Simon Glass , Heinrich Schuchardt References: <20230110080038.180628-1-sr@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230110080038.180628-1-sr@denx.de> 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 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. I somehow confirmed this against a GPT partition by using gdisk. -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 >