Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2024261

Summary: MegaRAID is slow to load the initramfs
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: partedAssignee: Brian Lane <bcl>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: high Docs Contact:
Priority: high    
Version: 8.5CC: bcao, bcl, kzak, lipan, rharwood, weihao.bj, zhouling12
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-08 22:53:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test with "RHEL7" partitioning (S=63)
none
Test with "RHEL8" partitioning (S=2) none

Description Renaud Métrich 2021-11-17 17:19:35 UTC
Description of problem:

This is observed on all RHEL8 systems, but on none of RHEL7 systems.
When partitioning a disk with a DOS label, the disk geometry read from the kernel is not preserved in favor of a new geometry determined somehow by parted.

This is problematic for the boot disk because Grub2 legacy code relies on C/H/S values to perform the reads, which ends up on some hardware (e.g. MegaRAID RAID1) to be super slow (~400KB/s throughput), which is a real issue to properly read the 70MB initramfs used to boot systems (this ends up booting the kernel in ~2 minutes instead of a few seconds).

See also similar issue with sfdisk/fdisk (BZ #2024260).

Version-Release number of selected component (if applicable):

parted-3.2-39.el8.x86_64

How reproducible:

Always (the geometry change, not the Grub2 slowness)

Steps to Reproduce:

1. Attach a SCSI disk to a QEMU/KVM

2. Wipe the disk 

  # wipefs -a /dev/sda
  # sfdisk -g /dev/sda       
  /dev/sda: 1011 cylinders, 34 heads, 61 sectors/track

3. Partition the disk with a single partition

  # parted /dev/sda mklabel msdos
  Information: You may need to update /etc/fstab.

  # parted /dev/sda mkpart primary 1 512
  Information: You may need to update /etc/fstab.

4. Check the new geometry (differs)

  # sfdisk -g /dev/sda
  /dev/sda: 1011 cylinders, 255 heads, 2 sectors/track


Actual results:

See above

Expected results:

No change: initial disk geometry used (1011/6/33), as seen on RHEL7

Additional info:

With strace, we can see that the kernel always reports the correct geometry, but then the partition table uses different values:

  48427 18:11:17.060692 ioctl(3</dev/sda<block 8:0>>, HDIO_GETGEO, {heads=34, sectors=61, cylinders=1011, start=0}) = 0 <0.000262>

This doesn't happen with GPT partitioning.

Comment 1 Brian Lane 2021-11-18 21:46:33 UTC
I am not sure that CHS has anything to do with your slowdown. parted cannot change the disk geometry, that ultimately comes from the BIOS. parted does write it to the msdos partition table for each partition, and yes this changed back in 2016 to fix a problem with the values returned by HDIO_GETGEO being incorrect. But that really shouldn't have any effect.

The reason you are seeing different values for CHS from sfdisk is because the kernel uses one detection method when the disk is empty, and another when it has partitions -- it looks for the largest partition. But in the end these numbers really have no meaning for modern storage, so I wouldn't depend on them for anything.
j
I also cannot find any code in grub2 that a different CHS setting would have an effect on, grub2 gets the disk geometry from the BIOS via an int13 call not from the partition table. It might be possible that the MegaRAID itself is sensitive to the CHS values, but really it shouldn't be using them for anything, and that's outside the scope of things we can fix.

If you can find some way to compare booting with only changes to the partition table, nothing else, that might lead to what's actually going on.

Comment 11 Renaud Métrich 2021-12-08 15:03:40 UTC
I'm attaching 2 screenshots of a test made with various geometry:
- the one as created by RHEL7 parted: 255/1023/63
- the one as created by RHEL8 parted: 255/480/2

This are the traces I added inside Grub, when performing a loading of a 10MB file.
Clearly the issue is with the number of sectors per track, which forces Grub to only read by chunk of 2 sectors, instead of up to 63, resulting in tons of I/Os which seem to be slow with MegaRAID.

Comment 12 Renaud Métrich 2021-12-08 15:04:30 UTC
Created attachment 1845284 [details]
Test with "RHEL7" partitioning (S=63)

Comment 13 Renaud Métrich 2021-12-08 15:05:06 UTC
Created attachment 1845285 [details]
Test with "RHEL8" partitioning (S=2)

Comment 14 Brian Lane 2021-12-08 22:53:07 UTC
Looking at the grub2 code I think it's pretty clear this is a MegaRAID bug. I can only assume what they are doing, but it looks like they grab the CHS from the start of the first partition and use that, passing it back to grub2 via the INT13 call in grub_biosdisk_get_diskinfo_standard.

I don't think there is anything parted can do here. The smaller CHS value in parted 3.2 is a result of a bugfix that has been present for years that fixed boot failures with SD cards, so I am not willing to change it and take the risk of re-breaking those systems. I think you'll have to try to file a bug with MegaRAID.

Comment 15 RHEL Program Management 2021-12-08 22:53:13 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.

Comment 17 Robbie Harwood 2022-07-07 22:14:09 UTC
*** Bug 2102075 has been marked as a duplicate of this bug. ***