OSDev.org
https://forum.osdev.org/

Are Windows & Linux Drivers That SLOW !! (AHCI)
https://forum.osdev.org/viewtopic.php?f=1&t=56427
Page 1 of 2

Author:  devc1 [ Sat Aug 13, 2022 1:37 pm ]
Post subject:  Are Windows & Linux Drivers That SLOW !! (AHCI)

Hello, I've seen that from my successful AHCI Driver it took exactly 1100 ms to read 500 MB from the Hard Drive of an old laptop (Using 0x40000 Bytes per command and Mesured with HPET), ATA_IDENTIFY_DEVICE_DATA.ModelNumber = wdc wd3200bekt-75pvmt1 (Said 300 MB/S 7200 RPM). QEMU Took over 500-600 ms to read 500 MB which is very fast for some HDD. Is it an effect of native command queuing? Windows (and maybe Linux) are way slower than this !
Windows Crystal Disk Mark returns 98 MB/S.
Another Question! I want to know the number of sectors in the hard disk (it is 320 GB), when I read ATA_IDENTIFY_DEVICE_DATA.UserAccessibleSectors it returns only 131000 MB (Around 100GB).

Author:  nullplan [ Sat Aug 13, 2022 2:17 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

devc1 wrote:
Another Question! I want to know the number of sectors in the hard disk (it is 320 GB), when I read ATA_IDENTIFY_DEVICE_DATA.UserAccessibleSectors it returns only 131000 MB (Around 100GB).

There is a READ CAPACITY(16) command that will return the block size and the highest LBA. The product of both (OK, one more than highest LBA times block size) is the capacity of the device. Ought to be supported by most devices, as it is typically used by drivers to find the drive capacity. Also, it is the only thing that tells you the block size.

Author:  devc1 [ Sat Aug 13, 2022 2:45 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

I will try that, Thanks!

Author:  Octocontrabass [ Sat Aug 13, 2022 2:52 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

devc1 wrote:
Another Question! I want to know the number of sectors in the hard disk (it is 320 GB), when I read ATA_IDENTIFY_DEVICE_DATA.UserAccessibleSectors it returns only 131000 MB (Around 100GB).

I have no idea which structure you're referring to there, but it sounds like you're talking about the value in words 60 and 61. That value is limited to 28 bits, which means 128 GiB for a drive with 512-byte sectors. Larger drives will report the maximum 48-bit LBA in words 100-103. I strongly suggest you read the draft of the ATA version supported by your drive to understand what information it reports.

nullplan wrote:
There is a READ CAPACITY(16) command

That's SCSI, not ATA.

Author:  devc1 [ Tue Aug 16, 2022 7:50 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

Okay but that's not answering my question, why my driver reads the hard drive with almost 500 mb/s, the specs say it is 300 mb/s and windows benchmarks say it is 98 mb/s.

Author:  Octocontrabass [ Tue Aug 16, 2022 9:39 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

There may be a problem with how you're using the timer to measure the transfer time, or you may be transferring less data than you think. SATA 3Gb/s is not physically capable of transferring more than 300MB per second.

Author:  thewrongchristian [ Wed Aug 17, 2022 8:32 am ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

devc1 wrote:
Okay but that's not answering my question, why my driver reads the hard drive with almost 500 mb/s, the specs say it is 300 mb/s and windows benchmarks say it is 98 mb/s.


Are you doing this under QEMU?

Are you sure you're actually reading from the disk, and not from some virtual disk on the host filesystem, which may well be caching the data and thus giving you inflated read speeds?

Author:  devc1 [ Wed Aug 17, 2022 3:29 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

Yeah it is reading the disk using 0x40000 bytes per cmd, and I print some sectors. Qemu reads 500 mb in 500-650ms and in real hardware (my old mentionned laptop) it reads 500 mb in 1100 ms without Task File Errors.

Author:  devc1 [ Sat Aug 20, 2022 2:28 am ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

My Drive Image in QEMU is only 32MB, Different commands from higher LBA doesn't Task File Error. This is weird ? I know QEMU Skips alot of checks but for this ??

Author:  thewrongchristian [ Sat Aug 20, 2022 11:36 am ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

devc1 wrote:
My Drive Image in QEMU is only 32MB, Different commands from higher LBA doesn't Task File Error. This is weird ? I know QEMU Skips alot of checks but for this ??


QEMU is probably using a sparse file, reading blank media that has not yet been written as blocks of zeroes. Hence the seemingly high performance in your test, it's using constant data.

Author:  Octocontrabass [ Sat Aug 20, 2022 2:33 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

devc1 wrote:
My Drive Image in QEMU is only 32MB, Different commands from higher LBA doesn't Task File Error. This is weird ? I know QEMU Skips alot of checks but for this ??

Congratulations, you've found a QEMU bug.

I wonder if you can use this bug to bypass hypervisor security...

Author:  devc1 [ Mon Aug 22, 2022 5:59 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

How ?

Author:  devc1 [ Mon Aug 22, 2022 6:09 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

Mr. Octoconbrass, can you provide further information ?
I'm now in a vacation and I'll be there in the next 2 weeks, I don't really know what you're talking about (hypervisor security...), do you mean running kernel mode code in Windows ? Or writing system files ? Or logging through users without password ? This is interesting right ?? :)

Author:  Octocontrabass [ Mon Aug 22, 2022 6:22 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

I mean simpler things, like crashing QEMU or making your disk image grow bigger than 32MB. Probably nothing as exciting as you're imagining.

Author:  devc1 [ Mon Aug 22, 2022 6:45 pm ]
Post subject:  Re: Are Windows & Linux Drivers That SLOW !! (AHCI)

Okay I'm gonna try that, what does this have with "hypervisor security". And can u answer the question in the last forum "High performance graphics for all GPUS.." :)

Page 1 of 2 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/