diff mbox

disk/mdraid1x: Fix >2TB RAID detection with BIOS

Message ID 2473dccf-4466-3cab-3fef-76f6366fe28a@gmail.com
State New
Headers show

Commit Message

Andrei Borzenkov Nov. 19, 2016, 8:59 a.m. UTC
18.11.2016 23:43, Robert LeBlanc пишет:
> 

> grub> ls -l

> Device hd0: No known filesystem detected - Sector size 512B - Total size

> 2147483648KiB

>        Partition hd0,gpt2: No known filesystem detected - Partition start at

> 2048KiB - Total size 5368707055.5KiB

>        Partition hd0,gpt1: No known filesystem detected - Partition start at

> 1024KiB - Total size 1024KiB


Oh. Could you please run attached patch on top of pure GIT (without your
patch) and send me output. It adds some debug print to biosdisk driver
so we can try to guess what happens. After building, generate minimal
image to avoid too much output

bor@bor-Latitude-E5450:~/build/grub$ echo "set debug=biosdisk" >
/tmp/load.cfg
bor@bor-Latitude-E5450:~/build/grub$ pkgdatadir=$PWD ./grub-mkimage -O
i386-pc -d grub-core -o grub.img -p "(md/xxx)/" -c /tmp/load.cfg
biosdisk mdraid1x


Actual array name is irrelevant and is there simply to force raid scan.
After that copy it to /boot, go to GRUB CLI and run

multiboot /boot/grub.img
boot
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Robert LeBlanc Nov. 19, 2016, 5:57 p.m. UTC | #1
On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> biosdisk mdraid1x


Here is the screenshot of the output.

----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Andrei Borzenkov Nov. 19, 2016, 6:40 p.m. UTC | #2
19.11.2016 20:57, Robert LeBlanc пишет:
> On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>> biosdisk mdraid1x
> 
> Here is the screenshot of the output.
> 


So it does not even mask LBA to 32 bit, it really returns 2TB. What
system (motherboard) is it? What is disk controller? How drives are
connected (directly to motherboard or some external adapter)?
Robert LeBlanc Nov. 20, 2016, 2:47 a.m. UTC | #3
This is on super micro and KVM. You can replicate it on a VM.

Sent from a mobile device, please excuse any typos.

On Nov 19, 2016 11:40 AM, "Andrei Borzenkov" <arvidjaar@gmail.com> wrote:

> 19.11.2016 20:57, Robert LeBlanc пишет:

> > On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com>

> wrote:

> >> biosdisk mdraid1x

> >

> > Here is the screenshot of the output.

> >

>

>

> So it does not even mask LBA to 32 bit, it really returns 2TB. What

> system (motherboard) is it? What is disk controller? How drives are

> connected (directly to motherboard or some external adapter)?

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Robert LeBlanc Nov. 20, 2016, 3:38 a.m. UTC | #4
The super micro is iSCSI boot off Intel adapters. KVM is SCSI disks.

Sent from a mobile device, please excuse any typos.

On Nov 19, 2016 7:47 PM, "Robert LeBlanc" <robert@leblancnet.us> wrote:

> This is on super micro and KVM. You can replicate it on a VM.

>

> Sent from a mobile device, please excuse any typos.

>

> On Nov 19, 2016 11:40 AM, "Andrei Borzenkov" <arvidjaar@gmail.com> wrote:

>

>> 19.11.2016 20:57, Robert LeBlanc пишет:

>> > On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com>

>> wrote:

>> >> biosdisk mdraid1x

>> >

>> > Here is the screenshot of the output.

>> >

>>

>>

>> So it does not even mask LBA to 32 bit, it really returns 2TB. What

>> system (motherboard) is it? What is disk controller? How drives are

>> connected (directly to motherboard or some external adapter)?

>>

>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Andrei Borzenkov Nov. 20, 2016, 6:53 a.m. UTC | #5
20.11.2016 05:47, Robert LeBlanc пишет:
> This is on super micro and KVM. You can replicate it on a VM.
> 

I can't without more details. 5TB drive is correctly shown as 5TB in
QEMU KVM 2.5 here.

> Sent from a mobile device, please excuse any typos.
> 
> On Nov 19, 2016 11:40 AM, "Andrei Borzenkov" <arvidjaar@gmail.com> wrote:
> 
>> 19.11.2016 20:57, Robert LeBlanc пишет:
>>> On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com>
>> wrote:
>>>> biosdisk mdraid1x
>>>
>>> Here is the screenshot of the output.
>>>
>>
>>
>> So it does not even mask LBA to 32 bit, it really returns 2TB. What
>> system (motherboard) is it? What is disk controller? How drives are
>> connected (directly to motherboard or some external adapter)?
>>
>
Robert LeBlanc Nov. 22, 2016, 7 p.m. UTC | #6
Andrei,

I sent a VM that displays the problem. It bounced from the listserv (I
kind of expected that), but should have been sent to your email
directly as well.

For my own curiosity are you against the patch I submitted? I
understand that you are trying to figure out why the sectors can't be
accessed as a larger issue. Is there something I can do to help get
this resolved?

Some more details on the hardware:
SuperMicro SYS-6028TP-HTFR
BIOS 1.1 American Megatrends Inc 08/03/2015
Intel I350 NIC firmware 1.63 (iSCSI boot)

For KVM I'm running Debian stretch with
ii  qemu-kvm
1:2.7+dfsg-3+b1                      amd64        QEMU Full
virtualization on x86 hardware



----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1


On Sat, Nov 19, 2016 at 11:53 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
> 20.11.2016 05:47, Robert LeBlanc пишет:
>> This is on super micro and KVM. You can replicate it on a VM.
>>
>
> I can't without more details. 5TB drive is correctly shown as 5TB in
> QEMU KVM 2.5 here.
>
>> Sent from a mobile device, please excuse any typos.
>>
>> On Nov 19, 2016 11:40 AM, "Andrei Borzenkov" <arvidjaar@gmail.com> wrote:
>>
>>> 19.11.2016 20:57, Robert LeBlanc пишет:
>>>> On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com>
>>> wrote:
>>>>> biosdisk mdraid1x
>>>>
>>>> Here is the screenshot of the output.
>>>>
>>>
>>>
>>> So it does not even mask LBA to 32 bit, it really returns 2TB. What
>>> system (motherboard) is it? What is disk controller? How drives are
>>> connected (directly to motherboard or some external adapter)?
>>>
>>
>
Robert LeBlanc Dec. 6, 2016, 4:59 p.m. UTC | #7
What is the verdict on getting the RAID detection fixed?

Thanks,
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1


On Tue, Nov 22, 2016 at 12:00 PM, Robert LeBlanc <robert@leblancnet.us> wrote:
> Andrei,
>
> I sent a VM that displays the problem. It bounced from the listserv (I
> kind of expected that), but should have been sent to your email
> directly as well.
>
> For my own curiosity are you against the patch I submitted? I
> understand that you are trying to figure out why the sectors can't be
> accessed as a larger issue. Is there something I can do to help get
> this resolved?
>
> Some more details on the hardware:
> SuperMicro SYS-6028TP-HTFR
> BIOS 1.1 American Megatrends Inc 08/03/2015
> Intel I350 NIC firmware 1.63 (iSCSI boot)
>
> For KVM I'm running Debian stretch with
> ii  qemu-kvm
> 1:2.7+dfsg-3+b1                      amd64        QEMU Full
> virtualization on x86 hardware
>
>
>
> ----------------
> Robert LeBlanc
> PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
>
>
> On Sat, Nov 19, 2016 at 11:53 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>> 20.11.2016 05:47, Robert LeBlanc пишет:
>>> This is on super micro and KVM. You can replicate it on a VM.
>>>
>>
>> I can't without more details. 5TB drive is correctly shown as 5TB in
>> QEMU KVM 2.5 here.
>>
>>> Sent from a mobile device, please excuse any typos.
>>>
>>> On Nov 19, 2016 11:40 AM, "Andrei Borzenkov" <arvidjaar@gmail.com> wrote:
>>>
>>>> 19.11.2016 20:57, Robert LeBlanc пишет:
>>>>> On Sat, Nov 19, 2016 at 1:59 AM, Andrei Borzenkov <arvidjaar@gmail.com>
>>>> wrote:
>>>>>> biosdisk mdraid1x
>>>>>
>>>>> Here is the screenshot of the output.
>>>>>
>>>>
>>>>
>>>> So it does not even mask LBA to 32 bit, it really returns 2TB. What
>>>> system (motherboard) is it? What is disk controller? How drives are
>>>> connected (directly to motherboard or some external adapter)?
>>>>
>>>
>>
diff mbox

Patch

From: Andrei Borzenkov <arvidjaar@gmail.com>
Subject: [PATCH] biosdisk: debug output for disk parameters

Add debug output to track BIOS behavior with 4Kn disks.

---
 grub-core/disk/i386/pc/biosdisk.c | 45 +++++++++++++++++++++++++++++++++++----
 include/grub/i386/pc/biosdisk.h   |  1 +
 2 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/grub-core/disk/i386/pc/biosdisk.c b/grub-core/disk/i386/pc/biosdisk.c
index f0aadd1..ef69f13 100644
--- a/grub-core/disk/i386/pc/biosdisk.c
+++ b/grub-core/disk/i386/pc/biosdisk.c
@@ -84,6 +84,8 @@  grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
 
   grub_bios_interrupt (0x13, &regs);
   return (regs.eax >> 8) & 0xff;
+  // return regs.flags & GRUB_CPU_INT_FLAGS_CARRY ? (regs.eax >> 8) & 0xff : 0;
+
 }
 
 /*
@@ -335,6 +337,7 @@  grub_biosdisk_open (const char *name, grub_disk_t disk)
   grub_uint64_t total_sectors = 0;
   int drive;
   struct grub_biosdisk_data *data;
+  int ret;
 
   drive = grub_biosdisk_get_drive (name);
   if (drive < 0)
@@ -369,11 +372,17 @@  grub_biosdisk_open (const char *name, grub_disk_t disk)
 	  struct grub_biosdisk_drp *drp
 	    = (struct grub_biosdisk_drp *) GRUB_MEMORY_MACHINE_SCRATCH_ADDR;
 
+	  grub_dprintf ("biosdisk", "%s: int13 version=%u\n", disk->name, version);
 	  /* Clear out the DRP.  */
 	  grub_memset (drp, 0, sizeof (*drp));
 	  drp->size = sizeof (*drp);
-	  if (! grub_biosdisk_get_diskinfo_int13_extensions (drive, drp))
+	  if (! (ret = grub_biosdisk_get_diskinfo_int13_extensions (drive, drp)))
 	    {
+	      grub_dprintf ("biosdisk", "%s: DRP size=%u flags=%x c=%u h=%u s=%u t=%"
+			    PRIuGRUB_UINT64_T " bpi=%u\n",
+			    disk->name, drp->size, drp->flags, drp->cylinders, drp->heads,
+			    drp->sectors, drp->total_sectors, drp->bytes_per_sector);
+
 	      data->flags = GRUB_BIOSDISK_FLAG_LBA;
 
 	      if (drp->total_sectors)
@@ -394,16 +403,22 @@  grub_biosdisk_open (const char *name, grub_disk_t disk)
 		       disk->log_sector_size++);
 		}
 	    }
+	  else
+	    grub_dprintf ("biosdisk", "%s: int13 get ext failed %x\n", disk->name, ret);
 	}
+      else
+	grub_dprintf ("biosdisk", "%s: int13 check ext failed\n", disk->name);
     }
 
   if (! (data->flags & GRUB_BIOSDISK_FLAG_CDROM))
     {
-      if (grub_biosdisk_get_diskinfo_standard (drive,
+      if ((ret = grub_biosdisk_get_diskinfo_standard (drive,
 					       &data->cylinders,
 					       &data->heads,
-					       &data->sectors) != 0)
+					       &data->sectors)) != 0)
         {
+	  grub_dprintf ("biosdisk", "%s: get_diskinfo failed %x\n", disk->name, ret);
+
 	  if (total_sectors && (data->flags & GRUB_BIOSDISK_FLAG_LBA))
 	    {
 	      data->sectors = 63;
@@ -419,6 +434,9 @@  grub_biosdisk_open (const char *name, grub_disk_t disk)
 	      return grub_error (GRUB_ERR_BAD_DEVICE, "%s cannot get C/H/S values", disk->name);
 	    }
         }
+      else
+	grub_dprintf ("biosdisk", "%s: C/H/S=%lu/%lu/%lu\n", disk->name,
+		      data->cylinders, data->heads, data->sectors);
 
       if (data->sectors == 0)
 	data->sectors = 63;
@@ -461,6 +479,7 @@  grub_biosdisk_rw (int cmd, grub_disk_t disk,
 		  unsigned segment)
 {
   struct grub_biosdisk_data *data = disk->data;
+  int ret;
 
   /* VirtualBox fails with sectors above 2T on CDs.
      Since even BD-ROMS are never that big anyway, return error.  */
@@ -501,19 +520,37 @@  grub_biosdisk_rw (int cmd, grub_disk_t disk,
 			       disk->name);
 	}
       else
-        if (grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap))
+        if ((ret = grub_biosdisk_rw_int13_extensions (cmd + 0x42, data->drive, dap)))
 	  {
+	    grub_dprintf ("biosdisk", "%s: ext sec=%" PRIuGRUB_UINT64_T " size=%"
+			  PRIuGRUB_SIZE " ret=%u\n",
+			  disk->name, sector, size, ret);
+
 	    /* Fall back to the CHS mode.  */
 	    data->flags &= ~GRUB_BIOSDISK_FLAG_LBA;
 	    disk->total_sectors = data->cylinders * data->heads * data->sectors;
 	    return grub_biosdisk_rw (cmd, disk, sector, size, segment);
 	  }
+	else if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT))
+	  {
+	    grub_dprintf ("biosdisk", "%s: ext sec=%" PRIuGRUB_UINT64_T " size=%"
+			  PRIuGRUB_SIZE "\n",
+			  disk->name, sector, size);
+	      data->flags |= GRUB_BIOSDISK_FLAG_DPRINT;
+	  }
     }
   else
     {
       unsigned coff, hoff, soff;
       unsigned head;
 
+      if (!(data->flags & GRUB_BIOSDISK_FLAG_DPRINT))
+	{
+	  grub_dprintf ("biosdisk", "%s: legacy sec=%" PRIuGRUB_UINT64_T " size=%"
+			PRIuGRUB_SIZE "\n",
+			disk->name, sector, size);
+	  data->flags |= GRUB_BIOSDISK_FLAG_DPRINT;
+	}
       /* It is impossible to reach over 8064 MiB (a bit less than LBA24) with
 	 the traditional CHS access.  */
       if (sector >
diff --git a/include/grub/i386/pc/biosdisk.h b/include/grub/i386/pc/biosdisk.h
index 3d80716..fa0862f 100644
--- a/include/grub/i386/pc/biosdisk.h
+++ b/include/grub/i386/pc/biosdisk.h
@@ -24,6 +24,7 @@ 
 
 #define GRUB_BIOSDISK_FLAG_LBA	1
 #define GRUB_BIOSDISK_FLAG_CDROM 2
+#define GRUB_BIOSDISK_FLAG_DPRINT 4
 
 #define GRUB_BIOSDISK_CDTYPE_NO_EMUL	0
 #define GRUB_BIOSDISK_CDTYPE_1_2_M	1
-- 
tg: (0d663b5..) t/biosdisk (depends on: master)