Stange delay loading XBMC
#1
Question 
Hello world,

Some days ago I've replace the HDD of my xbox with a spare 250 G HDD...
Now I notice a strange latency in the process of mounting drive F during xbmc startup.

This is xbmc.log with the original disk:
......
00:00:41 M: 54398976 NOTICE: Mapping drive E to Harddisk0\Partition1
00:00:41 M: 54398976 NOTICE: Unmapped drive D
00:00:41 M: 54398976 NOTICE: Mapping drive D to Cdrom0
00:00:41 M: 54398976 NOTICE: Mapping drive F to Harddisk0\Partition6
.....

and this is with the new HDD:
......
00:00:41 M: 54398976 NOTICE: Mapping drive E to Harddisk0\Partition1
00:00:41 M: 54398976 NOTICE: Unmapped drive D
00:00:41 M: 54398976 NOTICE: Mapping drive D to Cdrom0
00:00:44 M: 54398976 NOTICE: Mapping drive F to Harddisk0\Partition6
.....

As you can see there is a new 3s delay from "Mapping drive D to Cdrom0" to "Mapping drive F to Harddisk0\Partition6".

The version of xbmc is the same (the latest T3CH release).
The bios is M8 with lba48 support configured to give all the space to partition F.
Partition F is formatted using XBPartitioner 1.1.

I've wiped the first bytes of the HDD (de-facto removing the partition on disk) and the problem is still present, so the problem is not located to the "ondisk partition".

Looking at the sources (XBMC/xbmc/Application.cpp) the problem I've is triggered here:

919 // Attempt to read the LBA48 v3 patch partition table, if kernel supports the command and it exists.
920 CIoSupport::ReadPartitionTable();
921 if (CIoSupport::HasPartitionTable())
922 {
923 // Mount up to Partition15 (drive OSmile if they are available.
924 for (int i=EXTEND_PARTITION_BEGIN; i <= EXTEND_PARTITION_END; i++)
925 {
926 char szDevice[32];
927 if (CIoSupport:TongueartitionExists(i))
928 {
929 char cDriveLetter = 'A' + i - 1;
930 sprintf(szDevice, "Harddisk0\\Partition%u", i);
931
932 CIoSupport::RemapDriveLetter(cDriveLetter, szDevice);
933 }
934 }
935 }
936 else
937 {
938 if (CIoSupport:Big GrinriveExists('F'))
939 CIoSupport::RemapDriveLetter('F', "Harddisk0\\Partition6");
940 if (CIoSupport:Big GrinriveExists('G'))
941 CIoSupport::RemapDriveLetter('G', "Harddisk0\\Partition7");
942 }
943
944 CIoSupport::RemapDriveLetter('X',"Harddisk0\\Partition3");

this more precisely lead me to "XBMC/xbmc/xbox/IoSupport.cpp"...
I think the slowdown may be here:

653 stat = NtDeviceIoControlFile(handle, 0, 0, 0, &io_stat_block,
654 IOCTL_CMD_LBA48_ACCESS,
655 ioctl_cmd_in_buf, sizeof(ioctl_cmd_in_buf),
656 ioctl_cmd_out_buf, sizeof(ioctl_cmd_out_buf));

but unluckily these pieces of code don't have any debug log... so I cannot proceed beyond Sad

Looking at various xbmx.log found over the net I've found that many peoples have this delay in the same point... so now I'm a bit confused... Is this normal ? Why with the original disk this delay does not show up Huh

Any advice is welcome Tongue

Thanks...
Janniz
Reply
#2
Question 
After further analisys I've detected the point where these 3s are lost.

The delay appen when CIoSupport:TongueartitionExists is called for partition 6. In particular this happen executing
Code:
status = NtOpenFile(&hTemp, GENERIC_READ | GENERIC_WRITE, &oa, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_ALERT);
Since this is from Microsoft Kernel APIs, I don't know why this can happen Huh Can be a bug of the EvoX M8 bios ?
Maybe there is some sort of incompatibility from the HDD (configuread as CS) and the Xbox ?

Any idea or suggestion will be really appreciated...
Thanks in advance.

Janniz
Reply
#3
Ooops... sorry... maybe the right place for this thread is under the "Creators' Corner".
Can some administrator move it ?

Thank you...
Reply
#4
Ok... Now I'm sure that these 3s delay are into the execution path I've stated into my previous posts.

I've changed the method that detect the PartitionTable (bool CIoSupport::ReadPartitionTable()) forcing
Code:
m_fPartitionTableIsValid = false;
return false;
and the delay is "magically" vanished. Now from
NOTICE: Mapping drive D to Cdrom0
and
NOTICE: Mapping drive F to Harddisk0\Partition6
pass 0 seconds Smile

In fact these changes forces XBMC to 'guess' if that partitions F & G exists, looking at the kernel version and at disk size triggering "CIoSupport:Big GrinriveExists" instead of "CIoSupport:TongueartitionExists".


I cannot still understand why
Code:
status = NtOpenFile(&hTemp, GENERIC_READ | GENERIC_WRITE, &oa, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_ALERT);
is 3 seconds long... but at least I don't have to endure this delay any time I turn my Xbox on Tongue

Now I've only to really invalidate partition table on the disk... I thought I've already done this wiping the first bytes of the disk... but probably something is gone wrong somewhere...

See ya
Janniz
Reply

Logout Mark Read Team Forum Stats Members Help
Stange delay loading XBMC0