Page 1 of 2
Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 13, 2022 1:37 pm
by devc1
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).
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 13, 2022 2:17 pm
by nullplan
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 13, 2022 2:45 pm
by devc1
I will try that, Thanks!
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 13, 2022 2:52 pm
by Octocontrabass
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Tue Aug 16, 2022 7:50 pm
by devc1
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Tue Aug 16, 2022 9:39 pm
by Octocontrabass
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Wed Aug 17, 2022 8:32 am
by thewrongchristian
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?
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Wed Aug 17, 2022 3:29 pm
by devc1
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 20, 2022 2:28 am
by devc1
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 ??
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 20, 2022 11:36 am
by thewrongchristian
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.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Sat Aug 20, 2022 2:33 pm
by Octocontrabass
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...
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Mon Aug 22, 2022 5:59 pm
by devc1
How ?
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Mon Aug 22, 2022 6:09 pm
by devc1
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 ??
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Mon Aug 22, 2022 6:22 pm
by Octocontrabass
I mean simpler things, like crashing QEMU or making your disk image grow bigger than 32MB. Probably nothing as exciting as you're imagining.
Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
Posted: Mon Aug 22, 2022 6:45 pm
by devc1
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.."