OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:05 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 13, 2022 1:37 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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).


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 13, 2022 2:17 pm 
Offline
Member
Member

Joined: Wed Aug 30, 2017 8:24 am
Posts: 1593
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.

_________________
Carpe diem!


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 13, 2022 2:45 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
I will try that, Thanks!


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 13, 2022 2:52 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Tue Aug 16, 2022 7:50 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Tue Aug 16, 2022 9:39 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Wed Aug 17, 2022 8:32 am 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
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?


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Wed Aug 17, 2022 3:29 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 20, 2022 2:28 am 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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 ??


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 20, 2022 11:36 am 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
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.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Sat Aug 20, 2022 2:33 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
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...


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Mon Aug 22, 2022 5:59 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
How ?


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Mon Aug 22, 2022 6:09 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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 ?? :)


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Mon Aug 22, 2022 6:22 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
I mean simpler things, like crashing QEMU or making your disk image grow bigger than 32MB. Probably nothing as exciting as you're imagining.


Top
 Profile  
 
 Post subject: Re: Are Windows & Linux Drivers That SLOW !! (AHCI)
PostPosted: Mon Aug 22, 2022 6:45 pm 
Offline
Member
Member

Joined: Fri Feb 11, 2022 4:55 am
Posts: 435
Location: behind the keyboard
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.." :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 89 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group