From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1m3G1X-00024t-9t for mharc-grub-devel@gnu.org; Tue, 13 Jul 2021 06:52:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3G1U-00024D-Ay for grub-devel@gnu.org; Tue, 13 Jul 2021 06:52:20 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:53126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3G1S-0000TY-6m for grub-devel@gnu.org; Tue, 13 Jul 2021 06:52:19 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ACA78222A0; Tue, 13 Jul 2021 10:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1626173534; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uxtrvqAPuD3QWppnQ8aQZWzpNaWSA3LYp//+eJC/KR4=; b=GETqmr7g8RIBkdFccpQuHVLGEmKOwK/rznjiI+dUAqKknWLEiNeue6d/mKlI1eNc/xB2RZ 4SnUfClBXCQjwmQbJtVQA/mvtQ9KeXabbAWKHmBiJtOkGmC5+t+7r2x59fFcmadhrFT76k y6puf0JeAs45e3LqizMJNR4xsI8htkU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1626173534; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uxtrvqAPuD3QWppnQ8aQZWzpNaWSA3LYp//+eJC/KR4=; b=guucWxzhcqSTAi0oybgZUj9EafzJghTNC2U5WSb8wOhF3yMc1kj7cwS5IrJqiwgj+IXRFK hMfJ+wvJdygoqXBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6C67113AA5; Tue, 13 Jul 2021 10:52:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id Ixb6F15w7WAcagAAMHmgww (envelope-from ); Tue, 13 Jul 2021 10:52:14 +0000 Date: Tue, 13 Jul 2021 12:52:12 +0200 From: Petr Vorel To: Paul Menzel Cc: Jeff Mahoney , Daniel Kiper , Michael Chang , Mike Gilbert , The development of GNU GRUB Subject: Re: [PATCH 2/2] grub2: use stat instead of udevadm for partition lookup Message-ID: Reply-To: Petr Vorel References: <20210708155558.26466-1-pvorel@suse.cz> <20210708155558.26466-3-pvorel@suse.cz> <33f16d1e-162c-6eb1-b0d0-fa69d4a2dbe4@molgen.mpg.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <33f16d1e-162c-6eb1-b0d0-fa69d4a2dbe4@molgen.mpg.de> Received-SPF: pass client-ip=195.135.220.28; envelope-from=pvorel@suse.cz; helo=smtp-out1.suse.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Jul 2021 10:52:20 -0000 Hi Paul, > Dear Petr, dear Jeff, > Am 08.07.21 um 17:55 schrieb Petr Vorel: > > From: Jeff Mahoney > > sysfs_partition_path calls udevadm to resolve the sysfs path for > > a block device. That can be accomplished by stating the device node > > and using the major/minor to follow the symlinks in /sys/dev/block/. > > This cuts the execution time of grub2-mkconfig from 10s to 2s on > > my system. > Petr, where you able to reproduce this issue? No, I'm sorry, I haven't even tried, because accessing sysfs seems to me as a quickest way anyway. But agree that we drag this patch in opensuse from 2017 (for 2.02~rc1), it might not be relevant for nowadays systems. > Could the specifications of Jeff’s system be added to the commit message? Jeff, Michael, could you verify if it's still relevant? Kind regards, Petr > > Signed-off-by: Jeff Mahoney > > [ pvorel: include grub/osdep/major.h ] > > Signed-off-by: Petr Vorel > > --- > > grub-core/osdep/linux/hostdisk.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > diff --git a/grub-core/osdep/linux/hostdisk.c b/grub-core/osdep/linux/hostdisk.c > > index da62f924e..43dc4b0ba 100644 > > --- a/grub-core/osdep/linux/hostdisk.c > > +++ b/grub-core/osdep/linux/hostdisk.c > > @@ -31,6 +31,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > @@ -105,6 +106,13 @@ sysfs_partition_path (const char *dev, const char *entry) > > char *buf = NULL; > > size_t len = 0; > > char *path = NULL; > > + struct stat st; > > + int ret; > > + > > + ret = stat(dev, &st); > > + if (ret == 0 && S_ISBLK(st.st_mode)) > > + return xasprintf ("/sys/dev/block/%u:%u/%s", > > + major (st.st_rdev), minor (st.st_rdev), entry); > > argv[0] = "udevadm"; > > argv[1] = "info"; > Now the non-block device case has one stat call more executed each time. > Kind regards, > Paul