Skip to contentSkip to conversation

Grub2 EFI: Image loading from USB takes too long

DISCUSSION Aravind Srinivasan 4 participants 8 messages Apr 5, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

I am trying Grub2 EFI - this is on a custom platform. On 1.99-rc1, compared to Legacy grub, loading image, in particular initrd image from a USB takes a very long. Our initrd image is about 160M and it is taking about 2 mins to load this image. Turning on "set debug=all" in the grub.cfg file, I see that all the time is being spent in reading the USB. Looking at the source, I think the issue is the value set for GRUB_DISK_CACHE_SIZE in include/grub/disk.h Currently this is what it is set to:

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
<snip>

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8192
#define GRUB_DISK_CACHE_BITS 13

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

Thanks,
-Aravind
Insert mode

#1 lore raw
Quoted 7 lines · Aravind Srinivasan

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
<snip>

Quoted 8 lines

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8192
#define GRUB_DISK_CACHE_BITS 13

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

This value is a misnomer. It's not a cache size but a cache unit size. As immediate effect it has that if one reads a single 512B, sector one reads an entire block of 4K. Under normal conditions values of around 32K-128K (6-8/64-256) would be optimal. It seems that some EFI implementations do a "buffering" only to discard the buffered data. Some of the reports suggest that this braindamage is limited to disk io and doesn't happen with Block IO. Values you propose would result in 4M reads even when one needs just few sectors and so is suboptimal under normal conditions. I'll prepare few patches to investigate.
After 1.99 the GRUB_DISK_CACHE_BITS will be increased to 6-8 range since, it's optimal and my AF support requires sector size to be smaller than cache unit size.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw
Quoted 14 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 13 lines · Aravind Srinivasan

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
<snip>

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8192
#define GRUB_DISK_CACHE_BITS 13

Quoted 6 lines
Quoted 2 lines

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

This value is a misnomer. It's not a cache size but a cache unit size. As immediate effect it has that if one reads a single 512B, sector one reads an entire block of 4K. Under normal conditions values of around 32K-128K (6-8/64-256) would be optimal. It seems that some EFI implementations do a "buffering" only to discard the buffered data. Some of the reports suggest that this braindamage is limited to disk io and doesn't happen with Block IO. Values you propose would result in 4M reads even when one needs just few sectors and so is suboptimal under normal conditions. I'll prepare few patches to investigate.
After 1.99 the GRUB_DISK_CACHE_BITS will be increased to 6-8 range since, it's optimal and my AF support requires sector size to be smaller than cache unit size.

Attached a patch based on my AF patch which change to block IO.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko

=== modified file 'grub-core/disk/efi/efidisk.c'

disk/efi/efidisk.c +17 -22
@@ -33,12 +33,10 @@
   grub_efi_device_path_t *device_path;
   grub_efi_device_path_t *last_device_path;
   grub_efi_block_io_t *block_io;
-  grub_efi_disk_io_t *disk_io;
   struct grub_efidisk_data *next;
 };
 
-/* GUIDs.  */
-static grub_efi_guid_t disk_io_guid = GRUB_EFI_DISK_IO_GUID;
+/* GUID.  */
 static grub_efi_guid_t block_io_guid = GRUB_EFI_BLOCK_IO_GUID;
 
 static struct grub_efidisk_data *fd_devices;
@@ -143,7 +141,7 @@
   struct grub_efidisk_data *devices = 0;
 
   /* Find handles which support the disk io interface.  */
-  handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &disk_io_guid,
+  handles = grub_efi_locate_handle (GRUB_EFI_BY_PROTOCOL, &block_io_guid,
 				    0, &num_handles);
   if (! handles)
     return 0;
@@ -155,7 +153,6 @@
       grub_efi_device_path_t *ldp;
       struct grub_efidisk_data *d;
       grub_efi_block_io_t *bio;
-      grub_efi_disk_io_t *dio;
 
       dp = grub_efi_get_device_path (*handle);
       if (! dp)
@@ -168,9 +165,7 @@
 
       bio = grub_efi_open_protocol (*handle, &block_io_guid,
 				    GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-      dio = grub_efi_open_protocol (*handle, &disk_io_guid,
-				    GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
-      if (! bio || ! dio)
+      if (! bio)
 	/* This should not happen... Why?  */
 	continue;
 
@@ -186,7 +181,6 @@
       d->device_path = dp;
       d->last_device_path = ldp;
       d->block_io = bio;
-      d->disk_io = dio;
       d->next = devices;
       devices = d;
     }
@@ -536,8 +530,13 @@
      and total sectors should be replaced with total blocks.  */
   grub_dprintf ("efidisk", "m = %p, last block = %llx, block size = %x\n",
 		m, (unsigned long long) m->last_block, m->block_size);
-  disk->total_sectors = (m->last_block
-			 * (m->block_size >> GRUB_DISK_SECTOR_BITS));
+  disk->total_sectors = m->last_block;
+  if (m->block_size & (m->block_size - 1) || !m->block_size)
+    return grub_error (GRUB_ERR_IO, "invalid sector size %d",
+		       m->block_size);
+  for (disk->log_sector_size = 0;
+       (1U << disk->log_sector_size) < m->block_size;
+       disk->log_sector_size++);
   disk->data = d;
 
   grub_dprintf ("efidisk", "opening %s succeeded\n", name);
@@ -558,22 +557,20 @@
 {
   /* For now, use the disk io interface rather than the block io's.  */
   struct grub_efidisk_data *d;
-  grub_efi_disk_io_t *dio;
   grub_efi_block_io_t *bio;
   grub_efi_status_t status;
 
   d = disk->data;
-  dio = d->disk_io;
   bio = d->block_io;
 
   grub_dprintf ("efidisk",
 		"reading 0x%lx sectors at the sector 0x%llx from %s\n",
 		(unsigned long) size, (unsigned long long) sector, disk->name);
 
-  status = efi_call_5 (dio->read, dio, bio->media->media_id,
-		      (grub_efi_uint64_t) sector << GRUB_DISK_SECTOR_BITS,
-		      (grub_efi_uintn_t) size << GRUB_DISK_SECTOR_BITS,
-		      buf);
+  status = efi_call_5 (bio->read_blocks, bio, bio->media->media_id,
+		       (grub_efi_uint64_t) sector,
+		       (grub_efi_uintn_t) size << disk->log_sector_size,
+		       buf);
   if (status != GRUB_EFI_SUCCESS)
     return grub_error (GRUB_ERR_READ_ERROR, "efidisk read error");
 
@@ -586,21 +583,19 @@
 {
   /* For now, use the disk io interface rather than the block io's.  */
   struct grub_efidisk_data *d;
-  grub_efi_disk_io_t *dio;
   grub_efi_block_io_t *bio;
   grub_efi_status_t status;
 
   d = disk->data;
-  dio = d->disk_io;
   bio = d->block_io;
 
   grub_dprintf ("efidisk",
 		"writing 0x%lx sectors at the sector 0x%llx to %s\n",
 		(unsigned long) size, (unsigned long long) sector, disk->name);
 
-  status = efi_call_5 (dio->write, dio, bio->media->media_id,
-		       (grub_efi_uint64_t) sector << GRUB_DISK_SECTOR_BITS,
-		       (grub_efi_uintn_t) size << GRUB_DISK_SECTOR_BITS,
+  status = efi_call_5 (bio->write_blocks, bio, bio->media->media_id,
+		       (grub_efi_uint64_t) sector,
+		       (grub_efi_uintn_t) size << disk->log_sector_size,
 		       (void *) buf);
   if (status != GRUB_EFI_SUCCESS)
     return grub_error (GRUB_ERR_WRITE_ERROR, "efidisk write error");

=== modified file 'grub-core/disk/i386/pc/biosdisk.c'

disk/i386/pc/biosdisk.c +28 -26

129 lines not on this page · raw message

=== modified file 'grub-core/disk/scsi.c'

disk/scsi.c +11 -25
@@ -463,15 +463,20 @@
 	  return err;
 	}
 
-      /* SCSI blocks can be something else than 512, although GRUB
-	 wants 512 byte blocks.  */
-      disk->total_sectors = ((grub_uint64_t)scsi->size
-                             * (grub_uint64_t)scsi->blocksize)
-			    >> GRUB_DISK_SECTOR_BITS;
+      disk->total_sectors = scsi->size;
+      if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize)
+	{
+	  grub_free (scsi);
+	  return grub_error (GRUB_ERR_IO, "invalid sector size %d",
+			     scsi->blocksize);
+	}
+      for (disk->log_sector_size = 0;
+	   (1 << disk->log_sector_size) < scsi->blocksize;
+	   disk->log_sector_size++);
 
       grub_dprintf ("scsi", "blocks=%u, blocksize=%u\n",
 		    scsi->size, scsi->blocksize);
-      grub_dprintf ("scsi", "Disk total 512 sectors = %llu\n",
+      grub_dprintf ("scsi", "Disk total sectors = %llu\n",
 		    (unsigned long long) disk->total_sectors);
 
       return GRUB_ERR_NONE;
@@ -501,25 +506,6 @@
 
   scsi = disk->data;
 
-  /* SCSI sectors are variable in size.  GRUB uses 512 byte
-     sectors.  */
-  if (scsi->blocksize != GRUB_DISK_SECTOR_SIZE)
-    {
-      unsigned spb = scsi->blocksize >> GRUB_DISK_SECTOR_BITS;
-      if (spb == 0 || (scsi->blocksize & (GRUB_DISK_SECTOR_SIZE - 1)) != 0)
-	return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			   "unsupported SCSI block size");
-
-      grub_uint32_t sector_mod = 0;
-      sector = grub_divmod64 (sector, spb, &sector_mod);
-
-      if (! (sector_mod == 0 && size % spb == 0))
-	return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
-			   "unaligned SCSI read not supported");
-
-      size /= spb;
-    }
-
   /* Depending on the type, select a read function.  */
   switch (scsi->devtype)
     {

=== modified file 'grub-core/kern/disk.c'

kern/disk.c +57 -20

170 lines not on this page · raw message

=== modified file 'grub-core/kern/emu/hostdisk.c'

kern/emu/hostdisk.c +26 -11
@@ -42,6 +42,7 @@
 
 #ifdef __linux__
 # include <sys/ioctl.h>         /* ioctl */
+# include <sys/mount.h>
 # if !defined(__GLIBC__) || \
         ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
 /* Maybe libc doesn't have large file support.  */
@@ -264,6 +265,7 @@
 # else
     unsigned long long nr;
 # endif
+    int sector_size;
     int fd;
 
     fd = open (map[drive].device, O_RDONLY);
@@ -295,16 +297,28 @@
 	goto fail;
       }
 
+    if (ioctl (fd, BLKSSZGET, &sector_size))
+       {
+         close (fd);
+	 goto fail;
+       }
+
     close (fd);
 
+    if (sector_size & (sector_size - 1) || !sector_size)
+      goto fail;
+    for (disk->log_sector_size = 0;
+	 (1 << disk->log_sector_size) < sector_size;
+	 disk->log_sector_size++);
+
 # if defined (__APPLE__)
     disk->total_sectors = nr;
 # elif defined(__NetBSD__)
     disk->total_sectors = label.d_secperunit;
 # else
-    disk->total_sectors = nr / 512;
+    disk->total_sectors = nr >> disk->log_sector_size;
 
-    if (nr % 512)
+    if (nr & ((1 << disk->log_sector_size) - 1))
       grub_util_error ("unaligned device size");
 # endif
 
@@ -321,7 +335,7 @@
   if (stat (map[drive].device, &st) < 0)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "cannot stat `%s'", map[drive].device);
 
-  disk->total_sectors = st.st_size >> GRUB_DISK_SECTOR_BITS;
+  disk->total_sectors = st.st_size >> disk->log_sector_size;
 
   grub_util_info ("the size of %s is %lu", name, disk->total_sectors);
 
@@ -760,7 +774,7 @@
     _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
                loff_t *, res, uint, wh);
 
-    offset = (loff_t) sector << GRUB_DISK_SECTOR_BITS;
+    offset = (loff_t) sector << disk->log_sector_size;
     if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
       {
 	grub_error (GRUB_ERR_BAD_DEVICE, "cannot seek `%s'", map[disk->id].device);
@@ -770,7 +784,7 @@
   }
 #else
   {
-    off_t offset = (off_t) sector << GRUB_DISK_SECTOR_BITS;
+    off_t offset = (off_t) sector << disk->log_sector_size;
 
     if (lseek (fd, offset, SEEK_SET) != offset)
       {
@@ -870,20 +884,21 @@
 	 sectors that are read together with the MBR in one read.  It
 	 should only remap the MBR, so we split the read in two
 	 parts. -jochen  */
-      if (nread (fd, buf, GRUB_DISK_SECTOR_SIZE) != GRUB_DISK_SECTOR_SIZE)
+      if (nread (fd, buf, (1 << disk->log_sector_size))
+	  != (1 << disk->log_sector_size))
 	{
 	  grub_error (GRUB_ERR_READ_ERROR, "cannot read `%s'", map[disk->id].device);
 	  close (fd);
 	  return grub_errno;
 	}
 
-      buf += GRUB_DISK_SECTOR_SIZE;
+      buf += (1 << disk->log_sector_size);
       size--;
     }
 #endif /* __linux__ */
 
-  if (nread (fd, buf, size << GRUB_DISK_SECTOR_BITS)
-      != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+  if (nread (fd, buf, size << disk->log_sector_size)
+      != (ssize_t) (size << disk->log_sector_size))
     grub_error (GRUB_ERR_READ_ERROR, "cannot read from `%s'", map[disk->id].device);
 
   return grub_errno;
@@ -916,8 +931,8 @@
   if (fd < 0)
     return grub_errno;
 
-  if (nwrite (fd, buf, size << GRUB_DISK_SECTOR_BITS)
-      != (ssize_t) (size << GRUB_DISK_SECTOR_BITS))
+  if (nwrite (fd, buf, size << disk->log_sector_size)
+      != (ssize_t) (size << disk->log_sector_size))
     grub_error (GRUB_ERR_WRITE_ERROR, "cannot write to `%s'", map[disk->id].device);
 
   return grub_errno;

=== modified file 'grub-core/partmap/msdos.c'

partmap/msdos.c +16 -6
@@ -90,8 +90,11 @@
 	{
 	  e = mbr.entries + p.index;
 
-	  p.start = p.offset + grub_le_to_cpu32 (e->start) - delta;
-	  p.len = grub_le_to_cpu32 (e->length);
+	  p.start = p.offset
+	    + (grub_le_to_cpu32 (e->start)
+	       << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)) - delta;
+	  p.len = grub_le_to_cpu32 (e->length)
+	    << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS);
 	  p.msdostype = e->type;
 
 	  grub_dprintf ("partition",
@@ -126,7 +129,9 @@
 
 	  if (grub_msdos_partition_is_extended (e->type))
 	    {
-	      p.offset = ext_offset + grub_le_to_cpu32 (e->start);
+	      p.offset = ext_offset
+		+ (grub_le_to_cpu32 (e->start)
+		   << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
 	      if (! ext_offset)
 		ext_offset = p.offset;
 
@@ -204,8 +209,11 @@
 	  e = mbr.entries + i;
 
 	  if (!grub_msdos_partition_is_empty (e->type)
-	      && end > offset + grub_le_to_cpu32 (e->start))
-	    end = offset + grub_le_to_cpu32 (e->start);
+	      && end > offset
+	      + (grub_le_to_cpu32 (e->start)
+		 << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS)))
+	    end = offset + (grub_le_to_cpu32 (e->start)
+			    << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
 
 	  /* If this is a GPT partition, this MBR is just a dummy.  */
 	  if (e->type == GRUB_PC_PARTITION_TYPE_GPT_DISK && i == 0)
@@ -219,7 +227,9 @@
 
 	  if (grub_msdos_partition_is_extended (e->type))
 	    {
-	      offset = ext_offset + grub_le_to_cpu32 (e->start);
+	      offset = ext_offset 
+		+ (grub_le_to_cpu32 (e->start) 
+		   << (disk->log_sector_size - GRUB_DISK_SECTOR_BITS));
 	      if (! ext_offset)
 		ext_offset = offset;
 

=== modified file 'include/grub/disk.h'

grub/disk.h +7 -3
@@ -100,6 +100,9 @@
   /* The total number of sectors.  */
   grub_uint64_t total_sectors;
 
+  /* Logarithm of sector size.  */
+  unsigned int log_sector_size;
+
   /* The id used by the disk cache manager.  */
   unsigned long id;
 
@@ -132,9 +135,10 @@
 /* The maximum number of disk caches.  */
 #define GRUB_DISK_CACHE_NUM	1021
 
-/* The size of a disk cache in sector units.  */
-#define GRUB_DISK_CACHE_SIZE	8
-#define GRUB_DISK_CACHE_BITS	3
+/* The size of a disk cache in 512B units. Must be at least as big as the
+   largest supported sector size, currently 16K.  */
+#define GRUB_DISK_CACHE_BITS	6
+#define GRUB_DISK_CACHE_SIZE	(1 << GRUB_DISK_CACHE_BITS)
 
 /* Return value of grub_disk_get_size() in case disk size is unknown. */
 #define GRUB_DISK_SIZE_UNKNOWN	 0xffffffffffffffffULL
#3 lore raw

Tried the block IO patch. It is much better than the current default performance of 1.99. For the same initrd image (160M), loading from USB took approx 20 secs. I also tried changing the value of GRUB_DISK_CACHE_BITS from 6 to 8, and load time improved to approx 12 secs.
Just to note, on Legacy Grub, this gets loaded almost in 3 secs.

Thanks,
Aravind

----- Original Message ----
From: Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>
To: The development of GNU GRUB <[email protected]>
Sent: Tue, April 5, 2011 12:36:35 AM
Subject: Re: Grub2 EFI: Image loading from USB takes too long

Quoted 16 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 7 lines · Aravind Srinivasan

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
<snip>

Quoted 8 lines

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8192
#define GRUB_DISK_CACHE_BITS 13

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

Quoted 13 lines

This value is a misnomer. It's not a cache size but a cache unit size. As immediate effect it has that if one reads a single 512B, sector one reads an entire block of 4K. Under normal conditions values of around 32K-128K (6-8/64-256) would be optimal. It seems that some EFI implementations do a "buffering" only to discard the buffered data. Some of the reports suggest that this braindamage is limited to disk io and doesn't happen with Block IO. Values you propose would result in 4M reads even when one needs just few sectors and so is suboptimal under normal conditions.
I'll prepare few patches to investigate.
After 1.99 the GRUB_DISK_CACHE_BITS will be increased to 6-8 range since, it's optimal and my AF support requires sector size to be smaller than cache unit size.

Attached a patch based on my AF patch which change to block IO.

-- Regards
Vladimir 'φ-coder/phcoder' Serbinenko

#4 lore raw
In reply to Aravind Srinivasan

It's not just USB. Loading large files via UEFI with GRUB2 takes an extremely long time. One of the things phcoder suggested was changing the cache size, which you've done. Od love to see a larger cache committed to the trunk so UEFI platforms can benefit when large files need to be read by GRUB2 (assuming no other side effects)!

--S

Quoted 35 lines · Aravind Srinivasan

Hi,

I am trying Grub2 EFI - this is on a custom platform. On 1.99-rc1, compared to Legacy grub, loading image, in particular initrd image from a USB takes a very long. Our initrd image is about 160M and it is taking about 2 mins to load this image. Turning on "set debug=all" in the grub.cfg file, I see that all the time is being spent in reading the USB. Looking at the source, I think the issue is the value set for GRUB_DISK_CACHE_SIZE in include/grub/disk.h Currently this is what it is set to:

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8
#define GRUB_DISK_CACHE_BITS 3
<snip>

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units. */
#define GRUB_DISK_CACHE_SIZE 8192
#define GRUB_DISK_CACHE_BITS 13

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

Thanks,
-Aravind
Insert mode

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw
Quoted 42 lines · Seth Goldberg

It's not just USB.  Loading large files via UEFI with GRUB2 takes an extremely long time.  One of the things phcoder suggested was changing the cache size, which you've done.  Od love to see a larger cache committed to the trunk so UEFI platforms can benefit when large files need to be read by GRUB2 (assuming no other side effects)!

 --S

Quoted 27 lines · Aravind Srinivasan

Hi,

I am trying Grub2 EFI - this is on a custom platform. On 1.99-rc1, compared to Legacy grub, loading image, in particular initrd image from a USB takes a very long.  Our initrd image is about 160M and it is taking about 2 mins to load this image. Turning on "set debug=all" in the grub.cfg file, I see that all the time is being spent in reading the USB. Looking at the source, I think the issue is the value set for GRUB_DISK_CACHE_SIZE in include/grub/disk.h Currently this is what it is set to:

include/grub/disk.h
<snip>
/* The size of a disk cache in sector units.  */
#define GRUB_DISK_CACHE_SIZE   8
#define GRUB_DISK_CACHE_BITS   3
<snip>

I tried changing this value to 8192 - and the time it took to load the same image came down to 10 secs !
/* The size of a disk cache in sector units.  */
#define GRUB_DISK_CACHE_SIZE   8192
#define GRUB_DISK_CACHE_BITS   13

I am not sure of the reason for setting the cache size to a low value and any possible issues in increasing this size. Appreciate any input on this.

Quoted 8 lines

Thanks,
-Aravind
Insert mode

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

I can confirm that grub2 x86_64-efi is very slow in loading initramfs files. I did my testing in VirtualBox 4.0.4 (VBox patched OVMF, quite old compared to updated OVMF) using an iso mounted in a virtual SATA AHCI CD drive and 1 GiB RAM alloted to the virtual machine. Intel VT extension was enabled. In a crude benchmarking using s top watch, the time between selection of menuentry to seeing the kernel boot messages is approx 4 minutes (236 seconds) measured using a stop watch. I have not yet tested with an updated ovmf in qemu or in duet. I guess accessing from HDDs is faster in UEFI systems. Its the CDs and USB which seem to take a lot of time.

The kernel loaded by grub2 during the test and the initramfs can be downloaded from

ftp://ftp.archlinux.org/iso/archboot/2011.02/boot/vm64 - kernel (lzma compressed) ftp://ftp.archlinux.org/iso/archboot/2011.02/boot/initrd64.img - initramfs (lzma -9 compressed cpio archive).

Regards.

Keshav

#6 lore raw
Quoted 4 lines · KESHAV P.R.

In a crude benchmarking using s top watch, the
time between selection of menuentry to seeing the kernel boot messages is approx 4 minutes (236 seconds) measured using a stop watch. I have not yet tested with an updated ovmf in qemu or in duet.

You push for a potentially harming change, yet when asked to try with smaller numbers to see which value is optimal/required suddenly you stop answering.

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#7 lore raw

2011/4/5 Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]>:

Quoted 11 lines · KESHAV P.R.
Quoted 5 lines

In a crude benchmarking using stop watch, the
time between selection of menuentry to seeing the kernel boot messages is approx 4 minutes (236 seconds) measured using a stop watch. I have not yet tested with an updated ovmf in qemu or in duet.

You push for a potentially harming change, yet when asked to try with smaller numbers to see which value is optimal/required suddenly you stop answering.

I didn't request (or push) for any change in the first place because i do not know what that change does in the first place. I simply tried to benchmark it to see whether such a problem occurs. This testing was done with 1.99~rc1 release (not bzr trunk and not with the 16 KiB alignment patch) and I am not sure whether the same results might occur bzr trunk. I do not know whether the proposed change will solve the problem because i am not a programmer. Of course i will test any patch you send to me if i have time and if i am able to obtain any useful info.

The only info you (phcoder) mentioned is that you tried for dynamic cache allocation
(http://www.mail-archive.com/[email protected]/msg15793.html). If you can provide an updated patch i will test it (is the blockio patch same as this?). Sorry but i don't mean to offend anyone in this mail.

- Keshav